playMaker

Author Topic: Going from FsmVar to FsmString  (Read 1046 times)

playsteven

  • Junior Playmaker
  • **
  • Posts: 75
    • View Profile
Going from FsmVar to FsmString
« on: July 30, 2016, 06:08:06 AM »
Hey,

I've got an array and I want to get a string value from it. What's the easiest way?

I can get the array value in to a variable, but can't work out how to convert the var to a string.

So, I've got ...

Code: [Select]
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmArray achievementAwardsScreenTextArray;

        [Tooltip("The award number.")]
        public FsmInt awardNumber;

        [UIHint(UIHint.Variable)]
        private FsmVar storeValue;

[UIHint(UIHint.Variable)]
        private FsmString theString;

public override void OnEnter()
{

storeValue.SetValue (achievementAwardsScreenTextArray.Get(awardNumber.Value));


... and I need to get storeValue (which should hold a string by that point?) to theString so I can use it to set some text.

How would I do this?

Thanks in advance,
Steven
« Last Edit: September 28, 2016, 04:59:23 AM by jeanfabre »

playsteven

  • Junior Playmaker
  • **
  • Posts: 75
    • View Profile
Re: Going from FsmVar to FsmString
« Reply #1 on: August 01, 2016, 03:24:18 AM »
Just in case anybody else wonders how to get a value out of an array...

Code: [Select]
string theString = (string)(achievementAwardsScreenTextArray.Get (awardNumber.Value) );

worked for me - after 2 days of failed attempts  ::)

mdotstrange

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Going from FsmVar to FsmString
« Reply #2 on: September 28, 2016, 03:25:46 AM »
Thanks for posting your solution- just saved me some time  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!