Project

General

Profile

Main » History » Version 2

Per Amundsen, 04/01/2011 01:09 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
if (SOMETING == SOMETHINGELSE) { EXECUTE HERE }
16
if (SOMETING != SOMETHINGELSE) { EXECUTE HERE }
17
if (SOMETING ismatch SOMETHINGELSE) { EXECUTE HERE }
18
19
or by an executed command or function
20
21
Executed commands are /slash commands already in the client e.g /msg #channel hello world.
22
Executed functions are predefined functions in the client, only two exists for now.
23
24
An execution block can consist of both commands and functions if seperated by | (pipe) character like this /msg #channel hello world|.function bla bla|/msg #channel2 hello world
25
26
Furthermore there is a lot of predefined variables for use with these functions, for now they are:
27
28
$event / current event, e.g PRIVMSG 001 MODE and so forth
29
$channel / the channel the event occurred on, if any
30
$msg / the message to the channel/user or the message in a raw irc line e.g whois [kr0n] is a registered nick
31
$nick / the nick the event was sent from, can be a irc.server.com, a nick or null
32
$me / my current nick
33
34
In next beta the following is added:
35
36
$network / the network the event occured on e.g Quakenet
37
$ident / the from user ident if any
38
$host / the from user hostname if any
39
$myident / my ident
40
$myhost / my host
41
42
Currently predefined functions are:
43
.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>
44
45
.eat <what (text or all)>
46
47
.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.
48
49
.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.
50
51
Putting it all togheter, here are a few examples:
52
53
OnEvent if ($event == NOTICE) { if ($msg ismatch hi there) { .insert $nick $server MsgNotice $msg|.eat text } } / insert the notice into the server window and tells adiirc to "eat" its own text output from this notice
54
OnEvent if ($event == PRIVMSG) { if ($msg == herp) { /msg $channel derp } } / if the event is a PRIVMSG and the $msg equals "herp", then show "derp" in the channel
55
OnEvent if ($event == PRIVMSG) { if ($nick == Q) { /msg $channel Q is speaking! } } / if the event is a PRIVMSG and the $nick equals "Q" then show "Q is speaking" in the channel