$*

From Scriptwiki
Jump to: navigation, search

$* is a hidden shortcut to "looping" tokenized ($N) data

$*
  • $* is very quirky, and should not be used in most cases. Instead, While loops should be employed.

Notes

When using $*, mIRC replaces it with "`~$*" and passes it to all identifiers used. Once it is done, and all identifers have returned, and the command is ready to be executed, mIRC loops and does the command $0 times replacing EVERY instance of "`~$*" with one of the tokens.

If you call $* inside the same alias the identifier does not reset its internal counter and continues from the Nth token it previously finsihed on. For more information see the third example below.

Examples

(Assume $1 = a, $2 = b, $3 = c)

; Echos "a" then "b" then "c"
echo -a $*
; Echos `. Remember, "`~$*" is ONLY replaced once it is back in the command. You cannot pass it to an identifier, or "`~$*" is used.
echo -a $left($*,1)
tokenize 32 1 2 3
say Easy as $*
tokenize 32 Ignore these tokens Do re mi
say Simple as $*

The above will first say:

Easy as 1
Easy as 2
Easy as 3

The script then tokenizes Ignore these tokens Do re mi, and you would except the next $* call to start with Ignore, however since we've previously called $* its internal memory is still pointing at the third token, the next call to $* will start from the forth token, not the first. The second say command says:

 Simple as Do
 Simple as re
 Simple as mi

See Also