Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: dudebxl on April 08, 2015, 11:57:40 AM

Title: FsmVar - please explain[SOLVED]
Post by: dudebxl on April 08, 2015, 11:57:40 AM
Hi,

I am working on custom action and everything is working except i have to set the FsmVar to public for it to be working. Also how do 'transfer' data from var to fsmVar.

1. fsmVar.Type = variableType;  -- How do i set the private FsmVar type in code? it seems to only be working when public (?)

2.
var result = System.Convert.ToInt32(element);
fsmVar.intValue = result; --  does not work. How do i transfer data between var and fsmvar (keep getting a null reference)??

I am still learning C# so any help would be great. many thx
Title: Re: FsmVar - please explain
Post by: Lane on April 08, 2015, 12:36:42 PM
A bit tied up for a lengthy answer at the moment but check this out and you might find your answer, let us know.

The Utils repository is intended to be shortcuts for common work between scripts and 3rd party addons.

https://github.com/jeanfabre/PlayMaker--Utils
https://github.com/jeanfabre/PlayMaker--Utils/blob/master/PlayMakerUtils_FsmVar.cs
Title: Re: FsmVar - please explain
Post by: dudebxl on April 08, 2015, 04:25:03 PM
thx.. for the info.

I already had a quick look at the fsmVar Util and noticed before posting this: 'Only works if the FsmVar points to a Fsm Variable. ' -- this causes problems as i don't need to show the data in this action (no _target needed just the data).. wanna hide all the var to keep it simple for end-user (+ my future self)..

anyway, i will keep moving forward. thx again.. ;D
Title: Re: FsmVar - please explain
Post by: jeanfabre on April 09, 2015, 02:25:12 AM
Hi,

 I don't think you set the fsmVar type, you actually assign to the fsmVar an FsmVariable and then the type becomes the one of the fsmVAriable that it's pointing too.

To transfer reliably, I am always relying on the PlayMaker utils functions ( like Lane said). you 'll have

GetValueFromFsmVar()
ApplyValueToFsmVar()

with these, then assigment is ok.


 Bye,

 Jean
 
Title: Re: FsmVar - please explain
Post by: dudebxl on April 09, 2015, 09:18:25 PM
Ahhh...   :D

Thx a lot for the info. I understand now..  ;D