Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   calling public functions (https://forums.graalonline.com/forums/showthread.php?t=64323)

Prozac 02-24-2006 06:18 AM

calling public functions
 
So, in a weapon npc, i have this serverside:

PHP Code:

public function itemDesc()
{
 
this.msg="This is an item description";
 return 
this.msg;


then the player has the weapon, and I want a gui text window object called item_desc_text (necesarrily clientside) to get the text from the public function call, but all it returns is 0:

PHP Code:

item_desc_text.text=weapon-name.itemDesc(); 

so, what is the propper procedure to call a public function in a weapon, and have it return information to you/perform actions through another weapon (clientside or serverside etc)?

Rick 02-24-2006 06:29 AM

You can't call serverside functions clientside.

My suggestion:

PHP Code:

// In your weapon
function onActionServerside()
{
  
player.triggerclient(params[0], this.namethis.itemDesc());
}

// In your GUI script
//#CLIENTSIDE
function onCreated() // or whatever...
{
  
triggeraction(00"serverside"weaponname.namethis.name);
}

function 
onActionClientside()
{
  
item_desc_text.text params[1];



Prozac 02-24-2006 06:54 AM

Most excellent! thank you!
(wants a wiki "quick refrence card" like they have in the Windows for Dummies books. Perhaps there could be a Gs2 for Dummies eBook? ah yes the graal bible and wikis ... but thats Gs2 for people who already know how to script and program. Stefan, hire a technical writer for a week to get the wiki finally done right please ... i look forward to all the description fields being filled in)

ApothiX 02-24-2006 02:59 PM

I fail to see how this problem has anything to do with the incompleteness of the wiki. Also, this has been said many times before, but: If you want the wiki to be complete, add things to it.

Prozac 02-24-2006 06:46 PM

Quote:

Originally Posted by ApothiX
If you want the wiki to be complete, add things to it.

BUT what if i add something that turns out to be wong?
that would be .. hm whats that phase you have posted on several occasions .. DON'T GIVE BAD ADVICE!
and i dont want to get yelled at for giving bad advice, even if i was sure the advice was good, but it turned out not to be good.

congradulations apothix, your general attitude has scared me off from adding anything to the wiki.

ZeLpH_MyStiK 02-25-2006 03:32 AM

Quote:

Originally Posted by Prozac
BUT what if i add something that turns out to be wong?
that would be .. hm whats that phase you have posted on several occasions .. DON'T GIVE BAD ADVICE!
and i dont want to get yelled at for giving bad advice, even if i was sure the advice was good, but it turned out not to be good.

congradulations apothix, your general attitude has scared me off from adding anything to the wiki.

That's why there is an edit button on it. =O
But if you're gonna add something, make it is accurate to the best of your knowledge.

Prozac 02-25-2006 04:23 AM

There is a ton of accurate stuff on the wiki already.
the part (that from what i hear Stefan is working on) is making that knowledge USEFUL to people who are new to, or learning, the new language by describing what the functions, paramaters, etc actually do. but wait I've ranted on and on about this for months so i will stop now


All times are GMT +2. The time now is 02:48 AM.

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