Typos Auto Status

By Typo on Jun 23, 2008

Typo's Auto-Status is a handy script that allows you to select what access you want to automatically give every user in a channel or channels. You can select from Voice(+), HalfOP(%), AOP(@), SOP(&) or even any combination. The script is easy to configure. Channels can be added either thru the right click menu in channel or the control panel dialog which u can access from any right click menu.

On top of giving the chosen access(es) every time a user joins the channel the script will also give anyone the access you chose if they dont already have it when you initially add the channel and after that whenever you join the channel it will check for anyone missing that access and give it.

ALWAYS BEWARE THAT AUTO OPPING LEADS TO ABUSE ALMOST EVERY TIME! USE AT YOUR OWN RISK!

I made this script after I was requested to do so and figured I would share.

Enjoy

Typo

on *:join:#:{
  if ($nick == $me) {
    if ($istok(%AVoice.Chan,$chan,32) == $true) .timer 1 3 onjoinvoicer $chan 
    if ($istok(%AHOP.Chan,$chan,32) == $true) .timer 1 3 onjoinhalfopper $chan
    if ($istok(%AAOP.Chan,$chan,32) == $true) .timer 1 3 onjoinopper $chan
    if ($istok(%ASOP.Chan,$chan,32) == $true) .timer 1 3 onjoinsopper $chan
  }
  else {
    if ($istok(%AVoice.Chan,$chan,32) == $true) pvoice 5 $chan $nick
    if ($istok(%AHOP.Chan,$chan,32) == $true) phop 5 $chan $nick
    if ($istok(%AAOP.Chan,$chan,32) == $true) pop 5 $chan $nick
    if ($istok(%ASOP.Chan,$chan,32) == $true) psop 5 $chan $nick
  }
}
alias onjoinvoicer {
  var %usercountvoice = $nick($1,0)
  while (%usercountvoice !<= 0) { 
    if ($nick($1,%usercountvoice) != $null) && ($nick($1,%usercountvoice) != $me) { 
      pvoice 5 $1 $nick($1,%usercountvoice)
    } 
    dec %usercountvoice 
  } 
}
alias onjoinhalfopper {
  var %usercounthop = $nick($1,0)
  while (%usercounthop !< 1) { 
    if ($nick($1,%usercounthop) != $null) && ($nick($1,%usercounthop) != $me) { 
      phop 5 $1 $nick($1,%usercounthop) 
    }
    dec %usercounthop 
  } 
}
alias onjoinopper {
  var %usercountaop = $nick($1,0)
  while (%usercountaop !< 1) {
    if ($nick($1,%usercountaop) != $null) && ($nick($1,%usercountaop) != $me) { 
      pop 5 $1 $nick($1,%usercountaop) 
    } 
    dec %usercountaop 
  } 
}
alias onjoinsopper {
  var %usercountsop = $nick($1,0)
  while (%usercountsop !< 1) { 
    if ($nick($1,%usercountsop) != $null) && ($nick($1,%usercountsop) != $me) {
      psop 5 $1 $nick($1,%usercountsop) 
    } 
    dec %usercountsop 
  } 
}
alias phop { .timer 1 $1 if ( $3 ison $2) && ( $3 !ishop $2) { mode $2 +h $3 } }
alias psop { .timer 1 $1 if ( $3 ison $2) && ( $chr(37) !isin $nick( $2,$3).pnick ) { mode $2 +a $3 } }
menu channel {
  -
  <[Typo's AutoStatus]>
  .Open the AutoStatus Control Panel.:/dialog -ma ASChanlist ASChanlist
  .-
  .$iif($istok(%AVoice.Chan,$chan,32) == $true,$style(2)) Add Auto-Voice (+) to $chan:AddAutoStatus $chan Voice
  .$iif($istok(%AVoice.Chan,$chan,32) != $true,$style(2)) Remove Auto-Voice (+) to $chan:RemoveAutoStatus $chan Voice
  .$iif($istok(%AHOP.Chan,$chan,32) == $true,$style(2)) Add Auto-HOP (%) to $chan:AddAutoStatus $chan HOP
  .$iif($istok(%AHOP.Chan,$chan,32) != $true,$style(2)) Remove Auto-HOP (%) to $chan:RemoveAutoStatus $chan HOP
  .$iif($istok(%AAOP.Chan,$chan,32) == $true,$style(2)) Add Auto-AOP (@) to $chan:AddAutoStatus $chan AOP
  .$iif($istok(%AAOP.Chan,$chan,32) != $true,$style(2)) Remove Auto-AOP (@) to $chan:RemoveAutoStatus $chan AOP
  .$iif($istok(%ASOP.Chan,$chan,32) == $true,$style(2)) Add Auto-SOP (&&) to $chan:AddAutoStatus $chan SOP
  .$iif($istok(%ASOP.Chan,$chan,32) != $true,$style(2)) Remove Auto-SOP (&&) to $chan:RemoveAutoStatus $chan SOP
  -
}
menu query,status,nicklist {
  -
  <[Typo's AutoStatus]>
  .Open the AutoStatus Control Panel:/dialog -ma ASChanlist ASChanlist
  -
}
alias AddAutoStatus {
  if ($istok([ %A [ $+ [ $2 ] $+ .Chan ] ],$1,32) == $true) { echo -a That channel is already in the Auto $2 list | goto end }
  set [ %A [ $+ [ $2 ] $+ .Chan ] ] $addtok([ %A [ $+ [ $2 ] $+ .Chan ] ],$1,32)
  if ($2 == Voice) { onjoinvoicer $1 }
  if ($2 == HOP) { onjoinhalfopper $1 }
  if ($2 == AOP) { onjoinopper $1 }
  if ($2 == SOP) { onjoinsopper $1 }
  echo -a $1 has been added to the Auto- $+ $2 list!
  msg $1 This channel is now in my Auto- $+ $2 list!
  :end
}
alias RemoveAutoStatus {
  if ($istok([ %A [ $+ [ $2 ] $+ .Chan ] ],$1,32) == $false) { echo -a That channel is not in the Auto $2 list | goto end }
  set %A $+ $2 $+ .Chan $remtok([ %A [ $+ [ $2 ] $+ .Chan ] ],$1,32)
  echo -a $1 has been removed from the Auto- $+ $2 list!
  :end
}
on *:dialog:ASChanList:init:0:listautostatuses
dialog ASChanList {
  title "                    Auto-Status Channel List"
  size -1 -1 148 171
  option dbu
  button "Done", 1, 57 157 34 12, ok cancel
  list 2, 16 91 116 64, sort size vsbar
  edit "", 3, 16 42 67 13
  button "Add", 4, 35 32 25 10
  button "Remove", 5, 35 80 25 10
  text "Enter the channel to be added in the box below, select ONE status and click -Add-  To give a channel two statuses simply add it twice.", 6, 3 2 93 29, center
  text "To remove a channel just hilight it in the list below and click the -Remove- button.", 7, 8 57 83 22, center
  check "Voice (+)", 8, 102 10 35 10
  check "HOP (%)", 9, 102 27 35 10
  check "AOP (@)", 10, 102 44 35 10
  check "SOP (&&)", 11, 102 61 35 10
}
on *:dialog:ASChanList:sclick:8:{ did -u ASChanList 9-11 }
on *:dialog:ASChanList:sclick:9:{ did -u ASChanList 8,10-11 }
on *:dialog:ASChanList:sclick:10:{ did -u ASChanList 8-9,11 }
on *:dialog:ASChanList:sclick:11:{ did -u ASChanList 8-10 }
on *:dialog:ASChanList:sclick:4:{
  if ($left($did(3),1) != $chr(35)) { echo -a Please be sure that you put the pound sign (#) in front of the channel name and then try again. | goto end }
  if ($did(8).state == 0) && ($did(9).state == 0) && ($did(10).state == 0) && ($did(11).state == 0) { echo -a Please select either Voice, HOP, AOP or SOP from the checkboxes on the right before clicking the add button. | goto end }
  if ($did(8).state == 1) var %tempastatus = Voice
  if ($did(9).state == 1) var %tempastatus = HOP
  if ($did(10).state == 1) var %tempastatus = AOP
  if ($did(11).state == 1) var %tempastatus = SOP
  AddAutoStatus $did(3) %tempastatus
  listautostatuses
  did -r ASChanlist 3
  did -u ASchanlist 8-11
  :end
}
on *:dialog:ASChanList:sclick:5:{
  if ($did(2).sel == $null) { $input(Please select a entry to be removed before clicking the remove button.,o,Error!) | goto end }
  RemoveAutoStatus $did(2).seltext
  listautostatuses
  :end
}
alias listautostatuses {
  did -r ASChanlist 2
  var %ccv = $numtok(%AVoice.chan,32)
  while (%ccv !<= 0) {
    did -a ASChanList 2 $gettok(%AVoice.chan,%ccv,32) Voice
    dec %ccv
  }
  var %cch = $numtok(%AHOP.chan,32)
  while (%cch !<= 0) {
    did -a ASChanList 2 $gettok(%AHOP.chan,%cch,32) HOP
    dec %cch
  }
  var %cca = $numtok(%AAOP.chan,32) 
  while (%cca !<= 0) {
    did -a ASChanList 2 $gettok(%AAOP.chan,%cca,32) AOP
    dec %cca
  }
  var %ccs = $numtok(%ASop.chan,32)
  while (%ccs !<= 0) {
    did -a ASChanList 2 $gettok(%ASOP.chan,%ccs,32) SOP
    dec %ccs
  }
}

Comments

Sign in to comment.
Typo   -  Jun 25, 2008

Im removing the needless brackets right now but i was told by someone far more k nowledgable than me that $iif() is more resource intensive that a normal if () {} so I usually intentionally avoid them unless needed.

Thanks for the comments.

 Respond  
vaseline28   -  Jun 25, 2008

if ($istok(%AVoice.Chan,$chan,32) == $true) { .timer 1 3 onjoinvoicer $chan }
the \"{\" and \"}\" are not necessary:
if ($istok(%AVoice.Chan,$chan,32) == $true) .timer 1 3 onjoinvoicer $chan
or you could do:
$iif($istok(%AVoice.Chan,$chan,32) == $true,.timer 1 3 onjoinvoicer $chan)

 Respond  
Typo   -  Jun 23, 2008

Please, no comments on the dangers of auto sopping etc. I know and fully agree that it leads to trouble but I always see channels with everyone opped and then someone asked me to make this so I decided to release it while I was releasing a couple other scripts.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.