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)
}
}
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.
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.
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-) }
}