playMaker

Author Topic: [SOLVED] GettingFSM Ints and putting them into an int array in a script  (Read 2022 times)

charming_fox

  • Junior Playmaker
  • **
  • Posts: 62
Hi,

I have a line of code I can't quite suss out, details is an Int array, fsmVariableNames is an array of names corresponding to the FSM variables that are predefined on the game object.

Visual studio gives me the error: Cannot implicitly convert type 'HutongGames.PlayMaker.FsmInt' to 'Int'.

Do you happen to know how to solve this? Code is below, thank you!

Code: [Select]
for (int i = 0; i < numberOfDetails; i++)
            {
                newPlayMakerFSM = gameObject.GetComponent<PlayMakerFSM>();
                details[i] = newPlayMakerFSM.FsmVariables.GetFsmInt(fsmVariableNames[i]);
            }
« Last Edit: December 15, 2021, 04:17:22 AM by charming_fox »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: GettingFSM Ints and putting them into an int array in a script
« Reply #1 on: December 14, 2021, 04:14:25 PM »
Hi.
Try adding .Value

charming_fox

  • Junior Playmaker
  • **
  • Posts: 62
Re: GettingFSM Ints and putting them into an int array in a script
« Reply #2 on: December 15, 2021, 04:16:46 AM »
Thanks! This worked perfectly.

For future reference, this is the working code:
Code: [Select]
newPlayMakerFSM.FsmVariables.GetFsmInt(fsmVariableNames[i]).Value = value.details[i];

charming_fox

  • Junior Playmaker
  • **
  • Posts: 62
Re: GettingFSM Ints and putting them into an int array in a script [SOLVED]
« Reply #3 on: December 15, 2021, 04:17:00 AM »
Hi,

I have a line of code I can't quite suss out, details is an Int array, fsmVariableNames is an array of names corresponding to the FSM variables that are predefined on the game object.

Visual studio gives me the error: Cannot implicitly convert type 'HutongGames.PlayMaker.FsmInt' to 'Int'.

Do you happen to know how to solve this? Code is below, thank you!

Code: [Select]
for (int i = 0; i < numberOfDetails; i++)
            {
                newPlayMakerFSM = gameObject.GetComponent<PlayMakerFSM>();
                details[i] = newPlayMakerFSM.FsmVariables.GetFsmInt(fsmVariableNames[i]);
            }

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: [SOLVED] GettingFSM Ints and putting them into an int array in a script
« Reply #4 on: December 15, 2021, 12:38:36 PM »
Hi.
Here is also a link to the Playmaker API
which can be useful :)