Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   does triggerserver work in classes? (originally named "does...") (https://forums.graalonline.com/forums/showthread.php?t=79239)

Frankie 03-30-2008 01:46 AM

does triggerserver work in classes? (originally named "does...")
 
does triggerserver work in classes?

something really simple like this doesn't even work so I'm assuming it doesn't work in classes :X


PHP Code:

function onActionServerSide()
{
  
message("hi");
}
//#CLIENTSIDE
function onPlayerChats()
{
  if (
player.chat == "hi")
  {
    
triggerserver("weapon"this.name"");
  }


I always thought it did

Deas_Voice 03-30-2008 01:49 AM

where is this class joined?

Crow 03-30-2008 01:51 AM

PHP Code:

function onActionStuff() {
  echo(
"Somebody just trigered a test class! Odamn..");
}

function 
onCreated() {
  
setshape(13232);
  
dontblock();
}

//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
  
dontblock();
  
  
triggeraction(this.xthis.y"Stuff"NULL);


Don't use "ServerSide" as the action name, this wont work. I'm also not sure if the shape on the clientside is needed, I just always do it :)


Edit: Neo also has a valid point. If it's joined into a weapon, it should work.

Frankie 03-30-2008 01:51 AM

in a level
I'm assuming I have to use triggeraction instead because of that?

ohi crow, didn't see your post yet

cbk1994 03-30-2008 01:56 AM

Yes, it works if you triggeraction with a seperate name then ServerSide (onActionServerSide will not work). For ones that are joined to NPCS/Weapons, triggerserver will work fine.

Also, you should use name instead of this.name, there are cases when it will return something invalid, or so I have been told. Someone feel free to correct me.

Crow 03-30-2008 02:02 AM

Quote:

Originally Posted by cbkbud (Post 1383131)
Also, you should use name instead of this.name, there are cases when it will return something invalid, or so I have been told. Someone feel free to correct me.

Never had any problems with this.name.

Tigairius 03-30-2008 02:18 AM

Quote:

Originally Posted by cbkbud (Post 1383131)
Also, you should use name instead of this.name, there are cases when it will return something invalid, or so I have been told. Someone feel free to correct me.

Probably some inexperienced scripter who was trying to get this.name inside of another object when (s)he should have been using thiso.name

cbk1994 03-30-2008 03:23 AM

Quote:

Originally Posted by Tigairius (Post 1383137)
Probably some inexperienced scripter who was trying to get this.name inside of another object when (s)he should have been using thiso.name

I've heard people on the forums mention this, in any case, if this.name works, use it!

I'm just going to use name since it is less typing ...

zokemon 03-30-2008 03:28 AM

I said that in Sidney's post. You should avoid this.name in most cases and use either thiso.name or just plain name as this.name might be overridden by a function call by another object. Only really matters with public functions and function calls inside a with block though.

[email protected] 04-02-2008 07:18 PM

me? i did not post

Tigairius 04-02-2008 07:24 PM

Quote:

Originally Posted by [email protected] (Post 1383719)
me? i did not post

He's referring to a different thread :)

[email protected] 04-02-2008 07:58 PM

oh ok!!! :):):)

Switch 04-03-2008 01:16 AM

Quote:

Originally Posted by Crow (Post 1383129)
I'm also not sure if the shape on the clientside is needed, I just always do it :)

I don't think it is...

Crow 04-03-2008 02:57 PM

Quote:

Originally Posted by Switch (Post 1383795)
I don't think it is...

Oh well, I dont care myself. Only eats a single line.


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

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