View Single Post
  #7  
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