![]() |
timevar
Recently, I was looking for documents on "timevar". I could not find any documentations on timevar. Can someone explain it or find a documentation on it for me. (I already used search ;-)).
Possibly, just explain how you would get hours/minutes/seconds out of the big long variable. Maybe, if possible, someone can show me how to divide it correctly so it would be like hmm. Half Hour (irl) --> One day (Graal) I would TRULY appreciate if you can show me how this would be done. (thanks) |
Set to zero when server starts, increments every five seconds.
There are 60 seconds in a minute, 60 minutes in an hour and 24 hours in a day. If you can't figure it out from there, you need a new hobby. |
seconds = (timevar*5)%60;
minutes = int((timevar*5)/60)%60; hours = int((timevar*5)/(60*60))%24; days = int((timevar*5)/(60*60*24)); I believe? I'm not sure. I did this pretty fast. |
so would it be like:
NPC Code://#CLIENTSIDE Err, I probally can code it better. But I was just rushing, how is that? Is that every 30 min --> 1 graal day? Quote:
|
No. That's a direct conversion of.. 1 day = 1 graal day.
|
Quote:
|
Quote:
|
Quote:
|
Because not everybody is familier with programming theory.
|
Ah! Adam! You are the guilty person who gave the script! Note that I gave it before it was posted in real-time conversion... =3 Ohwell... I haven't heard much from you. Where've you been?
|
Quote:
|
It will most likely not have an impact -- Considering that it would only rise of one... The only cases that it would actually matter is if it was the last second required for the minute, hour, day, so on... And while that time, it would display an entire minute/hour/day - 5 seconds more. However... The likelihood of such occurance is very minimal, and the actual damage it may cause, depending on the situation, won't matter at all.
|
"timevar" is not changed in the middle of a script execution, so you can use that securely.
On serverside you also have the option to use "timevar2" which gives the seconds since Janurar 1st 1970, and is very precise (nano seconds), but might change between the call of two script functions, but you can still assign it to some temp variable before getting the seconds, minutes etc. |
Ohh! "timevar2" would actually be quite useful for finding the actual date...
Wait! How do we know how much seconds past since? Considering there are leap years, and well... The amount of days in a year is something like 365.245... |
Almost all languages have built in functions for doing this because it's a quite complicated process.
|
ALL!... Except Graal.
PHP Code:
|
It would be possible to add a function which returns the year, month, day of the year, day of the month, day of the week, hours, minutes, and seconds for a given unix time (timevar2 + 3600*timezone)
|
Quote:
EX If GMT in options --> -5:00 (Daylights Saving) then it would show automatically the time for that zone. I believe if you script something like this the time may change or be too fast/slow or just be quitely laggy. Not sure. Time would show: 7:52 PM (time i posted this --> Eastern Time) |
Or just make it a client var for people to change for their own timezone but make it so they cant change it >_> cause its not fun when you can only play at 8:00 on server time
and something shuts at 7 and ect. |
Quote:
Quote:
|
Quote:
I was just claiming, most people who script don't understand what it means to make a script clean and efficient. I just stopped by to see if anything was new, like usual. I'm playing another mmorpg (I'll be kind and not mention it on the forums of another mmorpg) But mostly I am working, and spending time with my girlfriend. I dont' have time for this anymore. AIM: RogueTCN I answer if i'm there. Your welcome to send a message even if it says i'm busy (which it does for days on end, even if i'm not there, or if I am there.) |
| All times are GMT +2. The time now is 01:23 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.