mIRC Home    About    Download    Register    News    Help

Print Thread
A countdown to channel's topic #153208 12/07/06 07:40 PM
Joined: Oct 2004
Posts: 20
E
eduard0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Oct 2004
Posts: 20
I'd like to get a script that updates a specified channel's topic on every 0.00am so that it for example shows on day1 "34 days to the event | other text here" and on 0.00am it would change to "33 days to the event | other text here".

The "other text" section might be the tricky part because it should be updateable without updating the text to the script. What I mean is that if the topic is "34 days to the event | blabla" and someone changes it to "34 days to the event | nice topic" the script should change the topic to "33 days to the event | nice topic"

The problem is that I have no clue how to make that kind of a script. If anyone has too much time or is interested in this, please help. Any help would be appreciated.

Re: A countdown to channel's topic #153209 12/07/06 09:38 PM
Joined: Jul 2006
Posts: 13
M
Mark_markieham Offline
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2006
Posts: 13
Hard one...


You should make a timer to update it...

Maybe setting the topic in a txt/ ini file.. Or a var...

Send me a PM with the same question, and ill get back to this tomorrow and give it a shot.


Mark

Re: A countdown to channel's topic #153210 13/07/06 12:36 PM
Joined: Jul 2006
Posts: 13
M
Mark_markieham Offline
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2006
Posts: 13
Ok.. I made something up. I haven;'t tested it since my mIRC is down... But it looks ok to me... smile

Add this to your remotes. You can change the topics to be set, in the alias. It now says
topic $1 /\ %topictimeleft Days Left /\ %topic
You could change it to something with freeky colors, reverse, wicked characters. As long as %topictimeleft and %topic are in there, and it starts with topic $1 (NOTE: NOT $chan ! Since it's an alias that wont work!)\

Have fun!

Code:
 
on 5:text:!settopic *:#YOURCHANHERE: {
   if ($2 == time) {
    set %topictime $$3
    set %topictimeleft $$3
    set %topic $$4-
     topic $chan /\ %topictimeleft Days Left /\  %topic
     timertopicchange $3 86400 topicchange $chan 
  }
  else .notice $nick Error. Syntax: !settopic time [days] [topic]
}
;notes: in the timer 86400 stands for 1 day. $3 refers to the days it should run. Syntax: !settopic time [days] [topic]


alias topicchange {
   if (%topictimeleft = 1) {
     set %topictimeleft ok
      topic $1 /\ Only 1 Day Left! /\ %topic
      }
  elseif (%topictimeleft == ok) {
     topic $1 /\ It's Today! /\ %topic
  }
  else { 
   set %topictimeleft $calc(%topictimeleft - 1)
   topic $1 /\ %topictimeleft Days Left /\ %topic
   }
}

on *:topic:#YOURCHANHERE: {
  set %topic $1- 
  topicchange $chan
}

Re: A countdown to channel's topic #153211 13/07/06 06:32 PM
Joined: Oct 2004
Posts: 20
E
eduard0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Oct 2004
Posts: 20
I removed the level 5 user thingie... But the problem is that your script changes the topic every now and then (very rapidly, takes from 2 to 20 seconds to change). And it looks like this:

[13.07.2006] - 21:41:22 - * eduard0 changes topic to '/\ 81 Days Left /\ elikkäs tod näk koh tao 1.10-1.11 - lennot ~750e'
[13.07.2006] - 21:41:22 - * eduard0 changes topic to '/\ 80 Days Left /\ /\ 81 Days Left /\ elikkäs tod näk koh tao 1.10-1.11 - lennot ~750e'
[13.07.2006] - 21:41:24 - * eduard0 changes topic to '/\ 79 Days Left /\ /\ 80 Days Left /\ /\ 81 Days Left /\ elikkäs tod näk koh tao 1.10-1.11 - lennot ~750e'
[13.07.2006] - 21:41:31 - * eduard0 changes topic to '/\ 78 Days Left /\ /\ 79 Days Left /\ /\ 80 Days Left /\ /\ 81 Days Left /\ elikkäs tod näk koh tao 1.10-1.11 - lennot ~750e'
[13.07.2006] - 21:41:36 - * eduard0 changes topic to '/\ 77 Days Left /\ /\ 78 Days Left /\ /\ 79 Days Left /\ /\ 80 Days Left /\ /\ 81 Days Left /\ elikkäs tod näk koh tao 1.10-1.11 - lennot ~750e'

So it does not remove the existing "Days left" thing before adding a new one.

Wouldn't it be possible to use timer format: !timer 0:00 do_this_thing? At least I think it would be easier and the topic would change always at 0:00, even if the !settopic command has been said during daytime.

I made my own script:
Code:
on *:text:!topictimer *:#YOURCHANNELHERE: {
  /topic #YOURCHANNELHERE TTG: $2 :: $3-
  /set %topictimertime $2
  /set %topictimertopic $3-
  /timertopictimer 0:00 $calc(%topictimertime - 1) 86400 /topic TTG: %topictimetime :: %topictimertopic | /dec %topictimertime 1
}
on *:TOPIC:#YOURCHANNELHERE:{/set %topictimertopic 4-}
  


I have no idea if it works yet, but I'll see that tomorrow.

Last edited by eduard0; 13/07/06 08:27 PM.
Re: A countdown to channel's topic #153212 14/07/06 01:52 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
this would NOT give days, there are posts on these threads about an alternate "$duration" identifier and you can research them to use instead of the $duration in mIRC, and that I have used here
Code:
alias t-to-date {
  timerfortopic 23:59 0 1 topic #CHNANNELNAME time remaining til Halloween > oct 31 2006 00:00:01 > $round($calc(($ctime($gettok($chan(#ascii_art).topic,2,62)) -  $($!ctime,2)) / 86400),0) Days
}


the channel topic would be sometext > mon date hh:nn:ss > (the output of the script will be here)

see if that is more like what you wanted
you can use another timer to retrigger this one

Re: A countdown to channel's topic #153213 14/07/06 08:36 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
or you could timerfortopic 23:59 0 86400 {stuff}

but you would need to evaluate the identifiers with the timer and not on setting ( i find $ $+ duration in the timer would put $duration in the timer and evaluate when the timer activates.) i guess $eval($duaration,0) might do the same.


btk

Last edited by billythekid; 14/07/06 08:41 AM.
Re: A countdown to channel's topic #153214 14/07/06 08:34 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I changed the thing so many times i lost track of the thing, it Does count days (only) till a certain date in the format mon day year hh:nn:ss


Code:
alias t-to-date {
  topic #CHANNEL$int($calc(($ctime(oct 31 2006 00:00:01) -  $($!ctime,2)) / 86400)) Days remaining til Halloween > oct 31 2006 00:00:01 >
  timerfortopic 23:59 0 86400 topic #CHANNEL $int($calc(($ctime($gettok($chan(#CHANNEL).topic,2,62)) -  $($!ctime,2)) / 86400)) Days remaining til Halloween > oct 31 2006 00:00:01 >
}

I am guessing you or your bot are normally on 24/7
if you want to use text decoration you would need to do a lot more coding and include a "$strip($chan(#CHANNEL).topic)"

if you/the bot get disconnected you can include the aliase name in the 'on connect" or perform you have set up to join channels and so on when you first connect to a server or join a channel

Re: A countdown to channel's topic #153215 15/07/06 11:14 AM
Joined: Oct 2004
Posts: 20
E
eduard0 Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Oct 2004
Posts: 20
MikeChat, I've started testing your script today.

To me it seems that your script counts one day less than there actually is between today and the desired date. Is that fixable?

I'll inform you tomorrow on how it works at 0:00.

Last edited by eduard0; 15/07/06 12:36 PM.
Re: A countdown to channel's topic #153216 15/07/06 02:46 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
in the various iterations I did in my testing I used both
topic #CHANNEL $int
topic #CHANNEL $round

with rounding if the math gives 108.6793 (whatever)
$int will return 108 and round (with no decimals) will give 109
depending on when you have it update and the actual time you set in
the topic (ie: oct 31 2066 00:00:01) the division will be different for the number of "days" and the remainder

If I have rambled I mean that if you test at noon and the time in the topic is 1 second after midninght you have half a day not accounted for in the use of $int and rounded up in the use of $round