Project

General

Profile

Main » History » Version 5

Per Amundsen, 04/01/2011 01:12 PM

1 2 Per Amundsen
h1. Scripting
2
3
In the latest beta's, I am experimenting with a little more advanced scripting features and I will use this wiki to track progress and features.
4
5
Syntax, variables and functions will probably change a lot, so don't except previous scripts will still work in the next beta and so forth.
6
7
As of build 290311.
8
9
In Commands -> Edit Commands you can enter a scripting line with the following syntax:
10
11
The line must start with <pre>OnEvent<whitespace></pre>
12
13
Followed by either an expression like this (works recursivly)
14
15 3 Per Amundsen
<pre>
16 2 Per Amundsen
if (SOMETING == SOMETHINGELSE) { EXECUTE HERE }
17
if (SOMETING != SOMETHINGELSE) { EXECUTE HERE }
18 1 Per Amundsen
if (SOMETING ismatch SOMETHINGELSE) { EXECUTE HERE }
19 3 Per Amundsen
</pre>
20 2 Per Amundsen
or by an executed command or function
21
22
Executed commands are /slash commands already in the client e.g /msg #channel hello world.
23
Executed functions are predefined functions in the client, only two exists for now.
24
25 5 Per Amundsen
An execution block can consist of both commands and functions if seperated by | (pipe) character like this <pre>/msg #channel hello world|.function bla bla|/msg #channel2 hello world</pre>
26 2 Per Amundsen
27
Furthermore there is a lot of predefined variables for use with these functions, for now they are:
28
29
$event / current event, e.g PRIVMSG 001 MODE and so forth
30
$channel / the channel the event occurred on, if any
31
$msg / the message to the channel/user or the message in a raw irc line e.g whois [kr0n] is a registered nick
32
$nick / the nick the event was sent from, can be a irc.server.com, a nick or null
33
$me / my current nick
34
35
In next beta the following is added:
36
37
$network / the network the event occured on e.g Quakenet
38
$ident / the from user ident if any
39
$host / the from user hostname if any
40
$myident / my ident
41
$myhost / my host
42
43 1 Per Amundsen
Currently predefined functions are:
44 3 Per Amundsen
<pre>
45 1 Per Amundsen
.insert requires .insert <nick (use null for nonick)> <where (a channel or $channel, a nick or $nick, or status)> <MsgType (MsgServer/MsgUser/MsgEmote/MsgCTCP/MsgNotice/MsgClient/MsgLog)> <$msg or message>
46 3 Per Amundsen
</pre>
47 1 Per Amundsen
48 3 Per Amundsen
<pre>
49 2 Per Amundsen
.eat <what (text or all)>
50 3 Per Amundsen
</pre>
51 2 Per Amundsen
.insert is used for inserting a specific message type into a chat window, its intended for use in cases where you want to override how adiirc shows a given event, but can also be used for adding additional messages.
52 1 Per Amundsen
53
.eat is used to tell adiirc to either "eat" the text output from an event or "eat" everything and don't act on this event at all.
54
55
Putting it all togheter, here are a few examples:
56
57 3 Per Amundsen
<pre>
58
OnEvent if ($event == NOTICE) { if ($msg ismatch hi there) { .insert $nick $server MsgNotice $msg|.eat text } }
59
</pre>
60
61
insert the notice into the server window and tells adiirc to "eat" its own text output from this notice
62
63
<pre>
64
OnEvent if ($event == PRIVMSG) { if ($msg == herp) { /msg $channel derp } }
65
</pre>
66
67
if the event is a PRIVMSG and the $msg equals "herp", then show "derp" in the channel
68
69
<pre>
70
OnEvent if ($event == PRIVMSG) { if ($nick == Q) { /msg $channel Q is speaking! } }
71
</pre>
72
73 4 Per Amundsen
if the event is a PRIVMSG and the $nick equals "Q" then show "Q is speaking" in the channel