mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with uptime timer command script. #245816 09/05/14 07:57 AM
Joined: Apr 2014
Posts: 24
T
Thedelirious1 Offline OP
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.

Re: Need help with uptime timer command script. [Re: Thedelirious1] #245819 09/05/14 10:35 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
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
Re: Need help with uptime timer command script. [Re: Nillen] #245821 09/05/14 12:29 PM
Joined: Jan 2004
Posts: 1,314
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,314
You don't use a timer for this.

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

Re: Need help with uptime timer command script. [Re: Loki12583] #245822 09/05/14 12:39 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
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
Re: Need help with uptime timer command script. [Re: Nillen] #245825 09/05/14 09:41 PM
Joined: Apr 2014
Posts: 24
T
Thedelirious1 Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Apr 2014
Posts: 24
Thanks again guys, you are the best.