mIRC Homepage
Posted By: Massari Uptime - 10/03/06 12:27 PM
Okay, well I am a n00b at this scripting stuff(started today). I have little knowledge, but ive looked all over the internet and I cannot find what i need.

Basically, I want to make my own uptime script, so i can see my best uptime, aswell as my current uptime and the time set and date. This is what I got so far..
--------------------------
ALIASES
-----------------------
;UPTIME
/up //say 3Habib's cool computer has been up for 7.7:7. $uptime(system,1) 3set on $fulldate 7.7:7. - The time is $time


Can anyone sugesst what I can do to improve to to do what I want it to do..Any help will be great. I really want to understand this program.
Posted By: genius_at_work Re: Uptime - 10/03/06 02:56 PM
The $uptime identifier only shows your current uptime. You could store your record uptime in a global variable and then include that in your message.

Code:
/up {
  if ($uptime(system) > $iif($gettok(%uprecord,1,46),$ifmatch,0)) {
    say Uptime: $uptime(system,1) (RECORD) set today, $asctime($ctime,H:nn:ss dd/mm/yy)
    set %uprecord $+($uptime(system),.,$ctime)
  }
  else {
    say Uptime: $uptime(system,1) Best Uptime: $duration($gettok(%uprecord,1,46)) set on $asctime($gettok(%uprecord,2,46),H:nn:ss dd/mm/yy)
  }
}


Check out that code, and see if you can determine how it works. That should help you learn more about mIRC scripting.

-genius_at_work
Posted By: Massari Re: Uptime - 10/03/06 08:40 PM
Hey, thanks for the response, but I got some questions still.

Code:
Best Uptime: $duration($gettok(%uprecord,1,46)) set on $asctime($gettok(%uprecord,2,46),H:nn:ss dd/mm/yy) 


Okay, for that line, that stores the record uptime. but how? what does 1,46 mean? what does $duration, $gettok mean? and also whats the 2,6 :P Thanks
Posted By: DaveC Re: Uptime - 10/03/06 09:20 PM
try the help

/help $duration
/help $gettok

1,46 means the 1st token(chunk) in the string passed, chunks defined by slicing the string up using $chr(46) "." fullstop, example $gettok(qwe.rty.uio,1,46) = qwe
2,46 means 2nd token in the string passed, example $gettok(qwe.rty.uio,2,46) = rty
© mIRC Discussion Forums