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.

Countdown to date in topic

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
V
Venus
Voice
Posts: 3
Joined: Thu Mar 10, 2005 7:03 pm
Location: Washington

Countdown to date in topic

Post by Venus »

I run a convention site, with chat room and would like a way for the bot to change the topic to include the how many more days untill (this convention).

One of the things though is I need to be able to set multiple dates and multiple places. Because we work with other local conventions. So the topic would read:

"Topic: 340 more days till radcon!, 56 more days till norwescon! etc."

With perhaps certain things where you could say that when it was within a week he would say something different than just days. Like 2months and 3 days. or only one week away!

If this script is too complicated forgive me for asking :) I am new here and don't know what is considered an allowable request.

Venus
I don't think I am evil, I know I am.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Code: Select all

# set the name and date for the convention here
# convention name mm/dd/yy
set conventions {
  "radcon 04/25/05"
  "norwescon 07/11/2005"
  "and another convention 08/15/2005"
}

# channel
set convchan #channel

bind pub -|- !topconv pubconv
bind time - "00 00 * * *" convtime

proc pubconv {nick uhost hand chan text} {
 settopic
}

proc convtime {min hour day month year} {
 settopic
}

proc settopic {} {
 foreach c $::conventions {
  set conv [lrange $c 0 end-1]
  set when [clock scan [lindex $c end]]
  set days [expr ($when-[clock seconds])/86400]
  lappend topic "$days more days till [join $conv]!"
 }
 putserv "TOPIC $::convchan :[join $topic {, }]"
}
It will update the topic at midnight every night, and you can also type !topconv to update it.
d
dhp1080
Voice
Posts: 8
Joined: Mon Aug 14, 2006 4:13 pm

Post by dhp1080 »

Hi,

I suppose this topic is from over a year ago, but it still fits very well what I need, but not quite.

My topic is in the format of "http://example.com | <countdown> | Any text"

I'd really appreciate it if someone could slightly modify the above script to put it into that format, and maybe reupdate the topic whenever anyone changes it in case the countdown gets taken out accidentally.

Thanks in advance
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

That's not very easy to do if your topic constantly changes, so I wouldn't count on it anytime soon (unless the countdown should always be in the middle of the | | part (in which case, it wouldn't be very hard at all)
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

I'll make a modified version of my date.tcl script to handle events and setting topics. Gimme a few days to finish it.
d
dhp1080
Voice
Posts: 8
Joined: Mon Aug 14, 2006 4:13 pm

Post by dhp1080 »

metroid wrote:That's not very easy to do if your topic constantly changes, so I wouldn't count on it anytime soon (unless the countdown should always be in the middle of the | | part (in which case, it wouldn't be very hard at all)
The countdown would always be in the || part, and the URL never changes. If someone were to erase the countdown part, i'd want the bot to go about fixing it and putting it back.

Thanks for the responses.
Post Reply