playMaker

Author Topic: How do you change a PM variable from c#? [SOLVED]  (Read 637 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 479
    • View Profile
How do you change a PM variable from c#? [SOLVED]
« on: February 15, 2016, 07: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.
« Last Edit: February 18, 2016, 12:34:14 PM by Alex Chouls »

basuki

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: How do you change a PM variable from c#?
« Reply #1 on: February 15, 2016, 10:38:10 AM »
Make it global?

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 479
    • View Profile
Re: How do you change a PM variable from c#?
« Reply #2 on: February 16, 2016, 09:53:01 AM »
but how???

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: How do you change a PM variable from c#?
« Reply #3 on: February 16, 2016, 09:59:55 AM »
There is an API Reference here. Examples are also provided here.

There is a lot of useful information on the Wiki.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 479
    • View Profile
Re: How do you change a PM variable from c#?
« Reply #4 on: February 18, 2016, 09:13:30 AM »
Thanks

ergin

  • Junior Playmaker
  • **
  • Posts: 86
    • View Profile
Re: How do you change a PM variable from c#? [SOLVED]
« Reply #5 on: February 18, 2016, 01: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...