Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: wheretheidivides on February 15, 2016, 09:19:56 AM

Title: How do you change a PM variable from c#? [SOLVED]
Post by: wheretheidivides on February 15, 2016, 09:19:56 AM
I know this has probably been asked before but I can't find a answer.  I am writing a game that uses some c#, javascript and playmaker.  I want the variables to be in playmaker, so was wondering if you could change a playmaker global variable from c#.

The other option is just to make all variables in c# script and access then from playmaker.  I can do this as well, but am trying to move more towards playmaker for everything.
Title: Re: How do you change a PM variable from c#?
Post by: basuki on February 15, 2016, 12:38:10 PM
Make it global?
Title: Re: How do you change a PM variable from c#?
Post by: wheretheidivides on February 16, 2016, 11:53:01 AM
but how???
Title: Re: How do you change a PM variable from c#?
Post by: Lane on February 16, 2016, 11:59:55 AM
There is an API Reference here (https://hutonggames.fogbugz.com/default.asp?W127). Examples are also provided here (https://hutonggames.fogbugz.com/default.asp?W329).

There is a lot of useful information on the Wiki.
Title: Re: How do you change a PM variable from c#?
Post by: wheretheidivides on February 18, 2016, 11:13:30 AM
Thanks
Title: Re: How do you change a PM variable from c#? [SOLVED]
Post by: ergin on February 18, 2016, 03:41:51 PM
although solved,
you must add(include) :
using HutongGames.Playmaker;

and use this code:
FsmVariables.GlobalVariables.GetFsmString("nameoftheglobalfsmstring").Value = yourvalue;

you should use GetFsmString for strings GetFsmInt for ints and so on...