playMaker

Author Topic: Combine string with variable in entry fields  (Read 1286 times)

bfd

  • Playmaker Newbie
  • *
  • Posts: 21
Combine string with variable in entry fields
« on: November 19, 2014, 07:21:07 PM »
I'm not sure the best way to describe what I'm trying to achieve here, so bear with me. For each of the entry fields in most of the actions there are entry fields where you can manually enter something, or you can call on a variable. But what if I want to add a string to a variable in order to create a new variable.

Let me first say that I'm sure this example is a really complicated way of doing something simple - but hopefully it helps illustrate what I'm trying to do.

Say I have 5 GameObjects all named Item1, Item2, Item3, Item4 and Item5. I want to be able to perform mathematical operations on the numbers associated with each item - then connect with the relational item. So find Item1+4 or Item3-1.

So if I have an int variable to store the 'current item' and perform mathematical operations on it, let's say I call this variable 'n', is it possible to tell an action to call GameObject variable 'Item(n)'?

As far as I can tell, these entry fields have an either/or approach to manually entered info/variables. I wonder is there a way to format a manually entered field such that it calls a variable with the name of "string+variable"? I'm thinking a (very) long way to approach this is to store 'Item' in another variable then convert the 'current item' variable to a string, combine the two strings into a new string variable and use that to call the GameObject for the item I want - but I'm wondering if there's an easier way to achieve this by using formatting to achieve this.

Again, I know that there a number of better ways to approach the above example. I just don't have a current example for how I would want to use this - I'm just wondering if it's possible and the above seemed like a reasonable way to illustrate it.