playMaker

Author Topic: Using Array list get to store item in multiple variables  (Read 2810 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Using Array list get to store item in multiple variables
« on: February 23, 2017, 05:23:24 AM »
Hello, i was wondering if there was a chance to make an Array List Get action that would allow the item that has been gotten to be stored in multiple variables. More than once i had the need to store the array item as a game object and string for example, and using the action twice really seem unnecessary.

An option to select how many variables would you like to fill would be also cool.

I made a mockup:



I think that would be very useful for many users.

« Last Edit: February 23, 2017, 05:25:56 AM by krmko »
Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Array list get to store item in multiple variables
« Reply #1 on: February 23, 2017, 07:27:10 AM »
Hi,

 for this, I would recommand iterating through the index integer itself and then based on the integer you use arrayGet and specify the right type.

 modify that action to do so would be very counter productive I feel because if you stored at index 3 a GameObject and then at index 4 a string, which is perfectly ok, then for all iterations you would save the same entry into at least one wrong variable. Doesn't feel very nice :)

 so prefer a manual iteration and based on the index you transit to a "Get GameObject" state or "Get String" state, this will be a lot more sane as an approach.

and actually, if you know where things are by index, then simply go to them directly without iterating, seems not necessary.

Bye,

 Jean
« Last Edit: February 23, 2017, 01:25:09 PM by jeanfabre »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Using Array list get to store item in multiple variables
« Reply #2 on: February 23, 2017, 08:30:50 AM »
Thanks for the advice Jean!
Available for Playmaker work