mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with this idea. #256931 02/03/16 08:11 AM
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
I am trying to create an uptime script that will start a timer for each channel the command is executed. I am then wanting it to echo back what that uptime is. Needless to say I am having issues trying to make the uptime count up for an infinite amount of time and then stop after the streamer leaves. Here is what I have so far just to give you all an idea as to what I am trying to do. Any help with this would be awesome as I have been pondering it for a while.

Code:

on *:text:!uptimecheck on:#: {
  set %uptimecheck. [ $+ [ $chan ] ] 1 
  msg $chan /me Uptime is now enabled
  /timer1 0 1 $+ $chan
}

on *:text:!uptimecheck off:#: {
  set %uptimecheck. [ $+ [ $chan ] ] 0 
  msg $chan /me Uptime is now disabled
  /timer1 $+ $chan off
}

on !*:JOIN:#: {
  if ( %uptimecheck. [ $+ [ $chan ] ] == 1 ) {
    /timer1 0 1 $+ $chan
  }
}

on !*:PART:#: { 
  /timer1 $+ $chan off

}

on *:text:!uptime:#: {
  if ( %uptimecheck. [ $+ [ $chan ] ] == 1 ) {
    msg $chan $duration(timer1)
  }
}



Thanks,

Netct25

Re: Need help with this idea. [Re: Netct25] #256939 02/03/16 12:08 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Instead of using a timer, how about trying to log the time? Check this code for reference
Code:
on 1:text:!start:#: { 
set %time $ctime
}

on 1:text:!uptime:#: {
var %uptime $duration($calc($ctime - %time))
msg # %uptime
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need help with this idea. [Re: Nillen] #256962 04/03/16 09:01 PM
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
So would I bind $+ $chan to that set %time $ctime variable under !start?

Re: Need help with this idea. [Re: Netct25] #256963 04/03/16 09:03 PM
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
The only issue with this is it doesn't stop when the streamer leaves.

Last edited by Netct25; 04/03/16 09:12 PM.