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
  #16  
Old 08-01-2007, 08:33 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by coreys View Post
He's Twinny. He get what he wants.
Or else.
Doubt it. Seems common perception that I'm a Graal terrorist. I probably can't request anything now .
Reply With Quote
  #17  
Old 08-01-2007, 09:21 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Well that's just stupid.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #18  
Old 08-01-2007, 10:49 AM
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
On Windows, timevar2 is the number of seconds since the client was opened.
On Linux/Mac, it is the number of seconds since 1st January 1970 (see UNIX time).

On the serverside, timevar2 is representing the time in France I guess, while on the clientside on Linux/Mac, it is representing the local timezone.

If it is important that your time is the same for every user, then run your calculations serverside, since Linux/Mac users will get time relevant to their timezone, and Windows users will get something altogether completely different.
__________________
Skyld
Reply With Quote
  #19  
Old 08-01-2007, 11:11 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva


This will let you have the accuracy of timevar2, while keeping your time the same as everyone elses(though I haven't tested it with others to compare the time).

PHP Code:
function onActionserverside() {
  if (
params[0]=="getdiff") {
    
temp.timedifference=timevar2-params[1];
    
triggerclient("gui",name,"senddiff",temp.timedifference);
  }
}


//#CLIENTSIDE

function onCreated() {
  
triggerserver("gui",name,"getdiff",timevar2);
}

function 
onActionclientside() {
  if (
params[0]=="senddiff") {
    
this.timedifference=params[1];
    
onTimeout();
  }
}

function 
onTimeout() {
  
temp.time=timevar2+this.timedifference;

  
setTimer(0.05);


Last edited by DustyPorViva; 08-01-2007 at 12:12 PM..
Reply With Quote
  #20  
Old 08-01-2007, 12:09 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Geez, just have a serversided DB calculate the time every second and set it as serverr variable(s) then have the clientsided system read those
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #21  
Old 08-01-2007, 12:11 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
serverside variables are the bane!!!!
Reply With Quote
  #22  
Old 08-01-2007, 12:17 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 DustyPorViva View Post
serverside variables are the bane!!!!
What?
__________________
Skyld
Reply With Quote
  #23  
Old 08-01-2007, 12:18 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Nothing, I just try to avoid server.variables as I've always been told they can 'cause a bit of lag or some such when they pile up.
Either way I don't see the need of constantly transferring serverside timevar2 when you can just sync it with the clientside timevar2
Reply With Quote
  #24  
Old 08-01-2007, 12:21 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 DustyPorViva View Post
Nothing, I just try to avoid server.variables as I've always been told they can 'cause a bit of lag or some such when they pile up.
Either way I don't see the need of constantly transferring serverside timevar2 when you can just sync it with the clientside timevar2
There is no problem using serverr. variables when scripts on the clientside are actually making use of them. However, you should think about what information really needs to be sent over to the clientside for regular use, and not use serverr. variables for things that you can put into database NPCs, for example.
__________________
Skyld
Reply With Quote
  #25  
Old 08-01-2007, 04:56 PM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
im avoiding servside timeouts because i was told they lag xP
Reply With Quote
  #26  
Old 08-01-2007, 08:38 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by HolySheepy View Post
im avoiding servside timeouts because i was told they lag xP
...Only when you're doing a very large amount of work every .05 seconds...

And Dusty, why bother doing that if you can just do everything serverside in a DB NPC or a weapon.

PHP Code:
function onCreated() {
  
getTime();
  
timeFlags();
  
onTimeOut();
}
function 
onTimeOut() {
  
getTime();
  
timeFlags();
  
setTimer(1);
}
function 
getTime() {
  
this.t_var int(timevar2); 
  
this.t_second int(this.t_var%60); 
  
this.t_minute int((this.t_var/60)%60); 
  
this.t_hour int(((this.t_var/60)/60)%24); 
}
function 
timeFlags() {{
  
serverr.time.second this.t_second;
  
serverr.time.minute this.t_minute;
  
serverr.time.hour this.t_hour;
  
serverr.time.stamp getTimeStamp();
}
public function 
getTimeStamp() {
  if (
serverr.time.second == NULL
    
temp.second "0";
  else 
    
temp.second serverr.time.second;
  if (
serverr.time.minute == NULL
    
temp.minute "0";
  else 
    
temp.minute serverr.time.minute;
    
  if (
serverr.time.hour == NULL) {
    
temp.hour 12;
    
temp.hour temp.hour ":" temp.minute ":" temp.second "AM";
  }
  
  else if (
serverr.time.hour 12) {
    
temp.hour serverr.time.hour-12;
    
temp.hour temp.hour ":" temp.minute ":" temp.second "PM";
  }
  
  else 
temp.hour serverr.time.hour ":" temp.minute ":" temp.second "AM";
  
temp.timestamp serverr.time.month SPC serverr.time.day ", " serverr.time.year SPC temp.hour SPC "CST";
  
  return 
temp.timestamp;

Ziro originally showed me how to do those time calculations, but I lost 'em a while back and I had to figure it out on my own.

Anyways...
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #27  
Old 08-01-2007, 08:44 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Because then there's no need to transfer data between the client and server. The way I did it, the only time information is sent is once, from then on it uses comparison to retrieve the same time as everyone else, all on the clientside.
It's just more convenient to have something like the time on the clientside for fast and smooth access, since most things related to time(seteffect, lights) are on the clientside.
Reply With Quote
  #28  
Old 08-01-2007, 10:52 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Serverside timeouts are 0.1 seconds minimum.
__________________
Reply With Quote
  #29  
Old 08-01-2007, 10:58 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Inverness View Post
Serverside timeouts are 0.1 seconds minimum.
Everyone's been telling me 0.5. -/-
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #30  
Old 08-01-2007, 11:09 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by DustyPorViva View Post
Because then there's no need to transfer data between the client and server. The way I did it, the only time information is sent is once, from then on it uses comparison to retrieve the same time as everyone else, all on the clientside.
It's just more convenient to have something like the time on the clientside for fast and smooth access, since most things related to time(seteffect, lights) are on the clientside.
Serverr. strings never actually gets transfered between the client and the server, they are just serversided variables that can be read on the clientside.

Quote:
Originally Posted by Inverness View Post
Serverside timeouts are 0.1 seconds minimum.
Correct.

Quote:
Originally Posted by killerogue View Post
Everyone's been telling me 0.5. -/-
Wrong.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
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 04:20 PM.


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