|
Joined: Nov 2007
Posts: 117
Vogon poet
|
OP
Vogon poet
Joined: Nov 2007
Posts: 117 |
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
|
|
|
|
Joined: Jun 2008
Posts: 48
Ameglian cow
|
Ameglian cow
Joined: Jun 2008
Posts: 48 |
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. 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. 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.
I've gone to look for myself. If I should return before I get back, please keep me here.
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
!> isn't a valid operator, should be <=, and the '=' sign for /var should be used with %listops.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Jun 2008
Posts: 48
Ameglian cow
|
Ameglian cow
Joined: Jun 2008
Posts: 48 |
!> 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. 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.
I've gone to look for myself. If I should return before I get back, please keep me here.
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
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 : 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.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
the If operators have been fixed, the user is likely on a version prior to this update.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
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.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
You have it backwards-- !< has been *added*.. it's => and =< that have been removed.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Jul 2006
Posts: 4,222
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,222 |
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 
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Nov 2007
Posts: 117
Vogon poet
|
OP
Vogon poet
Joined: Nov 2007
Posts: 117 |
|
|
|
|
|