mIRC Home    About    Download    Register    News    Help

Print Thread
#222410 19/06/10 10:21 AM
Joined: Sep 2009
Posts: 52
Z
ziv Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Sep 2009
Posts: 52
Yeah, I KNOW I'm not doing it right, I just can't find what's wrong -_- might be the hour, nothing promised! XD

Code:
on 1:input:*:{
  if $left($1,1) == / && $findtok($1-,while,0,32) > 0 {
    var %i = 1
    while %i <= $findtok($1-,while,0,32) {
      var %n = $findtok($1-,while,%i,32)
      tokenize 32 $instok($1-,$eval($read($mircdir\mSS\Config,5) == 1 &&,0),$calc(%n + 1),32)
      inc %i
    }
    echo -a $1-
    $1-
    haltdef
  }
}


Edit: Btw, I added the echo line just to check it...
The goal is to add that condition to any while loop entered via command line.

Depending on what I change, I get one of these:
1) VAR Unknown command
(Used a var command as the first one)
2) Nothing happens(except for the echo)

Edit#2: Chanegd the $eval thing to a simpler $!, forgot about that...still doesn't work, obviously...

Thanks in advance,
ziv.

Last edited by ziv; 19/06/10 10:38 AM.
ziv #222412 19/06/10 10:50 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
an interesting and novel idea! just a few things to consider though if you wish to pursue this method:

- /while (as well as /if) are special constructs, they can't be run as commands using '$1-' as you've done on line 10. you can set them up to be run as such using:

Code:
scon -r $1-


- while (A) && (B) || (C) is interpreted as while ((A) && (B)) || (C). if a user were to use while (a == a) || (b == b), the result of the condition you're adding is rendered useless

- $reptok() can replace all matching tokens in a string with an N parameter of 0. you can shorten your while loop to:

Code:
tokenize 32 $reptok($1-,while,while ($read($mircdir\mSS\Config,5) == 1) &&,0,32)


- be careful of //while (condition) command! $1 = '//while' and not 'while'


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #222413 19/06/10 11:08 AM
Joined: Sep 2009
Posts: 52
Z
ziv Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Sep 2009
Posts: 52
Good points.

Maybe something to grab everything from the 'while' to the '{' and check for '||'s ?
Though that would be a bit more annoying smirk

I'll try the scon -r, but I leave it out when I enter code myself normally...I guess it's needed when triggered by a script?

Edit: Pffft, I somehow managed to get it to loop infinitely, and then found out at least my added condition worked xD saved myself from a mIRC crash xD
That said, the condition I inputted was obviously ignored.
I played some with it, no success.
now I'm stuck with it only performing the loop once...

Thanks,
ziv.

Last edited by ziv; 19/06/10 11:20 AM.
ziv #222447 19/06/10 09:07 PM
Joined: Sep 2009
Posts: 52
Z
ziv Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Sep 2009
Posts: 52
Couldn't edit my older post...but I suppose this is better anyways.

Here is an up-to-date code I'm using for this...

http://ziv.pastebin.com/Z3iVDUmt

Right now, the $regml isn't returning the .pos smirk
I know this code ain't the best way around, but by all means it should work smirk

Any help with this would be appreciated,
ziv.


Link Copied to Clipboard