Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: _adamturnbull on May 02, 2014, 03:38:36 PM

Title: Use String value as the variables name
Post by: _adamturnbull on May 02, 2014, 03:38:36 PM
Hi,

I currently build a string value created from the scene name and the text 'stars' so it would be for example "Level001Stars" on Level001

I'd like to use this string as a variables name so if I want to set an int variables value for that level it would set the int named "Level001Stars" to 1, 2 or 3.

This is to make it automated so I can use that functionality on every level and not have to set the int's name manually. It would automatically generate it from the levels name.

Is this possible?

Cheers,
Adam
Title: Re: Use String value as the variables name
Post by: neowings on May 04, 2014, 01:32:59 AM
Maybe "Build String" Action can help you.
Try it.
Title: Re: Use String value as the variables name
Post by: _adamturnbull on May 05, 2014, 05:49:58 AM
I currently use Build String to build the string "Level001Stars" taken from the level name and the text 'Stars'.

I just want to use this as the variable name so I can then set the Global Variable value "Level001Stars" to a number. But I can't see an option to use a built string as the variables name.

The only way I can see to do it is to go into each level and set the global variable up manually.

Any suggestions?