Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-15-2009, 07:08 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
function onPlayerChats() delayed if there is an onTimeout() in the script

It seems that if you have the onPlayerChats() event in a script and an onTimeout() event, there is a slight delay when the function is called. It might be just me, but I'm not sure, so I decided to post it here.

If you have just the following below, the player's chat will be set to "" just fine without any delay.
PHP Code:
function onPlayerChats()
{
  if (
player.chat == "/test")
  {
    
player.chat "";
  }

However, if you have this:
PHP Code:
function onCreated()
{
  
setTimer(.05);
}

function 
onTimeout()
{
  
//doesn't even need code here
  
setTimer(.05);
}

function 
onPlayerChats()
{
  if (
player.chat == "/test")
  {
    
player.chat "";
  }

The above code will have a slight delay for onPlayerChats() to be called.

Well, there is a workaround for this by just putting the onPlayerChats event into a different WNPC, however i'd still like this fixed.
Reply With Quote
  #2  
Old 05-15-2009, 07:09 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Yeap, I noticed this several times, I just got used to putting playerchat events in an entirely different script.

I'd love to see this fixed.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 05-15-2009, 01:53 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Tigairius View Post
Yeap, I noticed this several times, I just got used to putting playerchat events in an entirely different script.

I'd love to see this fixed.
Same here.
__________________
Reply With Quote
  #4  
Old 05-15-2009, 08:41 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
Could you make some tests, printing the time when the onPlayerchats() event is invoked, with two weapos one with timeout one without?
Reply With Quote
  #5  
Old 05-16-2009, 01:55 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I can also confirm this happens.

Though, as a side note, you can use ChatBar.onAction() and you should be able to catch it before the player chats.
__________________
Reply With Quote
  #6  
Old 05-16-2009, 05:11 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Stefan View Post
Could you make some tests, printing the time when the onPlayerchats() event is invoked, with two weapos one with timeout one without?
It's consistently about 50ms apart for an empty timeout loop.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 05-16-2009, 05:40 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
Hmmm it might indeed be a problem of ChatBar.onAction(), which is handled by the -Serverlist script which is then invoking an onPlayerChat event. Scripts that are already active (timeout) receive the event but since their onTimeout was already executed they will have to wait until the next frame. This is not a perfect situation but normally for chat commands it's not important to be executed 0.05 seconds sooner or later, so the question is if this need to be fixed? It might be a bigger problem for other cases, like triggers.
Reply With Quote
  #8  
Old 05-16-2009, 07:01 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Stefan View Post
so the question is if this need to be fixed? It might be a bigger problem for other cases, like triggers.
Well, the biggest problem is that if you do
PHP Code:
//#CLIENTSIDE
function onTimeout() {
  
setTimer(0.05);
}
function 
onPlayerChats() {
  if (
player.chat == "test") {
    
player.chat "";
  }

the player's chat won't clear serverside if there is a timeout clientside. So, for example, if you wanted to have a hidden command somewhere, you couldn't because everyone could see your chat anyways.

Just like on GK now, /commands only clear clientside, everyone serverside can still see what you said.

There are of course other problems resulting from this, I think it would be great to have it fixed. It would also be neat to see clientside timeouts sped up a little bit to handle faster times in the new client.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #9  
Old 05-16-2009, 08:38 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
For making chat disappear (Tig's problem), you can use either

PHP Code:
shared.chat("");
// or
player.chat " "
but there will still be a delay if there's a timeout. Best to use ChatBar.onAction rather than onPlayerChats() for that anyway.
__________________
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 03:16 PM.


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