mIRC Home    About    Download    Register    News    Help

Print Thread
#184289 27/08/07 12:58 PM
Joined: Jun 2007
Posts: 35
Ameglian cow
OP Offline
Ameglian cow
Joined: Jun 2007
Posts: 35
Code:
; executes a random command from the colon-delimited %list
test {
  var %list = alias1 arg1 : alias2 arg2 : alias3 arg3
  var %toknum = $rand(1, $numtok(%list,58))
  $gettok(%list, %toknum, 58)
}
alias1 echo -a Alias 1: $1-
alias2 echo -a Alias 2: $1-
alias3 echo -a Alias 3: $1-

It's fine when $rand() returns 1:
Alias 1: arg1

But for 2 and 3, it repeats the command name as the first argument:
Alias 2: alias2 arg2
Alias 3: alias3 arg3

It seems to happen because the first character is a space.


Desired: right alignment of text; consecutive spaces in /command args; Ctrl+A in custom dialogs.
Joined: Jan 2003
Posts: 62
Babel fish
Offline
Babel fish
Joined: Jan 2003
Posts: 62
maybe this has to do with:

22.Fixed "// echo hello" being parsed as "//echo hello". The parser
now halts parsing of empty // commands.

Last edited by Attila; 27/08/07 04:40 PM.
Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
Yes, item 22 in versions.txt is the reason for this, so this is by design. There was a discussion on this issue in a bug reports thread some time ago and it was decided that this was the prudent behaviour.


Link Copied to Clipboard