How do I convert string to choose parameters

Get help using Construct 2

Post » Sun Mar 09, 2014 5:04 pm

I have a multidimensional array (X,Y), which looks something like

arr["LevelDescription","LevelTime","LevelGoal","LevelXlocations"]

LevelXLocations = 0,5,6,84,7,9,2

LevelXLocations is different for each level,

I have a spawn item function, which creates an item according the the array, how can I do something like:

Self.X = choose(arr[LvlIdx,LevelXlocations])

So, how can I covert a string to choose parameters

Thanks
B
43
S
9
G
7
Posts: 58
Reputation: 7,540

Post » Sun Mar 09, 2014 5:23 pm

Im not sure I understand your question, what exactly do you want converted and into what?

You have a string that you want to convert into Lvlidx and levelXlocations?

Can you show an example of a string that you want to convert and what you would like it to look?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sun Mar 09, 2014 6:19 pm

The index LevelXLocations is a string, eg:

"0,5,6,84,7,9,2"

The expression choose(...) requires parameters, these parameters are the content of LevelXLocations, which is a string, this string need to be the parameters of choose
B
43
S
9
G
7
Posts: 58
Reputation: 7,540

Post » Sun Mar 09, 2014 6:37 pm

look up Tokenat in the manual, I think this would be your best bet , I use it for such a purpose!
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sun Mar 09, 2014 6:43 pm

@granpa, wanted to avoid using that, but seems like I will have to :) Thanks
B
43
S
9
G
7
Posts: 58
Reputation: 7,540


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests