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.

Topic changer that reads from a .txt file list of topics

Old posts that have not been replied to for several years.
Locked
j
john83
Voice
Posts: 7
Joined: Sun Sep 18, 2005 12:20 am

Topic changer that reads from a .txt file list of topics

Post by john83 »

Hi,

Anyone can help me, i need a topic changer script that reads from a .txt file list of topics and changes topics and different channels at diff times.

help appreciated!
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

be more specific, describe the exact sequence of events you need implemented
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
j
john83
Voice
Posts: 7
Joined: Sun Sep 18, 2005 12:20 am

Post by john83 »

Sorry. Here it goes.

I need a script that my bot will load.
The script will set a topic on each channel at different
timing, 3 pm 6 pm 9 pm. It obtains the topic msg
from a file topic.txt in the same directory of the .tcl file.

topic.txt contains:
# channel:time:topic

#chan1:3pm:Today's topis is how to bake cheesecake!
#chan1:6pm:Time to watch wrestling!
#chan1:9pm:Ready to kick soccer?
#chan2:3pm:topic goes.
#chan2:6pm:so on..
#chan2:9pm:yup
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

bind time - "00 *" foo
if {![catch {set f [open topic.txt]}]} {
   set t [split [read $f] \n:]; close $f 
} {set t {}}
proc foo {m h args} {
   foreach {c n s} $::t {
      if {[string trimleft $h 0]==[string trim $n apm]} {
         if {[botisop $c]} {putserv "topic $c :$s"}
      }
   }
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
j
john83
Voice
Posts: 7
Joined: Sun Sep 18, 2005 12:20 am

Post by john83 »

thanks does that work for am too?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

yep
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
j
john83
Voice
Posts: 7
Joined: Sun Sep 18, 2005 12:20 am

Post by john83 »

last question which ver of eggdrop tcl does this need?

can it work on eggdrop1.1.5/tcl80?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

man, you should change your name to Rip van Winkle

where on Earth have you been the last 10 years???

eggdrop1.1.5 and Tcl8.0 were phased out at least 6-7 years ago
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
j
john83
Voice
Posts: 7
Joined: Sun Sep 18, 2005 12:20 am

Post by john83 »

lol
which ver should i use?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

the latest, obviously
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Probably he lived under a rock. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

as far as I can see, the script will ignore am/pm. I would suggest to get rid of am/pm and use 2 digit 24 hour timecode. that way you can simply use '$h == $n'. else i would suggest to add 12 to $n it was pm, leave it 12 if it was 12pm and make $n 0 if it was 12am.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

good suggestion; it should be noted though that if $h==$n is used as condition, time values in the file must be left-padded with zero: 00-09,10-23
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this will work for am/pm:

Code: Select all

bind time - "00 *" foo
if {![catch {set f [open topic.txt]}]} {
   set t [split [read $f] \n:]; close $f
} {set t {}}
proc foo {m h args} {
   foreach {c n s} $::t {
      if {[clock scan $h]==[clock scan $n]} {
         if {[botisop $c]} {putserv "topic $c :$s"}
      }
   }
} 
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Locked