egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
john83
Voice


Joined: 18 Sep 2005
Posts: 7

PostPosted: Sun Sep 18, 2005 12:56 am    Post subject: Topic changer that reads from a .txt file list of topics Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 1:04 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
john83
Voice


Joined: 18 Sep 2005
Posts: 7

PostPosted: Sun Sep 18, 2005 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 2:35 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
john83
Voice


Joined: 18 Sep 2005
Posts: 7

PostPosted: Sun Sep 18, 2005 3:03 am    Post subject: Reply with quote

thanks does that work for am too?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 4:09 am    Post subject: Reply with quote

yep
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
john83
Voice


Joined: 18 Sep 2005
Posts: 7

PostPosted: Sun Sep 18, 2005 4:14 am    Post subject: Reply with quote

last question which ver of eggdrop tcl does this need?

can it work on eggdrop1.1.5/tcl80?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 5:23 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
john83
Voice


Joined: 18 Sep 2005
Posts: 7

PostPosted: Sun Sep 18, 2005 5:29 am    Post subject: Reply with quote

lol
which ver should i use?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 5:52 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun Sep 18, 2005 8:52 am    Post subject: Reply with quote

Probably he lived under a rock. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Sep 18, 2005 10:36 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 1:37 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 18, 2005 1:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber