| View previous topic :: View next topic |
| Author |
Message |
john83 Voice
Joined: 18 Sep 2005 Posts: 7
|
Posted: Sun Sep 18, 2005 12:56 am Post subject: Topic changer that reads from a .txt file list of topics |
|
|
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! |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 1:04 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
john83 Voice
Joined: 18 Sep 2005 Posts: 7
|
Posted: Sun Sep 18, 2005 1:46 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 2:35 am Post subject: |
|
|
| Code: |
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] tag when posting logs, code |
|
| Back to top |
|
 |
john83 Voice
Joined: 18 Sep 2005 Posts: 7
|
Posted: Sun Sep 18, 2005 3:03 am Post subject: |
|
|
| thanks does that work for am too? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 4:09 am Post subject: |
|
|
yep _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
john83 Voice
Joined: 18 Sep 2005 Posts: 7
|
Posted: Sun Sep 18, 2005 4:14 am Post subject: |
|
|
last question which ver of eggdrop tcl does this need?
can it work on eggdrop1.1.5/tcl80? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 5:23 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
john83 Voice
Joined: 18 Sep 2005 Posts: 7
|
Posted: Sun Sep 18, 2005 5:29 am Post subject: |
|
|
lol
which ver should i use? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 5:52 am Post subject: |
|
|
the latest, obviously _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Sep 18, 2005 8:52 am Post subject: |
|
|
Probably he lived under a rock.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Sep 18, 2005 10:36 am Post subject: |
|
|
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... |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 1:37 pm Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 18, 2005 1:57 pm Post subject: |
|
|
this will work for am/pm:
| Code: |
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] tag when posting logs, code |
|
| Back to top |
|
 |
|