This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Simple !topic changing~

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
G
Gewan
Voice
Posts: 27
Joined: Sat Dec 25, 2010 7:50 pm

Simple !topic changing~

Post by Gewan »

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!
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: Simple !topic changing~

Post by willyw »

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.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Something like this should do the trick, I suppose:

Code: Select all

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
G
Gewan
Voice
Posts: 27
Joined: Sat Dec 25, 2010 7:50 pm

Post by Gewan »

@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!
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Code: Select all

bind pub o|o "!t" pubTopic
proc pubTopic {nick host handle channel text} {
  puthelp "TOPIC $channel :$text"
}
NML_375
G
Gewan
Voice
Posts: 27
Joined: Sat Dec 25, 2010 7:50 pm

Post by Gewan »

Script works like a charm!
Many thanks (again) nml375.

Case closed! :D
Post Reply