Difference between revisions of "On start"
From Scriptwiki
m (wording + example) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | The on START event triggers the first time a script file is ever loaded and also every time after that | + | The on START event triggers the first time a script file is ever loaded and also every time after that, including when mIRC is started. |
on <level>:START:<commands> | on <level>:START:<commands> | ||
− | You can use this event to | + | You can use this event as a point of initialization for the script to run commands which are needed before use (e.g. creating and loading data in [[:Category:Hash Table|hash tables]], initializing variables, loading dialogs, connecting to several servers, updating some stats, etc.). |
== Example == | == Example == | ||
on *:START: { | on *:START: { | ||
− | + | [[echo]] -s Connecting to QuakeNet | |
− | + | [[server]] irc.quakenet.org:6667 | |
} | } | ||
This example would make mIRC connect to QuakeNet whenever you start it. | This example would make mIRC connect to QuakeNet whenever you start it. | ||
+ | on *:START:{ | ||
+ | hmake table 10 | ||
+ | if ([[$isfile|$isfile(table.hsh)]]) { [[hload]] table table.hsh } | ||
+ | } | ||
+ | This example creates a hash table when the script is started and, if the file "table.hsh" exists, loads that file into the table. | ||
== See Also == | == See Also == | ||
− | + | * [[On_load|On load event]] - triggers when a script file is loaded for the first time. | |
[[Category:Events]] | [[Category:Events]] |
Latest revision as of 14:28, 3 April 2009
The on START event triggers the first time a script file is ever loaded and also every time after that, including when mIRC is started.
on <level>:START:<commands>
You can use this event as a point of initialization for the script to run commands which are needed before use (e.g. creating and loading data in hash tables, initializing variables, loading dialogs, connecting to several servers, updating some stats, etc.).
Example
on *:START: { echo -s Connecting to QuakeNet server irc.quakenet.org:6667 }
This example would make mIRC connect to QuakeNet whenever you start it.
on *:START:{ hmake table 10 if ($isfile(table.hsh)) { hload table table.hsh } }
This example creates a hash table when the script is started and, if the file "table.hsh" exists, loads that file into the table.
See Also
- On load event - triggers when a script file is loaded for the first time.