Auto-oper with Var arrays

By Savage_CL on Nov 09, 2010

I actually wrote this script to make my friend mad because he hates when I use variable arrays such as the one this script uses.
use the alias /aop to turn the script on and off. it is channel specific. if you don't want someone to be oped, Right click on their nick in the nicklist, there will be a menu there called "auto-oper"

This is multi-server so don't worry about that :)

; written in it's entirety by Savage
; contact me with the mIRC command on the next line
; /server -m irc.netgamers.org -j #savage
; thanks to these people for suggestions: Yogibear, melwil
; cont'd: napa182, Jethro_, Known
; enjoy :)

on @*:JOIN:#: {
  if %aop. [ $+ [ $chan ] $+ . $+ [ $network ] ] == 1 {
      if $address($nick,2) isin %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] { HALT }
      mode $chan +o $nick
} }
alias AOP {
  if %aop. [ $+ [ $chan ] $+ . $+ [ $network ] ] != 1 { if ($address($nick,2) isin %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ]) { HALT } 
    set %aop. [ $+ [ $chan ] $+ . $+ [ $network ] ] 1 |  echo Auto-Op for $chan is ON
  }
  else {
    unset %aop. [ $+ [ $chan ] $+ . $+ [ $network ] ] |  echo Auto-Op for $chan is OFF
} }
menu Nicklist {
  Auto-oper
  .no-op { if %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] == $null { echo -a $$1 has been added to the no-op list for # | set %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] $address($$1,2) }
    elseif ($address($$1,2) isin %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ]) { echo -a $$1 has already been added to the no-op list for # | HALT } 
    else { echo -a $$1 has been added to the no-op list for # | set %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] $address($$1,2) }
  }
  .op { 
    if $address($$1,2) isin %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] { 
      echo -a $$1 has been removed from the no-op list for #
      set %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] $remtok(%noop. [ $+ [ $chan ] $+ . $+ [ $network ] ],$address($$1,2),0,32)
    if %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] == $null { unset %noop. [ $+ [ $chan ] $+ . $+ [ $network ] ] } } 
  else { echo -a $$1 wasn't in the no-op list for # } }
}

Comments

Sign in to comment.
Savage_CL   -  Jan 06, 2011

Known, I just put the first bracket after the initial variable "name" so it was easier for me to find them. :)
and why aren't you in my chan anymore? god... :P

sunslayer, my newer script, which is an extreme expansion of this, is found here: http://www.hawkee.com/snippet/8124/

 Respond  
sunslayer   -  Jan 06, 2011

it will work, all the []'s cancel out

 Respond  
Known   -  Jan 05, 2011

I believe your var's won't work, as [ $+ [ $chan ] isn't completed, even with the $+ . after it, it should be [ $+ [ $chan ] ] (unless I'm otherwise wrong and it could be both ways)

 Respond  
Savage_CL   -  Jan 05, 2011

Maybe I should use $+(stuff,morestuff,.,evenmorestuff)

 Respond  
Savage_CL   -  Nov 11, 2010

Hey Napa. Thanks. Forgot to change that when I made it multi-server. I know, I hate brackets, but it's just more proofing against breaking.

 Respond  
napa182   -  Nov 10, 2010

where is just

%aop. [ $+ [ $chan ] ]

set at?
all other var sets i see are

%aop. [ $+ [ $chan ] $+ . $+ [ $server ] ]

all them eval brackets are hell on the eyes =/

 Respond  
Savage_CL   -  Nov 10, 2010

Well how about that, but I was also able to get rid of a line with his way. and your still mentioned in the credits. be happy :)

 Respond  
Jethro   -  Nov 10, 2010

Well, if that's the case, you should've turned down napa's suggestion, no? :P > @ compares to > if ($nick != $me) && ($me isop #) {But then again, script what you like the best. What people can offer to you here is of merely suggestions. You be your own judge.

 Respond  
Savage_CL   -  Nov 10, 2010

9 extra characters, 8 if it's $$1. Not enough of a difference to bother me.

 Respond  
Jethro   -  Nov 10, 2010

Savege_CL, $wildsite returns a user's address in the form of !@host, which is interchangeable with $address($nick,2). The only difference is one is shorter and the other longer. For MSL, I tend to look for shorter way instead of going the extra mile to have a big script with lengthy coding that ultimately results the same outcome.

 Respond  
Savage_CL   -  Nov 10, 2010

Thank you, all, for the argument. Being that I had no idea what $wildsite was, I used $address. It works just as well, and if someone knows coding, they can change it to 4 if they wish.

 Respond  
Jethro   -  Nov 10, 2010

I take back what I say about speed. It actually doesn't make much of a difference. I'll say it's a matter of preference. I'm inclined toward $wildsite is all. This speed issue doesn't fit to be a debate. :P Excuse me for bringing it up nonchalantly.

 Respond  
_Teen_   -  Nov 09, 2010

oww thanks Genious to try explain what is this to me...

if u didnt understand, im just saying, that in this case, dont even matter if you use $address($nick,2) or $wildsite... there is no difference of how much faster is this... and dont say to me about the bad habits

 Respond  
Serpentsounds   -  Nov 09, 2010

Congratulations on trying to benchmark a single pass with your eyes. This IS a computer we're talking about, you know.

 Respond  
_Teen_   -  Nov 09, 2010

$wildsite is shorter and faster

How much faster are you talking about? 1 billionth of a second? cause i tested with both and my eyes didnt noticed the difference

 Respond  
Jethro   -  Nov 09, 2010

Under the join event and aop alias, you can use $wildsite in place of $address($nick,2) They're the same thing. $wildsite is shorter and faster. It doesn't pass two identifiers for processing.

 Respond  
Savage_CL   -  Nov 09, 2010

Thanks :) Updated

 Respond  
napa182   -  Nov 09, 2010

you can get rid of the if ($nick != $me) && ($me isop #) { check by usinng

on @*:JOIN:#: {
 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.