mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
hi im tryin to do a loop where itll check all instances of

%thinga $+ %x are checked for $nick - else inc %x and redo it

then the same for %thingb

i was thinkin of doing something like this

var %z = 1
while (($(%thinga $+ %x),2) && $nick isin ( $(%thinga $+ %x),2)) { actions to do if found | inc %x }
else { inc %x}

but what i found was it wuz really gonna b an endless loop kinda thing

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Code:
var %x = 0, %xx = [color:red]10[/color]
while (%x < %xx) {
  inc %x
  if ($nick isin $+(%thinga,%x)) {
    ;do something here 
  }
  else {
    ;do something else here
  }
}


The number of times you want this to happen

-genius_at_work

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
you guys mean $($+(%,thinga,%x),2) laugh

btw just in case %thinga* vars arent always sequential like you may not necessarily have 1,2,3 in case some are unset before others, you should loop with $var

Code:
var %z = 1
while ($var(thinga*,%z)) {
 if ($nick isin $($v1,2)) { ... }
 inc %z
}


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
prob with that script is, %xx can change, like there might only b 2 %thinga's (so %thinga1 and %thinga2) or there might be 25...so i dont really think i can set the %xx value to a number

would something like this work

var %xx
while $(%thinga $+ %xx,2) { inc %xx }

thensortof move to the new loop by the other while so

var %x 1
while ($(%thinga $+ %x,2) && (%x <= %xx ) { if ($nick isin $(%thinga $+ %x,2)) { commands here | inc %x }
else { inc %x }

:S or osmething like that lol

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
did you try mine? smile


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
while $(%thinga $+ %xx,2) { inc %xx }

Ignoring everything else your construction of this is faulty

currently your trying to join the contents of %thinga with the contents of %xx, you then evaluate that twice (normally does nothing more than evaluates it once, since %thinga is normally $null)

what your wanting to do is creat a variable called %thinga%xx the italic section being the contents of %xx

while $($+(%,thinga,%xx),2) { inc %xx }

you must seperate the % from thinga to stop it being evaluated to its contents


PS: on quick observation JayTea's script seems a simple and cleaner method to go.

Joined: Dec 2003
Posts: 7
V
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
V
Joined: Dec 2003
Posts: 7
hmmm......

a simple while loop is like this

var %thinga = 1
while (%thinga <= 10) {
echo %thinga
inc %thinga
}

depending on if the variable will inc (increase) or dec (decrease) it really depends on what your trying to do.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Hes trying to loop through dynamicly named variables %thinganumber checking if $nick is in the variable contents, so setting %thinga to anything isnt what hes after.


Link Copied to Clipboard