View Single Post
  #4  
Old 01-01-2011, 11:35 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
Thanks for the quick response, you two
Quote:
Originally Posted by cbk1994 View Post
"//#Clientside" should be all caps, not sure if it matters but it really ought to be.
So that's why the simple script I used to test getCategories() worked, it wasn't Clientside but serverside.

getCategories looks like a serverside function so you have to trigger to the serverside part of the script, then trigger back to clientside.

In order to do player.getCategories, it would have to be in a class joined to the player. You would still have to use it serverside.
[/QUOTE]
That's how I've done it.
Quote:
Originally Posted by cbk1994 View Post
getCategories looks like a serverside function so you have to trigger to the serverside part of the script, then trigger back to clientside.
So do I have to use triggeraction? Is there no easier way to pass a variable vom Serverside to Clientside?
Something like this would be nice...
NPC Code:
 function getLocalCategories() {
return player.getCategories();
}
//#CLIENTSIDE
function onCreated() {
this.setshape(1,32,64);
this.chat="Touch me to find out how many categories you have";

}
function onPlayerTouchsMe() {
temp.categories = this.getLocalCategories();
this.chat=temp.categories.size() @ " , " @ temp.categories[0][0] ;
}


Or do I have to use triggeraction? I never used it, as I'm pretty new to Graalscript.
In the wiki, triggeraction is declared as triggeraction(float x, float y, str eventname, params...) . Can I even use arrays for the params?
Reply With Quote