Jump to content

Just A Random Tutorial


Guest X-Fusion

Recommended Posts

Guest X-Fusion

A Random Tutorial

Written by X-Fusion for Techgear007

 

Well, this is just a random tutorial, and has no real meaning to it. I dunno what to call it, but, here it is. The first will show the code in its entirety with no explanations. The second code will explain what each line does.

alias s.c {
  var %i = 1
  while (%i <= $nick(#,0)) {
    if ($nick(#,0) != $me) {
      me Slaps $nick(#,%i)
    }
    inc %i
  }
}

Now, onto the line by line breakdown ..

alias s.c {

This names your alias. You can name this whatever you like. It doesnt have to have relevance at all. I just named it s.c because its an easier keyboard shortcut, and you dont have to remember much while doing it. Also, remember that renaming pre-exisitng aliases (such as $findtok, $regml, $address etc) will cause conflict in mIRC and will not work properly. To fix this error, call on a local alias. To do so, just add a -l infront of it.

alias -l s.c {

The { identifier tells mIRC that its going to be a multi-actioned alias. This, in short terms, means its preforming more then one of mIRC's internal functions.

  var %i = 1

This line sets a VARIABLE called %i. In this case, this variable will recognize that %i shows how many people are in the channel (which will be explained in the next line.) There are two ways to set a variable. Using set %var info. And, var %var info. These differ greatly, but offer the same purpose. The set %var means that this variable is permanent until you either clean your variables, or delete the mIRC.ini. This is called a PERMANENT variable. The var %var is called a LOCAL variable. These variables only last for the duration of the mIRC.exe operation. So, when you exit mIRC, these variables unset themselves. So, I set this as a local variable because we dont want it permanent. I set it as one because there is always going to be atleast one person in the channel. You!

  while (%i <= $nick(#,0)) {

This is where things can get a little tricky if you dont pay attention. This line is called a WHILE line. What while does is repeats a certain identifier aslong as its active. What do I mean? What I mean is if there are 4 people in the channel, the while loop will pick up this info using the information provided (%i <= $nick(#,0) and use it untill it runs out. So, this will slap all 4 people and stop itsself. Gotos use this as well, but, I personally like using while, as it takes less code and is more efficient. The %i shows up again, but, it was explained up there. This increases value by one each time the while passes through. So, next time, the value of %i will be two, then three, and so forth. The <= means 'smaller than or equal to.' So, this means that aslong as the value is lower then the room count, it will keep going to the next name. $nick(#,0) returns how many people are in the chatroom. So, like I said, four are, so, it returns four and keeps the while loop going.

    if ($nick(#,0) != $me) {

This line will tell mIRC that if the nickname is mine, skip it and go to the next one. If can also be a pretty tricky identifier, but, I'll try to explain it. The IF statement allows you to compare values and execute different parts of a script based on the comparison. So, like I said up there, it shows that if the nickname it comes to is me, skip me and slap the other people. $nick(#,0) has already been explained. The != identifer tells mIRC that its not equal to me, so, continue doing the slapping and continue the script functions. This does not bring the script to stop all executions, it just tells it to skip ahead to the next name. The $me identifier I think is pretty self explanitory. This shows that if the nickname equals me, skip it.

      me Slaps $nick(#,%i)

This uses an action called /ME. This tells the channel (or query) what you are doing in that little purple text. This is called ACTION text. Anything after /me will be said in the active channel window. You can break this up by using the | identifier. This will halt anything after |. $nick(#,%i) shows the user its slapping. The %i again recognizes a name off of the nicklist in the nth order. The N identifiers means number. So, if the first nickname was Ozzy10, the second was err0r, the third X-Fusion and the fourth IRCx, mIRC would recognize it like this. $nick(#,1) = Ozzy10, $nick(#,2) = err0r, $nick(#,3) = X-Fusion, $nick(#,4) = IRCx. I hope that clears up any questions (if you still have any) about what $nick(#,0) does.

    inc %i

This simply increases the value of the variable %i to the next highest. It goes in chronological order. So, it doesnt jump from one to four. It counts really. It goes one, two, three, four.

 

I hope this helped someone somewhere if you had any wonders on how to do anything. Remember, this tutorial is VERY basic. This tutorial was made by X-Fusion on Friday, October 6th 2006. Any reproduction of this text without proper author consent should not happen. If it does, this tutorial will be taken down. Thanks for reading and happy scripting :) .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...