Fair warning, a better system for custom events is coming. chat/timer events work the same way, but custom events using #event will be slightly different.
The difference will be....
parsing
For example... Genbot uses this event
However, in the new system it will not work without a slight modification!
The new system requires that you use the entire line of chat. BUT allows for making sections of the line a parameter.
Here is what the change will make this event look like:
Code: Select all
#Event SelfEcho "[MQ2] Genbot #1#"
The #1# in the middle of the match text is what you use to indicate "this part of the message should be given to me in a parameter". The parser will do its best to get you the portion you're asking for if the event matches. The number between the pound signs says what parameter number you want this to be in your Sub Event_Whatever. The first parameter in the sub will be the entire line itself... 1 starts AFTER that. e.g. this event could look like this:
Code: Select all
Sub Event_SelfEcho(string Line, string Command)
Because this system lets you pick the parameter number of any portion of the message, some parameters might not get made (e.g. wont be ${Defined}... it's up to you to make sure you get the ones you need defined.
Also, if you need to SKIP a portion of the text (dont care about it, just need to ignore part of the text that might not match, whatever), you can use #*#.
Imagine this is the text that matches the event text:
"[MQ2] Genbot THIS IS MY COMMAND"
The two parameters are:
Line=[MQ2] Genbot THIS IS MY COMMAND
Command=THIS IS MY COMMAND
The system also allows you to grab a MQ2Data value like this:
Code: Select all
#Event SelfEcho "[MQ2] Genbot |${Me}| #1#"
The system itself has no idea that MQ2Data even exists, and is just looking for the | or #. MQ2 makes it parse what's inside the || as MQ2Data. So, this event would only hit when, if ${Me} is currently "Lax", the message starts like..
"[MQ2] Genbot Lax whatever"
Note that the MQ2Data is not immediately parsed when the event is made, it gets parsed when the system checks to see if the event is a match.