mIRC Homepage
Posted By: TheWarlock script help - 09/12/08 04:53 PM
alias lista {
set %i 1
set %x 1
:da
set %li $nick(#,%x,o)
set %lista $addtok(%li,%lista,32)
inc %i
inc %x
//echo -a %lista
if %i > 5 { halt }
if %x > 5 { halt }
goto da
}
}


Ciudad veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS 5
icaro Ciudad veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS veracruzanito NiCK HeChIcErA EL-MESIAS 5

why,repeat many times, any help to fix it

thnx
Posted By: Typos Re: script help - 09/12/08 06:47 PM
Yours is repeating because you have the echo line inside the goto loop.

The best way to do this would be to use a while loop instead. I have re-written it for you and will attempt to explain the code as well.
Here is the new code.
Code:
alias lista {
  var -s %lnn $nick(#,0,o), %lnp 1
  while (%lnp !> %lnn) {
    var %listops $addtok(%listops,$nick(#,%lnp,o),32)
    inc %lnp
  }
  $iif(%listops,echo -a $v1)
}

And now I will break it down for you.
Code:
alias lista {
  ;Set %lnn as the amount of ops in the room and %lnp as 1
  var -s %lnn $nick(#,0,o), %lnp 1
  ;Start the while loop, it will stop when %lnp is greater than %lnn
  while (%lnp !> %lnn) {
    ;Add the first/next op's name into the %listops token
    var %listops $addtok(%listops,$nick(#,%lnp,o),32)
    ;increase the %lnp variable by one
    inc %lnp
  }
  ;The loop is done now and this next line checks if the %listops token has any names in it and if it does it echos the names.
  $iif(%listops,echo -a $v1)
}


Good luck.
Posted By: Wims Re: script help - 09/12/08 07:26 PM
!> isn't a valid operator, should be <=, and the '=' sign for /var should be used with %listops.
Posted By: Typos Re: script help - 09/12/08 08:12 PM
Quote:
!> isn't a valid operator

If thats true than all my mircs are broken because it works for me, even in $iif tests that I just performed with echo to verify.
Quote:
the '=' sign for /var should be used with %listops.
I thought this was a matter of preference.
My code tested fine so I'm not sure if an edit to add the = or change !> (is not greater) to <= (is less than or equal to) is needed.

Is there any good reason to make these changes? Perhaps they won't work on older mircs and I am unaware of this?

Just wondering.
Posted By: Wims Re: script help - 09/12/08 08:36 PM
I've just try it myself, and indeed it work, but it shouldn't.
Several report have been made about problem with operator and in the version.txt of mirc 6.3 :
Quote:
39.Fixed /if parser not reporting invalid operator for => and =<, and added not support for !> !<= etc.
So !> !>= !< and !<= should report an error. It looks like it has been already fixed but it's not the case.

The = sign, in real, is only needed for older version of mirc (6.21 and prior, i think) but should always be used because it's the right syntax.On an older version, the line with var %listops would display an error.
Posted By: argv0 Re: script help - 09/12/08 08:43 PM
the If operators have been fixed, the user is likely on a version prior to this update.
Posted By: Wims Re: script help - 09/12/08 08:54 PM
I don't try it myself since i can't now, it's someone who has tested to use !< on a mirc 6.35, and no error was displayed.
Posted By: argv0 Re: script help - 09/12/08 09:28 PM
You have it backwards-- !< has been *added*.. it's => and =< that have been removed.
Posted By: Wims Re: script help - 09/12/08 09:51 PM
Indeed, I've misunderstood this statement (I'm french), I'm sorry about that.
The question is why these operator are not in the help file, it would avoid a lot of confusion, at least for me smile
Posted By: TheWarlock Re: script help - 09/12/08 11:34 PM
thnx x fast responding
© mIRC Discussion Forums