Having created my small variable handling shortcut I decided to put it to the test.
I partially rewrote my topic script to utilize the variable handler.
I've added more commands and a formatting command is on its way I just need to have the time to do it.
The usual commands are as follows:
!topic = Set the main topic, primarily the first seciton of the topic
!divider = This is the text divder that seperates all three sections.
!owner = This is the channel owner nick the topic will change when they part and join the channel.
!verb = This is the owner status verb which mostly is set to "is" in the form "Owner is online"
!status = This is the owners status normally set to "Online" it can be set to anything such as "Sleeping"
!static = This is the last section, the static topic. This is the secondary topic which is mostly used for links.
!refresh = If the topic has been messed with may it be via fun or not this command will restore the topic.
!reset = This will clear the topic from the channel and the bot useful for decluttering when using temp chans.
TODO:
Please comment your thoughts below and leave bug reports below or report to http://bugs.ilkotech.co.uk
Thanks,
Thomas Edwards
(TMFKSOFT)
; TMFKSOFT's Topic Script Version two.
; This script uses TMFKSOFT's Coder Tools to make it not so messy!
; Script by Thomas Edwards (TMFKSOFT) Copyright 2011
alias setvar {
set % $+ $1 $+ . $+ $2 $3-
}
alias getvar {
var %var % [ $+ [ $1 ] ] [ $+ [ . ] ] [ $+ [ $2 ] ]
return %var
}
alias unsetvar {
unset % $+ $1 $+ . $+ $2
}
on 1:text:!topic *:#:{ if ( $nick isop $chan){ setvar topic $chan $2- | TMFK_topic } }
on 1:text:!divider *:#:{ if ( $nick isop $chan){ setvar divider $chan $2- | TMFK_topic } }
on 1:text:!owner *:#:{ if ( $nick isop $chan){ setvar owner $chan $2- | TMFK_topic } }
on 1:text:!verb *:#:{ if ( $nick isop $chan){ setvar verb $chan $2- | TMFK_topic } }
on 1:text:!status *:#:{ if ( $nick isop $chan){ setvar status $chan $2- | TMFK_topic } }
on 1:text:!static *:#:{ if ( $nick isop $chan){ setvar static $chan $2- | TMFK_topic } }
on 1:text:!refresh:#:{ if ( $nick isop $chan ) { TMFK_topic } }
on 1:text:!reset:#:{ if ($nick isop $chan ) { unsetvar topic $chan | unsetvar divider $chan | unsetvar owner $chan | unsetvar verb $chan | unsetvar status $chan | unsetvar static $chan | topic # $null } }
on 1:quit:{
if ($getvar(owner,$chan) == $nick) {
setvar status $chan offline
TMFK_topic
}
}
on 1:PART:#:{
if ($getvar(owner,$chan) == $nick) {
setvar status $chan offline
TMFK_topic
}
}
on 1:JOIN:#:{
if ($getvar(owner,$chan) == $nick) {
setvar status $chan online
TMFK_topic
}
}
on 1:TEXT:!cmds:#:{
msg # Topic Commands: !topic, !divider, !owner, !verb, !status, !static, !refresh, !reset; Use !cmd [option] for detailed command info.
}
on 1:TEXT:!cmd*:#:{
if ($2 == $null) { msg # No info for nothing! | HALT }
if ($2 == topic) {
msg # Usage: !topic [Topic]; Set the main topic for the channel, of which it is placed in the first section.
}
else if ($2 == divider) {
msg # Usage: !divider [Divder]; This is the divider used to seperate the sections it may just be a vertical line or be creative with something like -=>X<=-
}
else if ($2 == owner) {
msg # Usage: !owner [Owner]; This is the owner, placed in the central section it is coupled with a verb and status, in the format [owner] [verb] [status], e.g. TMFKSOFT is Online
}
else if ($2 == verb) {
msg # Usage: !verb [verb]; This is the status verb, placed in the central section, it is placed between the owner and status, in the format [owner] [verb] [status], e.g. TMFKSOFT is Online
}
else if ($2 == status) {
msg # Usage: !status [status]; This is the owners status it is placed in the central section after the owner and the verb, in the format [owner] [verb] [status], e.g. TMFKSOFT is Online
}
else if ($2 == static) {
msg # Usage: !static [static]; This is the secondary topic known as the "Static" topic. This is the third section of the topic. It is commonly used for after thoughts or Video/Blog/Quote/Message of the day.
}
else if ($2 == refresh) {
msg # Usage: !refresh; This is used if someone manually alters the topic, restore the topic to the bots set topic.
}
else if ($2 == reset) {
msg # Usage: !reset; This will unset all variables stored on the bot and clear the topic. Good for unloading the script or just clearing unrequired vars.
}
;Not needed yet.
; elseif ($2 == format) {
; msg # Usage !format [format]; This command will allow the user to change the arrangement of the topic.
; msg # Topic formatting 'flags': T = Topic, D = Divider, O = Owner, V = Verb, SS = Status, SC = static
; msg # The default layout is: T D O Y S D SS SC; Use !format def to restore it.
; }
else {
msg # No info on $2
}
}
on 1:TEXT:!credit:#:{ msg # TMFKSOFT's Topic Control Script v2. Copyright 2011, Obtain here: [Hawkee] }
alias TMFK_topic {
topic # $getvar(topic,$chan) $getvar(divider,$chan) $getvar(owner,$chan) $getvar(verb,$chan) $getvar(status,$chan) $getvar(divider,$chan) $getvar(static,$chan)
}
What about multiple nicks and/or afk/idle nicks? I know my nick changes to "Cali|AFK" when i use /away, then it changes back to "California" after /back. I also use the /ns group a lot since i use a different chat client than my bot, and the nicks are grouped together, along with my nick for when I'm using my iPhone.
Currently, I have to manually change the status if I use any nick other than the one set with !owner. It'd be nice if the script could check the group list, and apply the online/offline change for all nicks in the list.