playMaker

Author Topic: Converting Playmaker variables to regular C# variables.  (Read 1155 times)

JumpJets

  • Playmaker Newbie
  • *
  • Posts: 4
Converting Playmaker variables to regular C# variables.
« on: December 27, 2021, 04:48:28 PM »
So I'm writing a script that takes an FSM float and passes it to a function.

   void When2PlayAnimations(FsmFloat localX, FsmFloat localY)
   {
      if(localX < 0)
      {
         //play anim
      }
      else if (localX > 0)
      {
         //play anim
      }
      if(localY > 0)
      {
         //play anim
      }
      else if(localY < 0)
      {
         
      }
   }

but I keep getting an error that FSMFloats and Ints cannot be used with the '<' or '>' operands.

How do I convert playmaker variables to regular variables to use in my C# scripts?

or how do I use playmaker variables with operands in a C# script. 

JumpJets

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Converting Playmaker variables to regular C# variables.
« Reply #1 on: December 27, 2021, 06:16:38 PM »
Well I found out if I add .Value, that lets me work with the value... as far as conversions go though, that would also be helpful, haven't figured that out.

Playmaker dev, I think you should probably add that into the Playmaker wiki, that it is necessary to use variables on the fsm game object by saying .Value. I was under the impression that FsmFloats were just a different type of float, not an object.

Twood

  • Junior Playmaker
  • **
  • Posts: 80
Re: Converting Playmaker variables to regular C# variables.
« Reply #2 on: December 27, 2021, 07:27:24 PM »
Well I found out if I add .Value, that lets me work with the value... as far as conversions go though, that would also be helpful, haven't figured that out.

To convert just declare a new variable and set it to the fsm value, should work

newFloat = fsmFloat1.Value;

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Converting Playmaker variables to regular C# variables.
« Reply #3 on: December 27, 2021, 11:01:33 PM »
Hi.
On the playmaker API you can find more information