mIRC Scripting 

Infinity.ca.us.webchat.org Webmaster Inc.Service Hub

 More Command Parameters                                                                                             Lessons 7   
 

$1 only gives you the first parameter. (remember that parameters are extra words typed with the command- For example, in /blah abc 123, abc and 123 are parameters.)

Logically, to get further parameters, you would use $2, $3, etc. Here is a quick example-

/jointwo {
  /join $1
  /join $2
}

This may not be the most useful of examples, but it demonstrates multiple parameters. /jointwo #a #b will join both #a and #b. When the alias is run, $1 'becomes' #a, and $2 'becomes' #b.

You can also get a range of parameters at once. For example, $1-3 gets the first, second, and third parameters. (the parameters will be separated with spaces.) $2- gets the second and all further parameters. Here is an example that joins a channel then sends a message to it-

/jm {
  /join $1
  /msg $1 $2-
}

This is used in the form /jm #channel your message, and will join the channel then say something in it. Notice how $1 is used twice- once for the join target, and once for the message target, and then $2- is used to get the second parameter and all parameters after it, to allow multiple words in the message.

It's important that you understand this, so here is another example-

/tb {
  ; 60 second ban...
  /ban -u60 $1 $2

  ; ...then kick user from channel
  /kick $1 $2 $3-
}

This is a primitive 'tempban' alias- use /tb #channel nickname reason to ban someone for 60 seconds and kick them from the channel. As you can see, within the alias, $1 'becomes' the channel, $2 'becomes' the nickname, and $3- is used for all remaining parameters, which can be a reason containing any number of words.

 

   
      3|Table of Contents|4

 

All information shown on this site is regularly maintained and kept as up to date as possible. All other trademarks are property of their respective owners. Copyright © 2001, Infinity.ca.us.webchat.org Webmaster, Inc.Service Hub

Hosted by www.Geocities.ws

1