mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2003
Posts: 342
M
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
Is there anyway to get $ctime with 1/1000th seconds like the JavaScript function getTime()? Thru a COM object or some other means? I'm currently writing a script that displays the active time in FFXI... and this would help a lot.

Thanks


Beware of MeStinkBAD! He knows more than he actually does!
Joined: Dec 2002
Posts: 397
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
isnt $ticks 1/1000th of a secend?


Need amazing web design for low price: http://www.matrixn3t.net
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I think they want something that is like $ctime but not in seconds, ie, $calc($ttime / 1000) would give something like $ctime, but with a decimal representing 1/1000th of a second.

$ttime being "ticks time", just something I made up

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Just use $ctime and append the last 3 digits from $ticks for the millisecond value. It won't be the actual millisecond value for ctime but from what you're saying it doesn't sound like you actually need that.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Apr 2003
Posts: 342
M
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
Well.. that's what I do at the moment... here's what I have...
Code:
  var %vlocaltime = $calc((898 * 360 + 30) * 24 * 60 * 60 * 1000 / 25)
  var %Bday = $calc($ctime(23/06/2002 8:00:03) * 1000) 
  var %diff = $calc(%vlocaltime - %Bday)
  var %eTime = $calc($ctime * 1000)


Actually I did come up with a semi-solution but it's not working out exactly as I had hoped...


Code:
  var %ctime = $ctime
  while (%ctime == $ctime) { }
  %p.msec.inc = 0
  .timer.msec.inc -cho 0 5 /inc % $+ p.msec.inc 5 $:| if (% $+ p.msec.inc > 999) % $+ p.msec.inc = 0


I then add %p.msec.inc to $ctime * 1000 and I get the difference in msecs.

Here is all the code I have so far... I'm sorry for the lack of comments... I'll add them later...

Code:
  ;-- Creates Weekly array table
  if !$hget(FFXI.VanaDay) {
    hmake FFXI.VanaDay 9
    hadd FFXI.VanaDay n0 Fire
    hadd FFXI.VanaDay n1 Earth
    hadd FFXI.VanaDay n2 Water
    hadd FFXI.VanaDay n3 Wind
    hadd FFXI.VanaDay n4 Ice
    hadd FFXI.VanaDay n5 Thunder
    hadd FFXI.VanaDay n6 Light
    hadd FFXI.VanaDay n7 Darkness
    hadd FFXI.VanaDay n8 Fire
  }
  ; -- Get's curent and vlocal time
  var %vlocaltime = $calc((898 * 360 + 30) * 24 * 60 * 60 * 1000 / 25)
  var %Bday = $calc($ctime(23/06/2002 8:00:03) * 1000 + %p.msec.inc) 
  var %diff = $calc(%vlocaltime - %Bday)
  var %eTime = $calc($ctime * 1000 + %p.msec.inc)
  ; -- difference between earth time a Vanatime
  var %vTime = $calc((%eTime + %Diff) * 25)
  ; -- calculates the year/month/day etc 
  var %vYear = $base($floor($calc(%vTime / (360 * 24 * 60 * 60 * 1000))),10,10,4)
  var %vMon  = $base($floor($calc((%vTime % (360 * 24 * 60 * 60 * 1000)) / (30 * 24 * 60 * 60 * 1000) + 1)),10,10,2)
  var %vDate = $base($floor($calc((%vTime % (30 * 24 * 60 * 60 * 1000)) / (24 * 60 * 60 * 1000) + 1)),10,10,2)
  var %vHour = $base($floor($calc((%vTime % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000))),10,10,2)
  var %vMin  = $base($floor($calc((%vTime % (60 * 60 * 1000)) / (60 * 1000))),10,10,2)
  var %vSec  = $base($floor($calc((%vTime % (60 * 1000)) / 1000)),10,10,2)
  var %vDay  = $floor($calc((%vTime % (8 * 24 * 60 * 60 * 1000)) / (24 * 60 * 60 * 1000)))
  ; -- output text
  var %VanaTxt = $+(%vYear,/,%vMon,/,%vDate,$chr(40),$hget(FFXI.VanaDay,$+(n,%vDay)),$chr(41)) $+(%vHour,:,%vMin,:,%vSec)
  ;-- appends output variable
  %p.tb = %p.tb - $+([,%VanaTxt,])



Beware of MeStinkBAD! He knows more than he actually does!
Joined: Sep 2003
Posts: 98
N
Babel fish
Offline
Babel fish
N
Joined: Sep 2003
Posts: 98
what is that you are doing anyway ?


www.stwar.us.to
IRCnet - #stwar

Link Copied to Clipboard