INPUT

By Demothense on Jan 06, 2009

I perfer INPUTS over dialogs
they are easier to get to

Pretty self explanatory
edit as you feel

on *:INPUT:#:{
  if ($1 == +o) { 
    if (!$2) mode $chan +o $me
    if ($2) mode $chan +o $2
  }
  if ($1 == -o) {
    if (!$2) mode $chan -o $me
    if ($2) mode $chan -o $2
  }
  if ($1 == +v) {
    if (!$2) mode $chan +v $me
    if ($2) mode $chan +v $2
  }
  if ($1 == -v) {
    if (!$2) mode $chan -v $me
    if ($2) mode $chan -v $2
  }
  if ($1 == .k) {
    if ($2) kick $2 $3-
  }
  if ($1 == .kb) {
    if ($2) ban $chan $address($2,3)
    if ($2) kick $2 $3-
  }
  if ($1 == .kill) {
    if ($2) kill $2 $3-
  }
  if ($1 == .akill) {
    if ($2) akill $2 $3-
  }
  if ($1 == +aop) {
    if ($2) services aop $chan add $2
    mode $chan +o $2
    notice $2 You now have AOP (automatic op) in $chan .
  }
  if ($1 == +sop) {
    if ($2) services sop $chan add $2
    mode $chan +o $2
    notice $2 You're now an owner in $chan .
  }
  if ($1 == +vop) {
    if ($2) services vop $chan add $2
    mode $chan +v $2
    notice $2 You're now voiced in $chan .
  }
  if ($1 == -vop) {
    if ($2) services vop $chan del $2
    mode $chan -v $2
  }
  if ($1 == -aop) {
    if ($2) services aop $chan del $2
    mode $chan -o $2
  }
  if ($1 == -sop) {
    if ($2) services sop $chan del $2
    mode $chan -o $2
  }
  if ($1 == shush) {
    mode # +q $address($2,4)  
  }
  if ($1 == talk) {
    mode # -q $address($2,4)  
  } 
}

Comments

Sign in to comment.
TravisT   -  Jan 07, 2009

LEss code is better yes. I was just showing other ways of doing it. Also, look into using elseif in these situations.

If you say:

if ($1 == .m) { command }
if ($1 == .q) { command }
if ($1 == .k) { command }
etc.

Even if it matches .m, which means it won't match any of the others, it will still go through each if statement till it gets to the closing bracket.

if ($1 == .m) { command }
elseif ($1 == .q) { command }
elseif ($1 == .k) { command }

Now this will only check until it gets a match and then it will stop.

 Respond  
Demothense   -  Jan 07, 2009

Question would changing the code make it better Napa said it makes it smaller removes lines I don't care about size if it does what I want it too
but I appreciate the input tho I will try what you say and If i don't like it I'll go back to my old script

 Respond  
Demothense   -  Jan 07, 2009

honesetly.......... you all lost me
;p

 Respond  
TravisT   -  Jan 07, 2009

lol, actually $iif is a bit slower than using if.

I was going to suggest not checking the comparison twice.

if (!$2) mode $chan +o $me
else { mode $chan +o $2 }

but safer to say ...

if ($2 ison $chan) { mode $chan +o $2 }
else { mode $chan +o $me }

I, however, prefer the method stated with the regex. One line that handles all modes. :)

on *:input:#:{
if ($1 == .m) { var %m2 = $iif($3 ison $chan,$3,$me) | mode $chan $2 %m2 }
elseif ($1 == .k) && ($2 ison $chan) { kick $chan $2 $3- }
}

example:
.m +v nickname

Does require more to type though.

 Respond  
napa182   -  Jan 07, 2009

lol

  • ~napa182 slaps morbid with a pitchfork...
 Respond  
Demothense   -  Jan 07, 2009

eh I don't know why I put aliases and Napa hush up Ill sick Jenn on you :P

 Respond  
Aucun50   -  Jan 07, 2009

True

 Respond  
napa182   -  Jan 07, 2009

Aucun50 said:

He/She could but then he/she wouldn't know how to add things. Unless he/she know how to use $regex and $iif.

well thats what /help and Tutorials are for as well as this site.

 Respond  
Aucun50   -  Jan 06, 2009

He/She could but then he/she wouldn't know how to add things. Unless he/she know how to use $regex and $iif.

 Respond  
napa182   -  Jan 06, 2009

you could make it abit shorter by useing regex and $iif's
for the user modes and kick kickban's and so on somthing like

on *:INPUT:#:{
  if ($regex($1,/^[+-][ov]$/S)) { mode # $1 $iif(!$2,$nick,$2) }
  if ($regex($1,/^(.k|.kb)$/S) && $2) { $iif($regml(1) == .k,kick # $2 $iif(!$3,Cya,$3-),$iif($regml(1) == .kb,ban -k # $2 2 $iif(!$3,Cya,$3-))) }
  if ($regex($1,/^(.kill|.akill)$/S) && $2) { $right($regml(1),-1) $2 $iif(!$3,Piss off,$3-) }
}
 Respond  
Aucun50   -  Jan 06, 2009

Then again that would make you look stupid if you forgot to put in $2 && $3 and you get a msg from yourself saying you forgot it lol.

 Respond  
Aucun50   -  Jan 06, 2009

I was about to say that to, for your

if ($1 == .k) {
if ($2) kick $2 $3-
}

You could put: if (!$2) && (!$3) { msg $chan No Name or Channel entered }
if ($1 == .k) {
if ($2) kick $2 $3-
if (!$2) && (!$3) { msg $chan No Name or Channel entered }
}

You can also do that for .kb, .kill and so on.

 Respond  
guest598594   -  Jan 06, 2009

Use $iif

mode $chan +o $iif($2,$2,$me)

Oh and btw, these aren't aliases :/

 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.