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.

Set Topic script

Old posts that have not been replied to for several years.
Locked
l
levian
Voice
Posts: 4
Joined: Wed Feb 23, 2005 5:52 pm

Set Topic script

Post by levian »

Hello, I'm new to tcl and I don't know much about it.
But for my channel I need a eggbot tcl script that allows a time dependend topicchange.

E.g.: at 4 o'clock one show begins with moderator 1, at 6 o'clock another show with another name and another moderator, then at 8 o'clock another show with another mod and so on.

The topic should be set when a Show begins, the setdj funktion of the shoutcast script is already modified by me so that a nickchange automatically changes the dj and perhaps this could be useful in this script. So that when the mod changes his nick the topic will change.

The next 4 show should be written in the topic.

If anyone could help me with a time based script which refers to a manually filled database it would be a big help for me.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

My suggestion would be to use bind time. A static timer for changing the topic at very specific times in a day. And you can declare a simple 2-3 line proc to call that bind and make it set the topic.

#This would be for 4 o'clock (pm - afternoon) if I am correct:

Code: Select all

#Set the channel where the bot should change the topic
set channel_name "#channelname"

#Set the topic for 4pm here
set 4oclock_topic "topic here... bla bla bla"

bind time - "00 16 * * *" 4oclock:topic

proc 4oclock:topic {min hour day month year} {
 global channel_name 4oclock_topic
  if {[botisop $channel_name] && ($4oclock_topic != "")} {
   putquick "TOPIC $channel_name :$4oclock_topic" -next
   }
}
The wildcard "*" means any day for day, any month for month and any year for the year field. You only have to change the minute and hour for the bind, keeping in mind they are used in a 24hr format, not in the 12hr format.

The rest can be just defined topics, either you can have 3 different procs for the 3 different times or include all in one. The simpler and easier one would be to make all individual.
TIME (stackable)

bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Description: allows you to schedule procedure calls at certain times. mask matches 5 space separated integers of the form: "minute hour day month year". minute, hour, day, month have a zero padding so they are exactly two characters long; year is extended to four characters in the same way. flags are ignored.
Else if you want the bot to switch the topic when a moderator switches his nick just use "bind nick".

Here is an example of when a moderator changes his nick

Code: Select all

#Set a common nick matching the moderator's nick - (wildcards are allowed)
#(Note: If you want to enter a precise nick, leave this as empty and try the setting below)
set matchnick1 "dj*"

#Set the exact moderator's nick - (nick should be precise, case is ignored)
#(Note: Only the above or this setting can be used)
set matchnick2 ""

#Set the topic here
set chantopic "bla bla bla......... my topic here"

bind nick - * badnick:change

proc badnick:change {nick uhost hand chan newnick} {
 global botnick matchnick1 matchnick2 chantopic
  if {([string equal -nocase $botnick $nick])} { return 0 }
  if {($matchnick1 != "") && ([string match -nocase *$matchnick1* $newnick]} {
   putquick "TOPIC $chan :$chantopic" -next
  }
  elseif {($matchnick2 != "") && ([string equal -nocase $matchnick2 $newnick]} {
   putquick "TOPIC $chan :$chantopic" -next
   }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
l
levian
Voice
Posts: 4
Joined: Wed Feb 23, 2005 5:52 pm

Post by levian »

Thanks that would be a great help.

I'll try it ;)
l
levian
Voice
Posts: 4
Joined: Wed Feb 23, 2005 5:52 pm

Post by levian »

I tried it with your first inpression and some other commands.

But now I get an error:
Invalid command "Ä "

if you want to see the script:

http://www.linpy.de/topic.tcl

I wanted to use a file to save the topics which are set by triggers like
!set0200 for 2o'clock.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I don't understand you have so many binds. If you want, why just dont you make the script execute after every 30 minutes with a timer? Rather than having so many binds?

If you really want them to be at full hour and half hour intervals create the first bind after that loop a timer for 30 minutes. Also making sure the timer already doesn't exist (for the next time the bind will activate which is the next day, same time)

And as for your error:

I think it is because of you are using special characters such as, geändert in which "ä" is one.

You can use this character in hex format: "\xE4"

Take a look at this post:
http://forum.egghelp.org/viewtopic.php?t=7348

For character listings goto:
http://www.torsten-horn.de/techdocs/ascii.htm
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

I thought this section of the forum was for full scripts only.
l
levian
Voice
Posts: 4
Joined: Wed Feb 23, 2005 5:52 pm

Post by levian »

This is a request.

And I need a script which changes the topic on seperate times. To do not slave others to much ;) I try my best to write it alone, but if someone will write it for me, then I won't have a problem with that
Locked