mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2014
Posts: 24
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Apr 2014
Posts: 24
I currently run a Twitch.tv bot for my clan of about 15 streamers. What I want is a timer that can be started by the streamers that will keep track of how long they have been streaming for. I want command to show at least hours and minutes, maybe seconds.

I would like a !startuptime command to start the timer and !enduptime to end the timer.(These only can be used by ops)

Then I think the command to display the uptime should be !uptime.

Also, I would like flood protection so it can only be used every 30 seconds. (I think I can figure that out though)

Thanks in advance.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Dunno if there's a "real" way to do this.
Code:
on *:text:!startuptime:#: {
  msg # Starting uptime.
  timerUptime. $+ # 0 1 inc %uptime. [ $+ [ # ] ] 
}

on *:text:!uptime:#: { msg # %uptime. [ $+ [ # ] ] }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
  timerUptime. $+ # off
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You don't use a timer for this.

Store $ctime when you start and use $duration($calc($ctime - %start)) to display it.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You're so reliable <3

Here you go op, updated to what Loki said.
Code:
on *:text:!startuptime:#: {
  msg # Starting uptime.
  set -e %uptime. [ $+ [ # ] ] $ctime
}

on *:text:!uptime:#: { msg # $duration($calc($ctime - %uptime. [ $+ [ # ] ] )) }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 24
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Apr 2014
Posts: 24
Thanks again guys, you are the best.


Link Copied to Clipboard