Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-17-2009, 02:36 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
Joining classes first

There's an annoying delay between the time the onActionPlayerOnline function in the Control-NPC is called and when the classes are joined. That, or the level NPCs are called first (onPlayerEnters).

The problem is that this kind of thing happens in level NPCs that have an onPlayerEnters() function:

Quote:
Originally Posted by NC
Script: Function cbk1994.onStaffTag not found at line 7 of jail_level in script of npcs[16] (in level era_jail.nw at pos (29, 36))
Script: Function cbk1994.isStaff not found at line 7 of jail_level in script of npcs[16] (in level era_jail.nw at pos (29, 36))
Script: Function cbk1994.unstick not found at line 8 of jail_level in script of npcs[16] (in level era_jail.nw at pos (29, 36))
This is the onActionPlayerOnline function.

PHP Code:
function onActionPlayerOnline() {
  if (! (
player.account in serveroptions.staff.tokenize(","))) {
    
player.addWeapon("Temp/Server Warp");
    return; 
// goodbye, global news team
  
}
  
  
clientr.serversideReady false;
  
  
player.join("player_itemfunctions");
  
player.join("player");
  
player.join("player_staff");
  
player.join("player_hpfunctions");
  
  
player.loadPlayer();

As you can see, the player class is being joined almost at once.

I think that the server should wait up to five seconds for onActionPlayerOnline to complete and for all of the classes to join, and then trigger onPlayerEnters to level NPCs. This could also be extended to weapons so that they are not called before their items and such have been loaded.
__________________
Reply With Quote
  #2  
Old 05-17-2009, 04:18 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
Also clientside callstack, please?
Reply With Quote
  #3  
Old 06-21-2009, 12:15 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
Bump because I can't stress how important this is.
__________________
Reply With Quote
  #4  
Old 06-21-2009, 01:19 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
I added something like this on Maloria a while back, since I too was annoyed by it, and thought this might solve it. Note that it didn't.

PHP Code:
function onActionPlayerOnline()
{
  
// --- JOINING OF CLASSES
  
temp.class_list = {
    
"functions_misc",
    
"functions_stats",
    
"functions_skills",
    
"functions_items",
    
"functions_combat",
    
"functions_nations",
    
"player_system",
    
"player_initialize",
    
"quest_log"
  
};
  while (!
temp.isJoined) {
    
temp.isJoined true;
    
temp.attempts ++;
    
    for (
temp.class: temp.class_list) {
      
player.join(temp.class);
      if (!(
temp.class in player.joinedclasses))
        
temp.isJoined false;
    }
  }
  if (
temp.attempts 1)
    echo(
"[" player.account "] All classes joined after" SPC temp.attempts SPC "attempts!");

I still get errors whenever the client enters a level that might use a function that's supposed to be joined to a player.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 06-21-2009, 04:24 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 could be possible to force the onActionPlayerOnline to execute immediatelly at login, need to check this.
Reply With Quote
  #6  
Old 06-21-2009, 04:39 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
Quote:
Originally Posted by Stefan View Post
Hmmm it could be possible to force the onActionPlayerOnline to execute immediatelly at login, need to check this.
That would be absolutely wonderful.




sorry stefan
__________________
Reply With Quote
  #7  
Old 06-22-2009, 12:34 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 View Post
Hmmm it could be possible to force the onActionPlayerOnline to execute immediatelly at login, need to check this.
Would be very awesome.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #8  
Old 07-20-2009, 01:24 AM
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
Has Classic staff already tested if it's working fine?
Reply With Quote
  #9  
Old 07-20-2009, 06:18 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Stefan View Post
Has Classic staff already tested if it's working fine?
Just tested now,
a player class function is definately working straight after player.join("class"); in ActionPlayerOnline, and not before it (if I remember correctly player classes are no longer joined to the player object once they log out),
levels with scripts that call a player class function on entry aren't causing errors after logging in,
so I believe this is working.

Last edited by ffcmike; 07-20-2009 at 06:40 PM..
Reply With Quote
  #10  
Old 07-20-2009, 06:25 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 cbk1994 View Post
There's an annoying delay between the time the onActionPlayerOnline function in the Control-NPC is called and when the classes are joined. That, or the level NPCs are called first (onPlayerEnters).

The problem is that this kind of thing happens in level NPCs that have an onPlayerEnters() function:



This is the onActionPlayerOnline function.

PHP Code:
function onActionPlayerOnline() {
  if (! (
player.account in serveroptions.staff.tokenize(","))) {
    
player.addWeapon("Temp/Server Warp");
    return; 
// goodbye, global news team
  
}
  
  
clientr.serversideReady false;
  
  
player.join("player_itemfunctions");
  
player.join("player");
  
player.join("player_staff");
  
player.join("player_hpfunctions");
  
  
player.loadPlayer();

As you can see, the player class is being joined almost at once.

I think that the server should wait up to five seconds for onActionPlayerOnline to complete and for all of the classes to join, and then trigger onPlayerEnters to level NPCs. This could also be extended to weapons so that they are not called before their items and such have been loaded.
Hmm you can't put the loadPlayer() stuff in the onCreated() class of the last joined class? I do this on Rudora and it works fine, since onCreated() is called in the class when it is joined to the player.
__________________
Skyld
Reply With Quote
  #11  
Old 07-20-2009, 09:31 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
Quote:
Originally Posted by Skyld View Post
Hmm you can't put the loadPlayer() stuff in the onCreated() class of the last joined class? I do this on Rudora and it works fine, since onCreated() is called in the class when it is joined to the player.
I'm sure that would work just as well, but there is no advantage to it, and it would not solve this problem; loadPlayer() is only loading their items, not adding any functions.


Glad to hear that this is working on Classic, hopefully this can be enabled soon for other servers.
__________________
Reply With Quote
  #12  
Old 08-09-2009, 05:42 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
Any ETA for other servers? I haven't noticed this in a while, though, so perhaps it's already been done?
__________________
Reply With Quote
  #13  
Old 08-10-2009, 03: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
It has not been enabled yet on other servers but can be done soon.
Reply With Quote
  #14  
Old 08-10-2009, 05:40 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 View Post
It has not been enabled yet on other servers but can be done soon.
I beg of you, hurry!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #15  
Old 09-19-2009, 02:28 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I'm getting a similar issue except with classes that are joined to the player clientside, it had been working fine for myself, but then I realised there was a large delay involved before the player functions could be called by players with a slow connection/high ping, which is understandable, but something which could cause alot of problems.

Any possibility this could be rectified in the next client version?
Reply With Quote
  #16  
Old 09-19-2009, 02:31 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
Quote:
Originally Posted by ffcmike View Post
I'm getting a similar issue except with classes that are joined to the player clientside, it had been working fine for myself, but then I realised there was a large delay involved before the player functions could be called by players with a slow connection/high ping, which is understandable, but something which could cause alot of problems.

Any possibility this could be rectified in the next client version?
There's really no way to fix this. I'd recommend having some kind of "player.isReady" variable (clientside), and set that to true once the class is loaded.
__________________
Reply With Quote
  #17  
Old 09-19-2009, 03:23 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I've done some experimenting with the joinedclasses variable, seems the class names immediately get added before the class has actually loaded, and I can't seem to get any type of success with the onClassLoaded function, whether it be within a weapon or the class script itself, same for onCreated within the clientside class script, they just don't seem to occur, otherwise that's probably what I would do.
Reply With Quote
  #18  
Old 09-19-2009, 05:40 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
Quote:
Originally Posted by ffcmike View Post
I've done some experimenting with the joinedclasses variable, seems the class names immediately get added before the class has actually loaded, and I can't seem to get any type of success with the onClassLoaded function, whether it be within a weapon or the class script itself, same for onCreated within the clientside class script, they just don't seem to occur, otherwise that's probably what I would do.
An onCreated() event in the class clientside should be okay.
__________________
Reply With Quote
  #19  
Old 09-20-2009, 06:27 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by cbk1994 View Post
An onCreated() event in the class clientside should be okay.
I've read that it should work before, but it doesn't, not sure if this is something specific to Classic or having the same class joined to the player serverside affects it.

Totally forgot I could just do player.hasfunction(""); though.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:42 AM.


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