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.

need topic append script

Old posts that have not been replied to for several years.
Locked
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

need topic append script

Post by bruhv »

can't find anything with search, and googled for hours with no success...

i need a script that:
!settopic <sometext> obviously, sets a new topic 'sometext'
!appendtopic <somemoretext> reads and then appends to the current topic

any scripting wizards fancy writing it for me?

8)
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Try this:

Code: Select all

bind pub n "!settopic" pub:topic
bind pub n "!appendtopic" pub:append

proc pub:topic {nick host hand chan args} {
  putserv "topic $chan :$args"
}
proc pub:append {nick host hand chan args} {
  putserv "topic $chan :[topic $chan], $args"
}
:)
Xpert.
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

... sets but doesn't append, can't see if i get errors in dcc chat because i can't dcc to the bot from work, will look at home later

thanks tho :)
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: need topic append script

Post by YooHoo »

bruhv wrote:can't find anything with search, and googled for hours with no success...
Haven't you looked in the TCL Archives? I just looked, and there are 29 different topic related scripts on this site alone...none of those will work?
:mrgreen:
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

yes i'm aware of the massive amount of topic scripts, yes i have tried most of them, none seem to append :-?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

Append - v. To add to the end (of something)

TopicBy.tcl

Description: When someone changes the topic, adds their nick to the end. Also has a public command for finding out who set the topic.

Maybe? :mrgreen:
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

yep, like the zombie.tcl, appends to the end of whatever you set as topic.
i think what i need is a proc to find out the current topic(no idea how, loads to learn still ;]) setting it as, for example, 'old_topic', then i think i can append the new topic to the end of 'old_topic' variable?

thought it might be quite a simple task lol




/edit
now i can see the console the output i get when i !appendtopic goes:

<orac> [18:23] Tcl error [pub:append]: wrong # args: should be "topic channel what"
Last edited by bruhv on Tue Apr 13, 2004 2:26 pm, edited 1 time in total.
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

right. messed about a bit but still too much a n00b :/

what i have so far...

Code: Select all

bind pub o "!settopic" pub:topic
bind pub o "!appendtopic" pub:append

proc pub:topic {nick host hand chan args} {
  putserv "topic $chan :$args"
}
proc pub:append {nick host hand chan args} {
 set old [topic $chan]
  putserv "topic $chan :$old - $args"
}
putlog "* topicappend.tcl loaded."
i'm trying (failing miserably) to set '$old' as the old topic
i get the same error: wrong # args: should be "topic channel what"

if i change $old to just old it kinda works...

[19:08:15] <@bruhv> !settopic test1
[19:08:15] * orac changes topic to 'test1'
[19:08:16] <@bruhv> !appendtopic test2
[19:08:17] * orac changes topic to ' topic - test2'

lol
i'm getting close, but i'm sure you lot can put me right :D
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

I would gather that you (or a script you are using) have a procedure called 'topic' which overrides the eggdrop 'topic' tcl command..

Change that procedure's name (or get rid of the script that provides it), and remember to use '.restart' after you have fixed.
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

ah... chanstats.tcl has a 'proc topic' line

changed it but haven't quite fixed it because my stats page no longer shows the topic. but i'm getting there, heh


thanks Xpert for the script that (should of) works perfectly, just changed +n flag to +o ;)

thanks strikelight for spotting the cause of my problem :]

now, back to fixing the stats script :mrgreen:
User avatar
bruhv
Voice
Posts: 22
Joined: Sat Apr 10, 2004 5:53 pm

Post by bruhv »

fixed :D

thanks again

now... i can see a point where i will want the bot to either:
1. remove the oldest part of the topic when the new append makes the total new topic more than 250 characters (sounds horribly complicated to me)

or

2. warn the user that it will make the topic too long, and then state how many characters there are remaining (out of maximum 250) if they want to append to the topic and not replace it completely

any pointers on #2?
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Use "string length" to determine the length of a string...

Also, on a side note, you should contact the author of chanstats.tcl to let them know that there is a bug with their script.
User avatar
CoolCold
Voice
Posts: 9
Joined: Thu Feb 27, 2003 11:29 pm
Location: Moscow,RU

appending topics

Post by CoolCold »

try to use topiclock,i've made some changes to it
http://web.coolcold.org/scripts/topiclock2.05.tcl
Locked