----------------------------------------------------------

Title: "Understanding Raw Events"

Author: Martyr2

Date: July 25, 2000

Written for BlacK-IcE

----------------------------------------------------------

Have you ever cruised along in mIRC and done one of its many commands? For instance like a /links command to get a list of servers? Well the info the server sends back to you, in this case a list of servers, is assigned a special response number. Everything sent from a server has a number specified with it. Don't get this confused what mIRC outputs itself.

A list of servers, a /whois, a /names etc are all commands to the server which involkes a response. What raw events do in mIRC is take these responses from the server and reacts to them. Just like any other event would. It has a little different format, but the idea is just the same. But how do we find these special server response numbers? Because we know that mIRC doesn't naturally show them. You are right, it doesn't usually. You can script in a single line to show us, or you can get a guide like Jeepster's Raw Numeric Guide which can be found at Ircworks.com which shows them all in a neat, organized format.

Confused? Lets try an example to show you what I am talking about. Lets say your friend just popped up on your notify and you would like to do a whois on them to see proof they are who you think they are. We would type /whois (their nick). Once we send this command to the server, the server will response by issuing several lines of information about the nickname you specified; the whois info.



k0t is ~k0t@ppp224.man1.lsol.net * k0t b0t by Kintar0

k0t on #helpdesk @#clan-x-scripterz 

k0t using traced.de.eu.dal.net I think sex is better than logic!

k0t End of /WHOIS list.

Each of these four lines have a special number attached to it. If we look in the guide we will see that these particular lines have the numbers 311, 319, 312, 318 respectively. But you know, this output could use a little bit of styling. Lets make the first line red so it will stick out a little more on our screen and point out who really the person is.

To do this, we simply look up the first number (311) and we place it in the following raw format:



raw 311:*:{ echo 4 $1- | haltdef }

First we have the word raw, to show its a raw event, followed by the particular special server line number. After that, we have a colon then a wildcard symbol. The symbol here means match anything. We could put types of matchtext in their if we are looking for a particular word or letter combination in the response, but here we want it to match anything. Then we open a brace and inside we echo, in red, the first word (represented by $1) onwards ($1-, hyphen meaning everything after the first word).

To prevent the original copy being sent to you in addition to the echo, we use a haltdef. Which is short for "Halt Default Text", or in other words, halt what usually comes to us. You will see others use halt and some use haltdef, both are very similiar but when one halts the default text, the other halts it completely. You will have to decide which you would like to do. We then end the command block. Now, having put this event in your "remotes" section, we again do a whois on our friend k0t there.



k0t is ~k0t@ppp224.man1.lsol.net * k0t b0t by Kintar0

k0t on #helpdesk @#clan-x-scripterz 

k0t using traced.de.eu.dal.net I think sex is better than logic!

k0t End of /WHOIS list.

You should then see the first line is now red instead of the normal color. If you have your whois responses normally red, you can try echoing blue, green, or one of the other colors. Now you just made a raw event.

Raw events are used to modify output from the server (doesn't change what the server gives you), but just changes its appearance. Raw events can also be used to execute commands, open dialogs, or you can just halt it from ever appearing in the first place. Like if you want to get rid of that huge names listing that lists all the names when you enter the channel.

Types of Raw Events Usage

You can use raw events to change the way topics look, or who set the topic. You can change how server lists appear, names lists appear, or organize information from a /stats command as well as edit how the text looks when you first connect. There are many raw events and what you have to watch for is that not all IRC networks use all the same events. While one network may have a raw for a particular info on connection, it may not be on another network, or a different number.

Since raw events are specific to the server, you can not use the classic identifiers you do with other events. For instance, you can't use $nick because it isn't a person responding. You can't use $chan because the server is not a channel. The only way you can get the info the server sends is by using parameters.

The Parameters of Raw Events

For each line, $1 will represent your nickname. It procedes each raw event when you look at it. Then from their, you can use $2 to represent the second piece of info in that line, then $3 $4 and $5. You can use $2- meaning from the second piece onwards also. Let me show you an example of this also. We will take our whois again, but only the first line.



k0t is ~k0t@ppp224.man1.lsol.net * k0t b0t by Kintar0

In the line above, $1 would be me, Martyr2. $2 would be the word "k0t" and $3 would be the info ~k0t (the ident of the person). $4 would be the persons hostname (In this case ppp224.man1.lsol.net). Lastly, $3- would be "~k0t@ppp224.man1.lsol.net * k0t b0t by Kintar0". Understand? If not, go back again and feel free to reread it again. Raws takes a little practice and experimentation.

Conclusion

Raw events are events that mIRC has to respond to information sent back from the server. Either in response to a command or general information, such as logging on. Raw events have a specific format, which contains parameters and not the classic identifiers of other events. Parameters are represented by the classic dollar sign followed by a number. Each parameter represents a piece of the information sent back by the server. Lastly, the event is ended by either a haltdef, a halt, or nothing if you want it to repeat. Don't ask me why you would, but you could let it repeat.

Play with it, try a whois command edit, and see if you can change it. If you still need assistance, you can find me in my usual channel, #Clan-x-scripterz on DALnet IRC Network. Good luck and have fun!

.::(Martyr2)::. © 2002 BlacK-IcE