mIRC Home    About    Download    Register    News    Help

Print Thread
Script causing loop #115094 22/03/05 02:29 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on *:text:!update:#:{ 
  .notice $nick checking for ops in the room and adding them to the user list 
  var %b = 1 
  while $nick(#,0,o) >= %b {
    //echo # %b $nick(#,%b,o)
    .auser 10 $nick(#,%b,o)
    inc %b
  } 
  .notice $nick checking for ops in the userlist that are not in the room and removing them from the list 
  var %b = 1 
  while $ulist(*,10,0) >= %b {
    if ($ulist(*,10,%b) !ison #) {
      //echo # %b $nick(#,%b,o)
      .ruser $v1
      inc %b
    }
  }
  .notice $nick voicing those in the room that qualify but aren't voiced 
  var %b = $nick(#,0,a,v) 
  while %b > 0 {
    if $regex(uc,$nick(#,%b,a,v),/^[^[:alpha:]]*?[A-Z]/) {
      //echo # %b $nick(#,%b,a,v)
      mode # +v $nick(#,%b,a,v)
    }
    dec %b
  } 
  .notice $nick checking for people that are in the players list but not in the room and removing them 
  var %b = 1
  while $numtok(%play.list,44) >= %c {
    if ($gettok(%play.list,%b,44) !ison #) {
      set %play.list $remtok(%play.list,$v1,1,44)
      inc %b
    }
  } 
  .notice $nick checking for autoplay of all in the room and if on adding them to the players list 
  var %b = $nick(#,0)
  while %b > 0 {
    if ($read($mknickfn($nick(#,%c)),s,autoplay) == on) {
      set %play.list $addtok(%play.list,$nick(#,%b),44)
    }
    dec %b
  } 
  .notice $nick Update complete
  if %play.list describe # Current Players are %play.list
}
 


The above script was working fine...but recently has started making an unending loop...
The loop appears to be coming in during the, for lack of a better phrase, second section

Re: Script causing loop #115095 22/03/05 02:54 AM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Two sections of your script can cause infinite loops.

Code:
    if ($ulist(*,10,%b) !ison #) {
      //echo # %b $nick(#,%b,o)
      .ruser $v1
      inc %b
    }


You should inc %b outside of the if statement.

Code:
    if ($gettok(%play.list,%b,44) !ison #) {
      set %play.list $remtok(%play.list,$v1,1,44)
      inc %b
    }


Same for this.


New username: hixxy
Re: Script causing loop #115096 22/03/05 02:55 AM
Joined: Dec 2002
Posts: 145
G
gemeau50 Offline
Vogon poet
Offline
Vogon poet
G
Joined: Dec 2002
Posts: 145
.notice $nick checking for people that are in the players list but not in the room and removing them
var %b = 1
while $numtok(%play.list,44) >= %c {
if ($gettok(%play.list,%b,44) !ison #) {
set %play.list $remtok(%play.list,$v1,1,44)
inc %b
}
}

Re: Script causing loop #115097 22/03/05 02:59 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
That was the problem...thanks