Well, I figured I'd design a few snippets that are designed to be little bits of code for scripts. A lot of them will have to be manually edited for names and such, but it could be a basis for a feature on a script, or even a feature in and of it\'self. Please grade these on how they perform, not if I could have scripted them better.
About this snippet: This snippet gives 2 simple commands, /register and /unregister, to make it easier to register channels. This can be useful in making a more user-friendly script, and you are free to rip this code if you would like and call it your own.
Note This will ONLY work on servers that use chanserv.
alias register {
if ($1 == $null) { set %regname $$?="Name of channel to register:" }
else { set %regname $1 }
if ($2 == $null) { set %regpass $?*"Channel Password:" }
else { set %regpass $2 }
if ($3 == $null) { set %regdesc $$?="Channel Description:" }
else { set %regdesc $3- }
set %result on
cs REGISTER %regname %regpass %regdesc
}
on *:SNOTICE:*The channel* is already registered*:{
if (%result == on) {
echo -a Registration failed. %regname is already registered.
unset %result
}
}
on *:SNOTICE:*The channel* has been registered to you*:{
if ($nick != Chanserv) { halt }
if (%result == on) {
echo -a Registration successful! %regname is now registered to you.
unset %result
}
}
alias unregister {
if ($1 == $null) { set %drop $$?="Channel to unregister:" }
else { set %drop $1 }
cs DROP %drop
set %aback on
}
on *:SNOTICE:To confirm, type /msg * DROP %drop *:{
if ($nick != Chanserv) { halt }
if (%aback != on) { halt }
msg $5 DROP %drop $7
unset %aback
set %i on
}
on *:SNOTICE:Channel management of %drop has stopped.:{
if ($nick != Chanserv) || (%i != on) { halt }
echo -a Unregistration of %drop was successful!
unset %drop
unset %i
}
on *:SNOTICE:*before you can drop*:{
if ($nick != Chanserv) || (%i != on) { halt }
echo -a Unregistration of %drop was unsuccessful.
unset %drop
unset %i
}