playMaker

Author Topic: How to Select Array Using String Variable[SOLVED]  (Read 1425 times)

hunter

  • Playmaker Newbie
  • *
  • Posts: 7
How to Select Array Using String Variable[SOLVED]
« on: April 09, 2019, 04:00:52 PM »
I have a series of game objects, and each one is loading its' visuals from a different array variable.

I'm looking for a way that I can use a string to define the array variable each GO is looking at, so that I can just update a single instance of the name in each GO's FSM (rather than a dozen times in each Array Transfer Value action!).

I feel like there's either a super obvious solution I just don't know to look for, or my thinking is to backwards that this just isn't something more experienced designers need to do.

Any guidance would be much appreciated!
« Last Edit: April 15, 2019, 02:23:38 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to Select Array Using String Variable
« Reply #1 on: April 09, 2019, 06:19:01 PM »
Hi.
Im not sure if i understand correctly. so bare with me if the answer wont help :)

You can use a 2nd array with the string values then use 'array contains' and search for the target string.
Store the index.

use that index on the array you have.

the index of both arrays should correspond with each other.

So element 0 on the string (for example GO1) array will correspond with element 0 on the other array.

Instead of strings you could also use 'gameobjects' if you are referring to gameobjects

hunter

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How to Select Array Using String Variable
« Reply #2 on: April 09, 2019, 06:51:41 PM »

I'm not sure I'm following - but I think I may have explained poorly!

Here is an image of the action I'm working with - and I'm hoping there's a way I can use a string (or something else - maybe a GO variable in a way I'm not understanding?) to define this value I highlighted, rather than having to set a specific array.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to Select Array Using String Variable
« Reply #3 on: April 10, 2019, 01:47:02 AM »
Hi.

Ahh i understand now.

I would suggest using Array Maker instead as it uses references. (strings)

You can get Array Maker on the Ecosystem


hunter

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How to Select Array Using String Variable
« Reply #4 on: April 12, 2019, 10:42:31 AM »
Thanks for the advice! I've switched over to Arraymaker, and it's definitely going to do the trick.