Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-19-2008, 02:41 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
Getting a player's local time

Like their timezone, date AM/PM. How do you get this ?
Reply With Quote
  #2  
Old 06-19-2008, 03:48 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Stryke View Post
Like their timezone, date AM/PM. How do you get this ?
Ask them.

Look in the code gallery, Hell Raven made a function to get the time using timevar2 serverside ... you would have to adjust that clientside to get the time.
__________________
Reply With Quote
  #3  
Old 06-19-2008, 12:19 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
What do you need it for though?
__________________
Reply With Quote
  #4  
Old 06-19-2008, 12:46 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Stryke View Post
Like their timezone, date AM/PM. How do you get this ?
On Mac and Linux versions of Graal, timevar2 reveals the UNIX time (seconds since midnight Jan 1st 1970) of the current player's computer, from which you can calculate their real time. The problem is that on Windows, timevar2 doesn't work the same I don't think, it is instead counting the number of seconds since the client was opened which isn't that helpful.

I guess if needs be, you could always present some sort of dialog box to users asking for their timezone and then work it out serverside using some offset.
Reply With Quote
  #5  
Old 06-19-2008, 02:57 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Skyld View Post
On Mac and Linux versions of Graal, timevar2 reveals the UNIX time (seconds since midnight Jan 1st 1970) of the current player's computer, from which you can calculate their real time. The problem is that on Windows, timevar2 doesn't work the same I don't think, it is instead counting the number of seconds since the client was opened which isn't that helpful.

I guess if needs be, you could always present some sort of dialog box to users asking for their timezone and then work it out serverside using some offset.
Doesn't need to be done serverside, at least not if it doesn't have to be exact. You could do it using timevar, which is synced between client and server. Only increments by 1 every 5 seconds, but hey, that should be enough ;D
Reply With Quote
  #6  
Old 08-06-2008, 10:06 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Crow View Post
Doesn't need to be done serverside, at least not if it doesn't have to be exact. You could do it using timevar, which is synced between client and server. Only increments by 1 every 5 seconds, but hey, that should be enough ;D
only for time and not date, since you don't have a reference point of what day that var is counting from

And yes, I bumped this, it seemed like a good point to make
__________________

Last edited by Kristi; 08-06-2008 at 10:21 PM..
Reply With Quote
  #7  
Old 08-06-2008, 10:24 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Kristi View Post
only for time and not date, since you don't have a reference point of what day that var is counting from

And yes, I bumped this, it seemed like a good point to make
Quote:
Originally Posted by wiki.graal.net
timevar integer (read only) A timer which is increased each 5 seconds and is snychronized between server and clients; The timer started exactly on 2001-02-01 at 18:33:34 Paris time (opening of Graal2001); on serverside the unixtime (timevar2) is around 981048814 + timevar*5
I dunno, that looks like a pretty precise reference point to me.
Reply With Quote
  #8  
Old 08-06-2008, 10:26 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Crow View Post
I dunno, that looks like a pretty precise reference point to me.
Go figure, cool I guess

I should go update the time script to reflect that (then it would work clientside)
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.