Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Player clientside class functions (https://forums.graalonline.com/forums/showthread.php?t=63339)

Tom 01-10-2006 07:41 PM

Player clientside class functions
 
In working with Relic, I have encountered numerous programming problems that I do believe shouldn't have bothered me, but has!

For instance, player.func() defined in the ( serverside ) join command with a clientside segment doesn't work:

Example:

PHP Code:

Class pfunc:

function 
onCreated()
{
  echo(
"Class DID join");
}

//#CLIENTSIDE

public function test() 
{
this.chat "test"


PHP Code:

Weapon anything:

function 
onCreated()
{
  
player.join("pfunc");
}

//#CLIENTSIDE

function onCreated()
{
  
player.test(); // GraalScript: Function test not found in script of Weapon anything
  
player.pfunc::test(); // GraalScript: Function test not found in script of Weapon anything


As seen in these codes, the player class does not actually carry over the class functions...

ApothiX 01-10-2006 08:06 PM

Quote:

Originally Posted by Tom
In working with Relic, I have encountered numerous programming problems that I do believe shouldn't have bothered me, but has!

For instance, player.func() defined in the ( serverside ) join command with a clientside segment doesn't work:

Example:

PHP Code:

Class pfunc:

function 
onCreated()
{
  echo(
"Class DID join");
}

//#CLIENTSIDE

public function test() 
{
this.chat "test"


PHP Code:

Weapon anything:

function 
onCreated()
{
  
player.join("pfunc");
}

//#CLIENTSIDE

function onCreated()
{
  
player.test(); // GraalScript: Function test not found in script of Weapon anything
  
player.pfunc::test(); // GraalScript: Function test not found in script of Weapon anything


As seen in these codes, the player class does not actually carry over the class functions...

onCreated() serverside is called when the WNPC is updated. onCreated() clientside is called when the player logs into the server (or receives the weapon.) The only way your script would function correctly would be if you hit the update button the exact milisecond the player logs in, before onCreated() clientside is called.

Tom 01-10-2006 08:09 PM

Unless, of course, in the testing of this, you updated the weapon, and thus, joined before it actually tested.

onCreated clientside is activated AS the weapon is updated. So is the serverside, thereby, in the debugging purpose, it still is a valid argument.

ApothiX 01-10-2006 08:11 PM

Quote:

Originally Posted by Tom
Unless, of course, in the testing of this, you updated the weapon, and thus, joined before it actually tested.

onCreated clientside is activated AS the weapon is updated. So is the serverside, thereby, in the debugging purpose, it still is a valid argument.

Just for the hell of it, try:

PHP Code:

function onActionserverside(cmd) {
  if(
cmd=="created") {
    
player.join("classname");
    
triggeraction(00"clientside""WEAPONNAME""created");
  }
}

//#CLIENTSIDE
function onCreated() {
  
triggeraction(00"serverside""WEAPONNAME""created");
}

function 
onActionclientside(cmd) {
  if(
cmd=="created") {
    
player.functionname();
  }



Tom 01-10-2006 08:27 PM

As I say... It doesn't work.

ApothiX 01-10-2006 08:30 PM

Quote:

Originally Posted by Tom
As I say... It doesn't work.

Odd. Clientside class functions work fine in my mudlib :confused:

Yen 01-10-2006 09:49 PM

They never did for me. :/
Or triggering the class, rather.

Admins 01-11-2006 01:17 PM

I don't think this will work, only npcs have clientside scripts. But there is already something for this purpose, the weapons/GUI scripts.


All times are GMT +2. The time now is 08:11 PM.

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