mIRC Scripting 

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

 SQUEEZING OUT SPACES                                                                                                   Lessons 12   
 

Remember that identifiers cannot have other words or symbols next to them and work properly. Let's say that you want to send an opnotice- a notice to all ops in a channel. On many networks (such as Undernet and DALnet) you can do this via /notice @#channel. Let's say you want to create /o as a shortcut to notice all ops on the current channel. Your first attempt might look like this-

/o {
  ; Send a notice to all ops [wrong]
  notice @$chan $1-
}

Unfortunately this will NOT work- because the @ is right next to $chan, $chan will not 'evaluate' properly, and the channel will not be inserted. Instead, you need spaces on either side of $chan. However, if you try-

/o {
  ; Send a notice to all ops [wrong]
  notice @ $chan $1-
}

This won't work either! You need the @ right next to the channel name for it to work, but this produces '@ #chan', not '@#chan'. You need a way to eliminate the space. The solution is to use a special identifier, $+, like so-

/o {
  ; Send a notice to all ops
  notice @ $+ $chan $1-
}

This will produce the desired result. The $+ 'squeezes' pieces together, eliminating spaces, so the $chan will become the current channel, then the @ and the channel name will become one word.

To recap, $+ eliminates spaces wherever it is placed. '@ $+ $chan' will first become '@ $+ #channel', then the spaces are killed, resulting in '@#channel'.

Learning the proper use of $+ will become more and more important later.

NOTE: Please note that $+ only eliminates the space(s) where it is found. Other spaces within that command are untouched.
      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