Project

General

Profile

Actions

Main » History » Revision 3

« Previous | Revision 3/190 (diff) | Next »
Per Amundsen, 04/01/2011 01:10 PM


Scripting

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.

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.

As of build 290311.

In Commands -> Edit Commands you can enter a scripting line with the following syntax:

The line must start with

OnEvent<whitespace>

Followed by either an expression like this (works recursivly)

if (SOMETING == SOMETHINGELSE) { EXECUTE HERE }
if (SOMETING != SOMETHINGELSE) { EXECUTE HERE }
if (SOMETING ismatch SOMETHINGELSE) { EXECUTE HERE }

or by an executed command or function

Executed commands are /slash commands already in the client e.g /msg #channel hello world.
Executed functions are predefined functions in the client, only two exists for now.

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

Furthermore there is a lot of predefined variables for use with these functions, for now they are:

$event / current event, e.g PRIVMSG 001 MODE and so forth
$channel / the channel the event occurred on, if any
$msg / the message to the channel/user or the message in a raw irc line e.g whois [kr0n] is a registered nick
$nick / the nick the event was sent from, can be a irc.server.com, a nick or null
$me / my current nick

In next beta the following is added:

$network / the network the event occured on e.g Quakenet
$ident / the from user ident if any
$host / the from user hostname if any
$myident / my ident
$myhost / my host

Currently predefined functions are:

.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>

.eat <what (text or all)>

.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.

.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.

Putting it all togheter, here are a few examples:

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

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

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

Updated by Per Amundsen over 13 years ago · 3 revisions

Also available in: PDF HTML TXT