Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-31-2001, 01:23 AM
JoMomma JoMomma is offline
Registered User
Join Date: Mar 2001
Posts: 43
JoMomma is on a distinguished road
Ok I can help you with the server time issue...

Currently, ALL servers (this includes non-pay servers) and clients have a build-in variable called "timevar". Every 5 seconds, timevar is incremented by 1 by the server. This is also saved by the server so that outages won't reset it :P

On Graal 2001 this is how they have it setup:
30 ticks = 1 hour
720 = 1 day
17280 = 1 month
414720 = 1 year

Now if you're a good scripter and want to do stuff with division to get each part, you'd probably want to do something like:

NPC Code:
this.time = timevar;
this.year = int(this.year/414720);



BZZT! Won't work... Once it gets up to about 1 month, you start getting floating point errors with division. I recommend something like this:

NPC Code:
for (this.year=1;this.time<414720;this.year++) {
this.time -= 414720;
}



Do the same thing for month, day, etc etc... Of course something like HOUR would need you to start off at 0 and not 1, cause it's military time. Oh, and if someone like Kyle or Tyhm doesn't like this type of code, well... it's the best I could think of to get beyond the division problems.

You may wanna put the time up too. You'd use:
NPC Code:
showimg 200,state.png,x,y;
changeimgpart 200,x,y,width,height;
changeimgvis 200,4;



changeimgvis with a parameter of 4 lets you display stuff LOCALLY and in a fixed position. This way it can act like a status bar. Also more importantly: it makes the x/y PIXEL values, and not CELL values. So it's not 64x64 anymore with that, but it IS what you need.

This should be all ya need to know.
__________________
Temporary disabled
Stefan Knorr
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 02:10 AM.


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