Events: user reactions
KVIrc triggers an event when a particular situation occurs (hehe :D).
You can define a set of event handlers for each event type.
An event handler is a snippet of user-defined code that gets executed when the event is triggered.
Event handlers can be created or destroyed by using the scriptcenter (graphic interface) or even from the commandline (or script) by using the event command.
For example, the onirc is triggered when the login operations have been terminated and you can consider yourself "completely" on IRC. For example , you might want to "auto-join" some channels. Nothing easier! The following snippet of code adds a handler to the OnIRC event that joins three channels:

    echo Auto-joining my preferred channels...
    join #kvirc,#siena,#linux

Now try to connect to a server and you'll see that it joins automatically the three channels!.
You might also want to do some other actions just after the connection has been established, for example you might want to look immediately for a friend of yours by issuing a whois to the server (well.. you could use the notify list for that, but well, this is an example).
You can add the whois request to the handler above or just create a new one:

    echo Looking for fred...
    whois fred

(An even nicer idea would be to use the awhois command...but that's left to the reader as exercise.
To remove an event handler you still use the event command , but with an empty code block:


Certain events will pass you some data in the positional parameters.
For example, when you are being banned from a channel, KVIrc triggers the onmeban event: you might be interested in WHO has banned you. KVIrc will pass the "ban source" informations in the positional parameters $0,$1 and $2.
(Please note that the parameters started from $1 in KVIrc versions older than 3.0.0!).
You may take a look at the list of available events.

Index, Language Overview
KVIrc 3.9.99 Documentation
Generated by root at Wed Oct 17 19:34:06 2007