[TOC]1. What the hell? [TOC]2. Why? [TOC]3. Finding out the RAW number [TOC]4. Using the RAW prefix [TOC]5. Making a script [title]1. What the hell?[/title] This tutorial will handle the use of the RAW event, but before we get there let's run through what is meant by this 'RAW' thing. When you are chatting on mIRC, you are in fact sending text to a server who will then handle the incomming messages and act accordingly. A simple text message for example[code][22:27:39] <@Ward> Hi loves[/code]will be sent to all the people in the channel you are in. If someone wants to react on that incoming text, he or she will use the on TEXT event. But there's more to a server than simply redirecting your messages to someone else. You can, in a way, "ask" it things about it's status. To explain this, I have two examples. Example 1: /ircops Type the above command and press ENTER. Now go to your status window and you'll notice some text appeared (in this case a list of the ircops). Example 2: /map Once again, type in the command and press ENTER. In your status window you'll now find a list of all the servers in this network. In both of the above examples, upon pressing ENTER a command is sent to the server asking it for the ircops, the servers respectively. The server then replies you and the list pops up. Everything the server sends you is identified by a number. We refer to these numbers as "RAW numbers" or "RAW numerics" and in such we use the RAW event to be triggered on certain messages/RAW numbers the server sends us. [title]2. Why?[/title] mIRC has a nice amount of built in triggers (/help Remote) but of course it's hard to make something for everything the server can send you. However, you might want to react on a whois or the MOTD (message of the day). For these events, mIRC has the RAW event that gives you the ability to perform an action when an undefined (undefined in your mIRC client) event occures. [title]3. Finding out the RAW number[/title] Now, before we get to using the RAW event, we'll need to get it's RAW number, it's ID. I'll explain two methods on how to get hold of the RAW number. a. The Int3rn3tz! A list of RAWs can be found at: http://www.mirc.net/raws/ b. The Debug window Type /debug @debug This will open a window that shows all the received/send lines in their purest (RAW) form. In order to find out the number of, for example every part of a whois, let's start by typing:[code]/whois personthatisonline[/code](I did /whois Ward) The whois reply in my case is:[code]Ward is darkool83@h4ppy.info * Ward Ward on @#flameroom Ward using illusion.tx.us.swiftirc.net Its all smoke and mirrors... Ward has identified for this nick Ward has been idle 25secs, signed on Sun Aug 19 11:25:30 Ward End of /WHOIS list.[/code]Now click on your @debug window. You'll find something like this:[code]<- :illusion.tx.us.swiftirc.net 311 Ward`BNC Ward darkool83 h4ppy.info * :Ward <- :illusion.tx.us.swiftirc.net 319 Ward`BNC Ward :@#flameroom <- :illusion.tx.us.swiftirc.net 312 Ward`BNC Ward illusion.tx.us.swiftirc.net :Its all smoke and mirrors... <- :illusion.tx.us.swiftirc.net 307 Ward`BNC Ward :has identified for this nick <- :illusion.tx.us.swiftirc.net 317 Ward`BNC Ward 25 1187515530 :seconds idle, signon time <- :illusion.tx.us.swiftirc.net 318 Ward`BNC Ward :End of /WHOIS list.[/code]Let's assume you're all smarter than you look and have realised what's going on now. First we get the server we're on, then the RAW number, then whatever is typical for that part of the response. For example the RAW with ID 319 is a list of all the channels you are on. (A detailed description of that RAW could then be found at the site mentioned in a.) [i]Note: A whois can have more replies, for example "is a Network Administrator".[/i] [title]4. Using the RAW prefix[/title] Let's open our beloved help file, shall we? Type /help Raw events Notice this part:[quote="helpfile"]raw <numeric>:<matchtext>:<commands>[/quote]For anyone with experience with the help file, it should be pretty clear by now. For the others, pay attention! Let's go over this one by one. - "raw" this is the standard to indicate that what will follow is in the RAW event syntax. You'll always need to write it. :D <numeric> refers to the RAW number, the ID. (Check out [b]3. Finding out the RAW number[/b] to see how to get a hold of this number) <matchtext> is...well..a text to match! Your event will only be triggered if the received raw has that text in it (note: you can use wildcards here meaning you might as well replace the whole matchtext with an asterisk *) <commands> is what you want to do when the event gets triggered, obviously! I assume everyone understands the example given in the help file [quote="helpfile"]raw 322:*mirc*:/echo 5 raw $numeric : $1-[/quote] [i]Note: Out of this example, you realise that $numeric refers to the RAW number[/i] [title]5. Making a script[/title] Ah, the moment we've all been waiting for! In this chapter, we're going to make a script that says what channels a user is in when he joins our chat, so obviously we'll need an on JOIN event. Start with opening a new file and making the on JOIN (I'll give an example, but of course you're more than welcome to make your own) [code]on *:JOIN:#:{ if ($nick != $me) { set -u5 %whois. [ $+ [ $nick ] ] $chan whois $nick } }[/code] The first line is the on JOIN event that will get triggered when someone joins a channel. The second line makes sure it doesn't trigger when YOU join. The third line is a Dynamic Variable I set to check in our RAW event whether the person being whoissed was actually one from our on JOIN event (we don't want actions to be taken every time we whois someone, do we? :wink: ). I also made it unset itself after 5 seconds, just in case you happen to lagg or the likes. The fourth line is the actual whois of the person. Fourth line is the closing bracket of our if. Fifth line is the closing bracket of our on JOIN. Now as you might (or not) remember, we got the RAW number of several parts of the whois reply earlier on [quote][code]<- :illusion.tx.us.swiftirc.net 319 Ward`BNC Ward :@#flameroom [/code][/quote] So 319 is the one we'll need! Now let's start with something simple to check how RAW 319 works Add the following to your remotes (only temporary) and whois someone [code]raw 319:*:{ echo -a $!1 is $1 echo -a $!2 is $2 echo -a $!3 is $3 echo -a $!4 is $4 }[/code] An example of the output will be:[code]$1 is Ward`BNC $2 is Ward $3 is +#mIRC $4 is +#MightScript[/code] From this we learn that $1 is your nickname $2 is the person you whoissed $3- are the channels he/she is on Remove the above mentioned RAW script. Now, let's get to the actual RAW event we will use. Start of the RAW event [code]raw 319:*:{[/code] Checking whether we were looking for this person [code]if (%whois. [ $+ [ $2 ] ]){[/code] Then we message the channel (which we saved earlier on in a %whois.NICK var) Note that I put $$3 instead of $3, making the 3rd parameter compulsory (if someone joins, then leaves immediately and happens to have +p on for example [code]msg %whois. [ $+ [ $2 ] ] $2 is on the following channels: $$3-[/code] Then we unset our variable (as it has no use anymore) [code]unset %whois. [ $+ [ $2 ] ][/code] After which we close our brackets. The entire code will now be: [code]raw 319:*:{ if (%whois. [ $+ [ $2 ] ]) { msg %whois. [ $+ [ $2 ] ] $2 is on the following channels: $$3- unset %whois. [ $+ [ $2 ] ] } }[/code] and not forgetting the on JOIN we made earlier of course: [code]on *:JOIN:#:{ if ($nick != $me) { set -u5 %whois. [ $+ [ $nick ] ] $chan whois $nick } } raw 319:*:{ if (%whois. [ $+ [ $2 ] ]) { msg %whois. [ $+ [ $2 ] ] $2 is on the following channels: $$3- unset %whois. [ $+ [ $2 ] ] } }[/code] P.S.: You can use other RAW lines to prevent all the whoises from spamming you P.P.S.: I'm sure you're smart enough to see that this RAW event will be far from perfect (spamhopping for example) P.P.P.S.: Direct further question to our chat (#mirc) or use our forum