Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   And Now Triggerclient not working? (https://forums.graalonline.com/forums/showthread.php?t=74630)

killerogue 06-16-2007 07:18 PM

And Now Triggerclient not working?
 
This basically has to do the same thing with my last thread, in which I got a working answer too. Almost everything inside the system I'm making is serverside. The only Clientsided part needed triggeraction refuses to work inside the class apparently. And so I'm forced to use triggerclient.

Weapon:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
Main this;
}

function 
onPlayerChats() {
  if (
player.chat.trim() == "/reconnect") {
    
serverwarp("Maloria");
  }
}

public function 
onActionClientside() {
  echo (
"Hey I've been found!");
}

public function 
setAni2(planianiparam1aniparam2aniparam3) {
  echo (
"rock me");


Class:
PHP Code:

public function execute(caster) {
  
temp.plyr 0;
  
this.account caster;
  
  
plyr findPlayer(this.account);
  echo (
plyr.account);
  
plyr.triggerclient("weapon""systemMain""");


Calling Weapon:
PHP Code:

function onCreated() {
  
pl findPlayer("Chandler");
  
pl.mud.spelllist[0].execute(pl.account);



I know for a fact, the player has the weapon and the proper account is being echoed to RC before the trigger. What's the dealio bro? :O

Novo 06-16-2007 07:43 PM

Only problem I see is:

PHP Code:

  plyr.triggerclient("weapon""systemMain"""); 

should be

PHP Code:

with plyr )
{
  
triggerclient("weapon""systemMain"""); 



JkWhoSaysNi 06-16-2007 08:18 PM

Novo, those should do exactly the same.

What if you use "gui" instead of "weapon".

I can't remember what the difference is.

Inverness 06-16-2007 08:43 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1318637)
I can't remember what the difference is.

Probably cause there isn't one, or so Stefan says. Try using at least one parameter for triggerClient(), for all we know (lack of documentation) it could only work if you have a parameter.

zokemon 06-16-2007 09:25 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1318637)
Novo, those should do exactly the same.

What if you use "gui" instead of "weapon".

I can't remember what the difference is.

The should do the same thing but I never seem to be able to get obj.triggerclient(); to work. I always have to do with (obj) triggerclient(); instead.

killerogue 06-16-2007 10:37 PM

Well, Chompy actually figured the problem out. The echo clientside wasn't working therefore leading me to believe the triggerclient wasn't working even using with() (which we ended up using :p).

So it works now, thanks anyway guys. :D

Inverness 06-16-2007 11:22 PM

Using with on a player is kinda different because it changes the calling player rather than change object scope, thats how I think of it. Leftovers from GS1 or so. I always use with for changing the calling player.

Gambet 06-17-2007 01:14 AM

Quote:

Originally Posted by Novo (Post 1318633)
should be

PHP Code:

with plyr )
{
  
triggerclient("weapon""systemMain"""); 




Quote:

Originally Posted by zokemon (Post 1318669)
The should do the same thing but I never seem to be able to get obj.triggerclient(); to work. I always have to do with (obj) triggerclient(); instead.


You use with() only when you're trying to call a function to a player that is not a player function. For player functions, you do obj.function, which in this case plyr.triggerclient() would be correct.

Twinny 06-17-2007 02:22 AM

I've always done plyr.triggerclient(). Works in for (pl : players) as well on the pl object.

Inverness 06-17-2007 02:42 AM

Quote:

Originally Posted by Gambet (Post 1318749)
You use with() only when you're trying to call a function to a player that is not a player function. For player functions, you do obj.function, which in this case plyr.triggerclient() would be correct.

triggerclient() is not a function of the player object, it just requires a calling player.

I believe Graal considers the dot no different than with, it works different ways depending on what you use with it.

Twinny 06-17-2007 03:12 AM

Indeed. The only trigger functions within a player object is trigger() :D

Inverness 06-17-2007 04:29 AM

Quote:

Originally Posted by Twinny (Post 1318777)
Indeed. The only trigger functions within a player object is trigger() :D

I think thats because its in TGraalVar, right?

Twinny 06-17-2007 05:15 AM

I'm not sure..the only inheritance for Tserverplayer that I can find ont he wiki is tganiobject :x. I could only find the clientside reference though...

zokemon 06-17-2007 05:41 AM

It all roots down to TGraalVar though.

Admins 06-17-2007 02:44 PM

triggerclient() is both a function of the player and a global function (the global function is automatically redirecting to player.triggerclient()). There are a few other functions like setlevel2() which are the same.


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

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