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-01-2006, 08:48 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Latency?

I've wondered how to do this, and there doesnt appear to be any functions in gscript which return a ping or a latency value, so it appears i'd have to do it manually.

What would I have to do to get a function that returns a latency value? I was thinking along the lines of timing a file request through a for with a sleep .001 in it, and once the request is completed, the for would end and return the value. Not sure if this'd work with gscript though, as I think file requests are cached and I intend to use this alot.
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #2  
Old 06-01-2006, 05:51 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
I'm pretty sure it's possible - but how, I'm afraid I can't help you there.

Reason I think it's possible is that Atrius has it (bottom right), it reads it from a client.string (or maybe a clientr.string, I can't remember). How they did it though I don't know. Although yeah, it's possible.
__________________



Reply With Quote
  #3  
Old 06-01-2006, 07:09 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
You could try using timevar2, sending a triggeraction to the serverside, and comparing the timevars when it returns.

There used to be a decent Free script on graal.net I think Cybnext or someone made it.
Reply With Quote
  #4  
Old 06-01-2006, 07:16 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
http://www.graal.net/snippet/detail....=snippet&id=13
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 06-01-2006, 11:51 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
All that for a latency script? Wow. That'd be smaller in gs2, definately. I'll get working on coding my own function, and i'll post it when i'm done
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #6  
Old 06-02-2006, 02:16 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
That script is horribly formatted :x

Could probably have the same effect with something like:

PHP Code:
function onActionServerside() {
  if(
params[0] == "ping") {
    
player.triggerclient("gui""WEAPONNAME""pingreturn");
  }
}

//#CLIENTSIDE
function onActionClientside() {
  if(
params[0] == "pingreturn") {
    
client.ping timevar2 this.ping_sendtime;
  }
}

public function 
GetPing() {
  
this.ping_sendtime timevar2;
  
triggerserver("gui""WEAPONNAME""ping");

This sets the client.ping to their ping time. Untested, but should work.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 06-02-2006, 02:21 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes Okiesmokie script looks best, you can also type this.name instead of "WEAPONNAME" to make it easy to use.
Such pings are not very accurate though, since the scripts are only executed each 0.05 seconds on clientside (50 milliseconds), so you will never get higher or lower ping. But it is planned that we add a pinging funtion to clientside and serverside, to detect if something is too slow, to compare servers etc. The client will need to be modified to answer the ping immediatelly though.
Reply With Quote
  #8  
Old 06-02-2006, 09:36 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Stefan
Yes Okiesmokie script looks best, you can also type this.name instead of "WEAPONNAME" to make it easy to use.
Such pings are not very accurate though, since the scripts are only executed each 0.05 seconds on clientside (50 milliseconds), so you will never get higher or lower ping. But it is planned that we add a pinging funtion to clientside and serverside, to detect if something is too slow, to compare servers etc. The client will need to be modified to answer the ping immediatelly though.

Or to save space, just write 'name' instead of 'this.name'!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 06-03-2006, 04:44 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by xXziroXx
Or to save space, just write 'name' instead of 'this.name'!
Better hope you don't have any global variables called 'name' >: P
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #10  
Old 06-03-2006, 05:00 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by ApothiX
Better hope you don't have any global variables called 'name' >: P
Horrible thought!
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 07:37 AM.


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