Project

General

Profile

Actions

Scripting » History » Revision 7

« Previous | Revision 7/246 (diff) | Next »
Per Amundsen, 04/01/2011 06:25 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 010411.

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

You can now combine expressions with && (AND) and || (OR) like this

if (SOMETHING == SOMETHING && SOMETHINGELSE != SOMETHINGELSE) { EXECUTE HERE }
if (SOMETHING == SOMETHING || SOMETHINGELSE != SOMETHINGELSE) { EXECUTE HERE }

The logic behind these expressions is not fully tested, id love any feedback on this.

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
$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 status 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 && $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 || $nick == $me) { /msg $channel Q or $me is speaking! } }

if the event is a PRIVMSG and the $nick equals "Q" OR $me then show "Q is speaking" in the channel

A list of custom events that is also usable as $event ==

OnOwner
OnDeOwner
OnSpecialOp
OnSpecialDeOp
OnOp
OnDeOp
OnHop
OnDeHop
OnVoice
OnDeVoice

Updated by Per Amundsen almost 13 years ago · 7 revisions

Also available in: PDF HTML TXT