mIRC Home    About    Download    Register    News    Help

Print Thread
#227613 16/11/10 03:33 AM
Joined: Dec 2002
Posts: 252
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
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,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
"%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: 252
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
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,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It's not a bug, %x = value doesn't work from the editbox, it's a limitation of the parser.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #227623 16/11/10 08:22 AM
Joined: Jan 2009
Posts: 116
Vogon poet
Offline
Vogon poet
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?


http://zowb.net

/server -m irc.p2p-network.net -j #zomgwtfbbq
(ssl on port 6697 and 7000)
argv0 #227634 16/11/10 08:03 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
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: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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