mIRC Homepage
Posted By: RusselB looking for a better way to script this - 15/04/05 03:32 AM
Code:
 on *:NICK:{
  %r = $iif($regex($newnick,/^[^[:alpha:]]*?[A-Z]/),+v,-v) 
  if ($me isop $v1) mode %td.chan %r $newnick 
  if $istok(%play.list,$nick,44) {    set %play.list $reptok(%play.list,$nick,$newnick,1,44)  }
  if $istok(%watch,$nick,44) { set %watch $reptok(%watch,$nick,$newnick,44) }
  var %away.1 = afk,bbs,brb,bbl,ing,bbiab,away
  while (%away.1) && ($istok(%play.list,$newnick,44)) {
    var %away.2 $gettok(%away.1,1,44)
    if ($left($newnick,$len(%away.2)) == %away.2) || ($right($newnick,$len(%away.2)) == %away.2) {
      set %play.list $remtok(%play.list,$newnick,1,44)
      set %nick.away $addtok(%nick.away,$newnick,32)
      if $istok(%cheaters,$nick,44) {        set %cheaters $remtok(%cheaters,$nick,1,44)      }
      if ($nick == %spin.last) { unset %spin.last }
      if ($nick == %spin.nick) { unset %spin.nick }
    }
    set %away.1 $remtok(%away.1,%away.2,1,44)
  }
  if $istok(%nick.away,$nick,32) {
    set %nick.away $remtok(%nick.away,$nick,1,32)
    if $hget(TD,$+(Autoplay,$address)) {
      set %play.list $addtok(%play.list,$nick,44)
      describe # 5 smiles as $nick is added using the autoplay option
      describe # 5 :Current Players Are %play.list
    }
  }
} 
Posted By: DaveC Re: looking for a better way to script this - 15/04/05 08:08 AM
Code:
on *:NICK:{
  %r = $iif($regex($newnick,/^[^[:alpha:]]*?[A-Z]/),+v,-v) 
  if ($me isop [color:blue]$v1[/color]) mode %td.chan %r $newnick
  [color:blue]^ Is that ment to be $v1 I would think its ment to be %td.chan[/color] 
  set %play.list $reptok(%play.list,$nick,$newnick,1,44)
  [color:blue]^ Just do it reptok well only replace it if its in there same for others below[/color] 
  set %watch $reptok(%watch,$nick,$newnick,44)
  var %away.1 = afk,bbs,brb,bbl,ing,bbiab,away
  while (%away.1) && ($istok(%play.list,$newnick,44)) {
    var %away.2 $gettok(%away.1,1,44)
    if ($+(%away.2,*) iswm $newnick) || ($+(*,%away.2) iswm $newnick) {
    [color:blue]^ Easier to read I dont know if either is faster not that it matters nick change isnt i high volume event[/color] 
      set %play.list $remtok(%play.list,$newnick,1,44)
      set %nick.away $addtok(%nick.away,$newnick,32)
      set %cheaters $remtok(%cheaters,$nick,1,44)
      if ($nick == %spin.last) { unset %spin.last }
      if ($nick == %spin.nick) { unset %spin.nick }
    }
    else { set %away.1 $gettok(%away.1,2-,44) }
  }
  if $istok(%nick.away,$nick,32) {
    set %nick.away $remtok(%nick.away,$nick,1,32)
  }
  if $hget(TD,$+(Autoplay,$address)) [color:red]&& $istok(%play.list,[color:orange]$nick[/color],44)[/color] {
                                      [color:red]^ Dont want to add user and display message if there already in[/color] 
  [color:blue]^ This was a sub part of the above IF but im not sure if it was ment to be, you correct as needed[/color]
    set %play.list $addtok(%play.list,[color:orange]$nick[/color],44)
    describe # 5 smiles as [color:orange]$nick[/color] is added using the autoplay option
    [color:blue]^ In above 3 lines shouldnt it be $newnick? and not [color:orange]$nick[/color][/color]
    describe # 5 :Current Players Are %play.list
    [color:blue]^ Also I assume the autoplay option is not available to nicks that matched the away constructs[/color] 
  }
}


On the whole i thought the code was well layed out and seems to cover most things (that i can see).
I liked the while (%away.1) && ($istok(%play.list,$newnick,44)) { loop but exit on different conditions construct, well envisioned.
Posted By: RusselB Re: looking for a better way to script this - 15/04/05 07:29 PM
Thanks Dave...your notes and corrections are correct...I appreciate the changes and the compliment regarding the script.
Posted By: Hammer Re: looking for a better way to script this - 18/04/05 10:56 AM
One further note: there is no # (to /describe to) associated with on NICK; you would either have to specify %td.chan or loop through $comchan($newnick,%i) to give /describe a target.
© mIRC Discussion Forums