| View previous topic :: View next topic |
| Author |
Message |
Gewan Voice
Joined: 25 Dec 2010 Posts: 27
|
Posted: Mon Mar 28, 2011 12:03 pm Post subject: Simple !topic changing~ |
|
|
Hi guys!
Me and my fellows was discussing an idea the other night. The usual "!topic <new topic>" is a feature that probably exists in hundreds of forms. However, we are looking for a small refinement. Say you want to _add_ something to the topic without deleting the previous topic.
Baseline. Say we have a variable %separator to set within the .TCL script, which is per default "|". Now, if I do "!t This will be our topic" the bot will simply change topic on its whole (on the channel where the command is executed, of course). Furthermore, now say that another authorized (+o) person drops "!ta Also checkout www.egghelp.org for cool scripts" (where !ta is short for "topic/add"), then the bot simply changes the topic to "This will be our topic | Also checkout www.egghelp.org for cool scripts".
You guys feel my baseline here? Wouldn't be _too_ complicated to make a script that has these two commands (!t and !ta) and listens to +o users only, right? Would be much appreciated if some bored out scripter could help us out here.
Cheers! |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Mar 28, 2011 1:14 pm Post subject: Re: Simple !topic changing~ |
|
|
Just thinking....
First, post whatever you have now... your current working script that will change the topic.
Next -
Explore the options available in your server's Chanserv.
Possibly '/msg chanserv help' or '/msg chanserv help topic' and look closely for another option topicappend or maybe appendtopic or even
topicprepend (I've seen all three).
You are looking to see if Chanserv even offers some sort of option to append to the current topic.
I'm thinking that with seeing what you have now, that works, and presuming there is a command available to append to current topic, - that you could do something with editing the commands in your current script. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Mar 28, 2011 1:34 pm Post subject: |
|
|
Something like this should do the trick, I suppose:
| Code: | bind pub o|o "!ta" pubAddTopic
set topicSeparator " | "
proc pubAddTopic {nick host handle channel text} {
if {[topic $channel] != ""} {
puthelp "TOPIC $channel :[topic $channel]${::topicSeparator}${text}"
} else {
puthelp "TOPIC $channel :$text"
}
} |
Be adviced that this code does not check the length of the new topic... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Gewan Voice
Joined: 25 Dec 2010 Posts: 27
|
Posted: Mon Mar 28, 2011 3:28 pm Post subject: |
|
|
@willyw:
To be frank, I have (had*) nothing until just now. I searched egghelp TCL archive and tclscriptsdotcom and some other place with and search string "topic" and it yielded tons of hits. Also, since I'm not sure if any of these were copyrighted or anything, I didn't dare to just copy/paste any of their codes in here. Instead, I thought I'd start from scratch, since it feels like a quite simple function to implement.
Thanks a lot nml375!
Your code works perfectly well!
Any chance that anyone can fill in a little section for "!t" (change/override topic), I tried modifying the !ta section by free hand, but I'm too lousy with scripting to make it work. Sorry! :/
Again, thanks! |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Mar 28, 2011 3:30 pm Post subject: |
|
|
| Code: | bind pub o|o "!t" pubTopic
proc pubTopic {nick host handle channel text} {
puthelp "TOPIC $channel :$text"
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Gewan Voice
Joined: 25 Dec 2010 Posts: 27
|
Posted: Mon Mar 28, 2011 3:38 pm Post subject: |
|
|
Script works like a charm!
Many thanks (again) nml375.
Case closed!  |
|
| Back to top |
|
 |
|