mIRC Home    About    Download    Register    News    Help

Print Thread
#227613 16/11/10 03:33 AM
Joined: Dec 2002
Posts: 251
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 251
mIRC 7.15 clean...


take the example as an alias
alias wins { var %x = $scon(0) , %wins | while (%x) { scon %x | %wins = $+(%wins,$regsubex($str(.,$window(*,0)),/(.)/g,$+(%x,:,$window(*,\n),.))) | dec %x } | scon -r echo -a %wins }

do /wins

works great... now try it in an editbox

//var %x = $scon(0) , %wins | while (%x) { scon %x | %wins = $+(%wins,$regsubex($str(.,$window(*,0)),/(.)/g,$+(%x,:,$window(*,\n),.))) | dec %x } | scon -r echo -a %wins

nothing!

Last edited by Talon; 16/11/10 03:37 AM.
Talon #227614 16/11/10 03:54 AM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
"%var = value" syntax does not work from the editbox, use this instead:

//var %x = $scon(0) , %wins | while (%x) { scon %x | var %wins = $+(%wins,$regsubex($str(.,$window(*,0)),/(.)/g,$+(%x,:,$window(*,\n),.))) | dec %x } | scon -r echo -a %wins

Collective #227615 16/11/10 04:28 AM
Joined: Dec 2002
Posts: 251
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 251
ah so its a var bug, either way, its still a bug to me.

Talon #227618 16/11/10 05:55 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
It's not a bug, %x = value doesn't work from the editbox, it's a limitation of the parser.

argv0 #227623 16/11/10 08:22 AM
Joined: Jan 2009
Posts: 116
K
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2009
Posts: 116
I thought not prefixing a variable definition with var/set in general had some quirks and/or is not reccomended?

argv0 #227634 16/11/10 08:03 PM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Probably a side-effect of the fact that (by design, for security purposes) in the editbox you can't use an identifier/variable as a command.

Collective #227646 17/11/10 07:55 AM
Joined: Oct 2003
Posts: 214
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 214
nvm

Last edited by Sephiroth_; 17/11/10 07:56 AM.

one step closer to world domination
qwerty #227648 17/11/10 09:10 AM
Joined: Feb 2006
Posts: 523
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 523
sure seems like it!

apparently it's checking for nothing more than a literal '%' or '$' at the front of the command, so we can sneakily bypass it with:

Code:
//[ %var = value ]


or even

Code:
//#$(%var = value)


for identifiers


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde

Link Copied to Clipboard