mIRC Scripting
mIRC: Raw Events
Raw Events allow you to process server messages by their numeric (or name) value. Every message passed from the server to you in its original format is a raw message. when someone talks mIRC receives a raw event that might look like this:
:Kevin!bncworld@I-Have.a.cool.vhost.com PRIVMSG #mIRC :I feel lucky today
You are actually seeing it as:
<@Kevin> I feel lucky today
As you can see, mIRC processes the information before displaying it to you. By using Raw Events you have the abilities to manipulate the information as you wish.
Numeric Value
To find the numeric value of a server message you can use the /debug command:
This will create a custom window by the name of "debug", mIRC will display the raw messages passing between itself and the server in this window. Using this method you can find the raw numeric of an event. If, for example, your nick is "bar" and you were to type "/whois foo", you might see something similar to this:
View Of /WHOIS foo from /debug @debug |
|---|
| -> :irc.server.name WHOIS foo <- :irc.server.name 311 bar foo ~Ident name-B21D62.lolhat.com :Foo Jenkins <- :irc.server.name 319 bar foo :+#foobar @#kekelar %#scripting <- :irc.server.name 312 bar foo irc.server.name :Server Description <- :irc.server.name 307 bar foo :has identified for this nick <- :irc.server.name 335 bar foo :is a Bot on name <- :irc.server.name 671 bar foo :is using a Secure Connection <- :irc.server.name 318 bar foo :End of /WHOIS list. |
Making And Using Raw Events
Syntax:
;commands
}
The Numeric is the server's message number (see the section above)
The MatchText is the text you want to search for to trigger the event
The Commands are the commands you want to execute when the event triggers
For the purposes of this tutorial, we will make an ON JOIN whois script that will display what channels the user is on.
First we will make the ON JOIN event, when the user joins a channel this event will get triggred.
;Here we set a dynamic variable called "%Whois.Chan.Nick" to the channel's name
;We will use this variable later on in the raw event.
SET %Whois.Chan. $+ $nick $chan
WHOIS $nick
}
Now we will make the part that gathers the channel names. If you read the section above you will know that the numeric value for the channels is 319. The event should look something like this:
;We indicated that the event should trigger on the server's numeric value of 319
}
The raw message looks like this:
<- :irc.server.name 319 bar foo :+#foobar @#kekelar %#scripting
Where $1 is YourName, $2 is the nick of the user you /whoised, $3 is the first channel the user is on (in our case its "#foobar"), $4 is the 2nd channel, and so on...
Lates take what we know and make it into a script.
;We indicated that the event should trigger on the server's numeric value of 319
If (%Whois.Chan. [ $+ [ $2 ] ]) {
;In the if statement we check if we actually /whoised this user
MSG %Whois.Chan. [ $+ [ $2 ] ] [WHOIS] $2 is on $3-.
unset %Whois.Chan. [ $+ [ $2 ] ]
}
}
Here is the full script:
;Here we set a dynamic variable called "%Whois.Chan.Nick" to the channel's name
;We will use this variable later on in the raw event.
SET %Whois.Chan. $+ $nick $chan
WHOIS $nick
}
RAW 319:*:{
;We indicated that the event should trigger on the server's numeric value of 319
If (%Whois.Chan. [ $+ [ $2 ] ]) {
;In the if statement we check if we actually /whoised this user
MSG %Whois.Chan. [ $+ [ $2 ] ] [WHOIS] $2 is on $3-.
unset %Whois.Chan. [ $+ [ $2 ] ]
}
}
Non-Numeric Raws
For non-numeric raws you case the following syntax:
Example:
window -de @Example
aline 5 @Example *Raw Event: $event Line: $1-
}

