mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
The variable is %bnick*

I have %bnickword %bnickword2 etc.

Code:
  var %i = 1
  while (%i < $var(%bnick*,0)) {
    inc %i
    if ($identifier == $var(%bnick*,%i).value) {
      if statement { 
          do stuff | /unset $var(%bnick*,%i)
        }
      }
      /unset $var(%bnick*,%i)
    }
  }


I just added all the /unset $var(%bnick*,%i) as I can, but I believe only 1 is enough..

After checking for the value of te %variable, I then want to /unset after the end of the while loop. Also unsetted it after using it. But no, the variable still exists..

I didn't /unset the $var().value of the variable because I want the variable completely gone.

Thanks.

-Neal.

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
No need for a loop when you can just do /unset %bnick*
If you want to use the loop, don't inc %i, just keep unsetting $var(%bnick*,1) and it will keep unsetting the first matching variable until no more are found.

Code:
alias vartest {
  var -s %i = 1
  while (%i < 10) {
    set -s $+(%,test.,%i) $true
    inc %i
  }
  while ($var(%test.*,1)) unset -s $v1
}

Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Well, that script was an unban event.

Everytime a person gets banned, a variable starts as

%bnickNick $banmask

The $identifier was $banmask. It while loops $var(%bnick*,0) until the variable finds the matching bansmask.

Then, once the ban is removed..

I want to unset the variable %bnicknick but it still stays..

I've tried this now..

Modified script for paste.

Code:
  var %i = 1
  while (%i < $var(%bnick*,0)) {
    inc %i
    if ($banmask == $var(%bnick*,%i).value) {
      if ($remove($var(%bnick*,%i),$chr(37),bnick) !ison $chan) { 
        if ($comchan($remove($var(%bnick*,%i),$chr(37),bnick),1)) { 
           /msg blah blah [Script] $remove($var(%bnick*,%i),$chr(37),bnick) you have been unbanned in $chan ( $+ $nick sets mode: -b $banmask $+ ) | /unset $var(%bnick*,%i)
        }
        if (!$comchan($remove($var(%bnick*,%i),$chr(37),bnick),1),44) {
          /notice $remove($var(%bnick*,%i),$chr(37),bnick) [Script] You have been unbanned in $chan ( $+ $nick sets mode: -b $banmask $+ ) | /unset $var(%bnick*,%i)
        }
        /unset $var(%bnick*,%i)
      }
      /unset $var(%bnick*,%i)
    }
    /unset $var(%bnick*,%i)
  }


Hopefully the %bnickNick variables will be unset...

I don't want to /unset $var(%bnick*,0) but I did when it reached over 600.

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
try this, one possible fix:

Code:
 unset $var(%bnick*,$(%i))



"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
O thanka jaytea <3 baby.

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Why don't you paste the entire event or alias of which this is a part of?


Link Copied to Clipboard