Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-25-2006, 06:12 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
passing objects through triggeractions

Hi,

NPC Code:

function onCreated(){
thiso.objtest=NULL;
thiso.objtest=new TStaticVar();
echo("before:" SPC thiso.objtest.test1);
thiso.objtest.test1="blah";
echo("after:" SPC thiso.objtest.test1);
findplayer("projectigi").triggerclient("-trgtest",thiso.objtest);
}
//#CLIENTSIDE
function onActionClientSide(){
player.chat="s" SPC params[0].test1;
}



don't works, is there any way to correctly pass an object through a triggeraction?
Reply With Quote
  #2  
Old 03-25-2006, 06:45 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by projectigi
Hi,

NPC Code:

function onCreated(){
thiso.objtest=NULL;
thiso.objtest=new TStaticVar();
echo("before:" SPC thiso.objtest.test1);
thiso.objtest.test1="blah";
echo("after:" SPC thiso.objtest.test1);
findplayer("projectigi").triggerclient("-trgtest",thiso.objtest);
}
//#CLIENTSIDE
function onActionClientSide(){
player.chat="s" SPC params[0].test1;
}



don't works, is there any way to correctly pass an object through a triggeraction?
I have noticed this too. The only way I could partially do this was to do something like this:

PHP Code:
// In actionserverside
temp.varray NULL;
for(
temp.vnamethis.objtest.getvarnames()) {
  
temp.varray.add(temp.vname "=" this.objtest.(temp.vname));
}

player.triggerclient("gui""-trgtest"temp.varray); 
PHP Code:
// In actionclientside
temp.varray.loadvarsfromarray(params[0]);
echo(
temp.varray.test); 
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 03-25-2006, 09:08 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by projectigi
Hi,

NPC Code:

function onCreated(){
thiso.objtest=NULL;
thiso.objtest=new TStaticVar();
echo("before:" SPC thiso.objtest.test1);
thiso.objtest.test1="blah";
echo("after:" SPC thiso.objtest.test1);
findplayer("projectigi").triggerclient("-trgtest",thiso.objtest);
}
//#CLIENTSIDE
function onActionClientSide(){
player.chat="s" SPC params[0].test1;
}



don't works, is there any way to correctly pass an object through a triggeraction?
If this is inside a weapon, it obviously will not work because onCreated() and such events are not called on the serverside in a weapon.
__________________
Liek omigosh.

Reply With Quote
  #4  
Old 03-25-2006, 09:54 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
they are called if youu update the script
else it wouldnt say
before:
after: blah

in my rc...right? XP
Reply With Quote
  #5  
Old 03-26-2006, 09:19 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
You can't pass objects through triggeractions. The method I told you works, but is probably not efficient for most cases.

Also, your triggerclient is not using correct syntax. it should be triggerclient("gui", ..)
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 03-27-2006, 02:14 AM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by projectigi
they are called if youu update the script
else it wouldnt say
before:
after: blah

in my rc...right? XP
onCreated and onPlayerEnters events are not called serverside in a weapon. >.>
__________________
Liek omigosh.

Reply With Quote
  #7  
Old 03-27-2006, 02:17 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
well you're wrong
Reply With Quote
  #8  
Old 03-28-2006, 01:49 AM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by projectigi
well you're wrong
Dude, I'm not.
__________________
Liek omigosh.

Reply With Quote
  #9  
Old 03-28-2006, 02:48 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Quote:
Originally Posted by projectigi
well you're wrong
I'm sorry but in this case you are wrong. Stefan has said this many times before, serverside weapons are technically not "created". I cannot verify for sure if onCreated() will work serverside or not, I know at one point it worked but only because it was a catch that I think stefan put in iirc. What you shoudl be doing if you require something to have serverside things activated when the weapon is updated/someone logs on/has the weapon added to them you should have an trigger on the client like: triggeraction(0,0,"serverside","init"); Although I do think there is a triggerserver() and triggerclient() now (I'm just coming back and trying to catch up myself).

It would be nice if you could pass objects through a trigger though. I don't know if this so much qualifies as a bug but moreso as a feature that should be added if possible.
__________________
Who has time for life these days?
Reply With Quote
  #10  
Old 03-28-2006, 08:43 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
It is called serverside if you UPDATE the SCRIPT
how else my rc would generate the output...
Reply With Quote
  #11  
Old 03-30-2006, 04:11 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
projectgi is right in this case. onCreated() is sent to a WNPC when you update the script in NC.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #12  
Old 04-01-2006, 09:21 PM
Ajira Ajira is offline
Poont.
Join Date: Oct 2004
Location: NY, USA
Posts: 477
Ajira is on a distinguished road
Quote:
Originally Posted by ApothiX
projectgi is right in this case. onCreated() is sent to a WNPC when you update the script in NC.
Then that is related to NC updates only. If there is an onCreated() block in the serverside part of a weapon script, and a player logs on, I highly doubt onCreated() will still be called on the serverside.
__________________
Liek omigosh.

Reply With Quote
  #13  
Old 04-01-2006, 10:40 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
Quote:
Originally Posted by Ajira
Then that is related to NC updates only. If there is an onCreated() block in the serverside part of a weapon script, and a player logs on, I highly doubt onCreated() will still be called on the serverside.
I never said it will be called if a player logs in O_o
Reply With Quote
  #14  
Old 04-02-2006, 09:03 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Ajira
Then that is related to NC updates only. If there is an onCreated() block in the serverside part of a weapon script, and a player logs on, I highly doubt onCreated() will still be called on the serverside.
He didn't, he's been telling you the whole time that it is called when he updates the script from his RC. Ajira needs some glasses
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:56 PM.


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