playMaker

Author Topic: FsmVar - please explain[SOLVED]  (Read 2301 times)

dudebxl

  • Hero Member
  • *****
  • Posts: 602
FsmVar - please explain[SOLVED]
« 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
« Last Edit: April 16, 2015, 01:48:01 AM by jeanfabre »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: FsmVar - please explain
« Reply #1 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
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: FsmVar - please explain
« Reply #2 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15496
  • Official Playmaker Support
Re: FsmVar - please explain
« Reply #3 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
 

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: FsmVar - please explain
« Reply #4 on: April 09, 2015, 09:18:25 PM »
Ahhh...   :D

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