# OnKVIrcStartup

Triggered on KVIrc startup

Parameters

    None

Window
Console of the first irc context

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 "completly" 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:

    event(OnIrc,autojoin)
    {
        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 estabilished, 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:

    event(OnIrc,lookforfred)
    {
        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:

    event(OnIrc,lookforfred){}

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.

Description
This event is triggered on KVIrc startup. It is bound to the console of the first created irc context. This is a little tricky, since this event is triggered before the related OnIrcContextCreated event. This is to make OnApplicationStartup be the absolutely first event triggered at all. This event is a good place to load your script configuration and eventually initialize your variables.
See also
OnKVIrcShutdown

Main index, Event index

KVirc 3.0.0 documentation
Generated by root at Thu Apr 29 12:41:05 2004