mIRC Homepage
Posted By: ozyvent Please help ASAP - 17/10/03 03:45 PM
I need a script to kill anyone with a nick beginning with Guest.

I have a feeling it has to have something to do with while loops and /names (the raw numeric is 353 on this particular server)

If anyone can help pronto, that'd be great
Posted By: Knappen Re: Please help ASAP - 17/10/03 03:53 PM
ok... You can`t kill anyone if youre not an IRCop...

If you are u can use: if (Guest* iswm $nick) { kill $nick ... }
Posted By: ozyvent Re: Please help ASAP - 17/10/03 03:54 PM
So that will kill anyone and EVERYone with a nick beginning with Guest based on the output of /names simultaneously?
Posted By: Tsunami Re: Please help ASAP - 17/10/03 04:06 PM
so you want to do a /names on a channel, and then kill every nick that starts with Guest?
Posted By: ozyvent Re: Please help ASAP - 17/10/03 04:11 PM
What I want is to when i type e.g. /killguests it does /names (of the entire network) and kills anyone and everyone with a nick beginning with Guest.
Posted By: LocutusofBorg Re: Please help ASAP - 17/10/03 04:37 PM
Or you could just perm-ban Guest*!*@* and be done with it.
Posted By: ozyvent Re: Please help ASAP - 17/10/03 04:39 PM
Not helpful when Nickserv changes unidentified persons to Guest####
Posted By: Tsunami Re: Please help ASAP - 17/10/03 05:16 PM
well, this responds to the normal /names (I don't know if there's any difference between a global /names, or a /names on a channel):
Code:
alias killguests { SET %kg 0 | .NAMES $1 }
raw 353:*: {
  IF (%kg == 0) {
    WHILE (%kg != $gettok($4-,0,32)) {
      INC %kg
      VAR %nick = $remove($gettok($4-,%kg,32),+,%,@,!,&,*,~)
      IF (Guest* iswm %nick) { KILL %nick }
    }
  }
  UNSET %kg
}
Posted By: ozyvent Re: Please help ASAP - 17/10/03 05:27 PM
Ok, will see how I go, thanks smile
Posted By: _D3m0n_ Re: Please help ASAP - 17/10/03 07:06 PM
wouldnt increaseing the variable before u do anything miss the very first person in your while loop?

Code:
alias killguests { SET %kg 0 | .NAMES $1 }

raw 353:*: {
  IF (%kg == 0) {
    WHILE (%kg != $gettok($4-,0,32)) {
      VAR %nick = $remove($gettok($4-,%kg,32),+,%,@,!,&,*,~)
      IF (Guest* iswm %nick) { KILL %nick }
      INC %kg
    }
  } 
 UNSET %kg
}


that would be the way id change yours to make it work alil more in order. its not the method id use exactly but thats no big deal either
Posted By: Collective Re: Please help ASAP - 17/10/03 07:17 PM
No, since the variable is set at 0 to start with, not 1.
Posted By: _D3m0n_ Re: Please help ASAP - 17/10/03 08:38 PM
ok i didnt look closely enough to read that. btw is there any particular reason to adding the variable at zero instead of actually starting at 1? i would think it would speed up the code alil quicker.
Posted By: ozyvent Re: Please help ASAP - 18/10/03 02:48 AM
Didn't work, any other suggestions. Had a suggestion from someone else to force change everyone who's using a Guest* nick to the same nick, and thus causing a nick collision and automatic kill. How would/could that work? the command is /operserv user nickname nick newnickname
Posted By: cold Re: Please help ASAP - 18/10/03 03:44 AM
Quote:
i would think it would speed up the code alil quicker

With such small differences, starting with 0 has proven to have the same speed as starting with 1 when benchmarked here. I think it's understandable in this case, since both methods are only different in their order (with 0 you /inc first and use </similar, with 1 you /inc last and use <=/similar), but always execute the same number of calls..

When I benchmarked a lot of loop "styles" involving various situations some time ago, using $0 as the max value for example (actually, whatever the max value was like), the faster one was var %i = $0, (%i), { command | dec %i }.

Edit: In cases that %i's value should be shown increasing itself, either var %i = 0, (%i < $0), { inc %i | command } or var %i = 1, (%i <= $0), { command | inc %i } were the faster ones (when $0 was other more complex identifier, it was faster if set as a variable to use in the condition, or, in some cases, using ($identifier(%i)) as the condition).

Anyone who benchmarked many loop styles too so we can see the results? Unfortunately I don't have my related notes anymore..

(Sorry it's off-topic :tongue:)
© mIRC Discussion Forums