mIRC Home    About    Download    Register    News    Help

Print Thread
#207195 09/12/08 04:53 PM
Joined: Nov 2007
Posts: 117
T
Vogon poet
OP Offline
Vogon poet
T
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

TheWarlock #207200 09/12/08 06:47 PM
Joined: Jun 2008
Posts: 48
T
Ameglian cow
Offline
Ameglian cow
T
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.
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.


I've gone to look for myself. If I should return before I get back, please keep me here.
Typos #207204 09/12/08 07:26 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
!> 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
Wims #207206 09/12/08 08:12 PM
Joined: Jun 2008
Posts: 48
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Jun 2008
Posts: 48
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.


I've gone to look for myself. If I should return before I get back, please keep me here.
Typos #207207 09/12/08 08:36 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #207208 09/12/08 08:43 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
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"
argv0 #207209 09/12/08 08:54 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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
Wims #207210 09/12/08 09:28 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
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"
argv0 #207211 09/12/08 09:51 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Typos #207217 09/12/08 11:34 PM
Joined: Nov 2007
Posts: 117
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
thnx x fast responding


Link Copied to Clipboard