How do I extract values from a selected array value

Get help using Construct 2

Post » Thu Feb 05, 2015 4:56 am


I hope this make sense :)

I was wondering if there was a way (like unix split) within Construct 2 to go through each character within a specific array element.

Meaning that if I have an array with 10 values 0-9 on X, with different names such as
0,0 = DOG
0,1 = CAT
0,2 = FOO

Then I pick one of these from the array, then foreach letter within the selected choice put it somewhere.

So for example I wanted to extract D and put it in square 1, then O put it in square 2 then G in square 3.

I did this before, but what I ended up doing was just creating an array with one x, then 5 height(Y) and go through each on of the Y's, bit this ended up being very long in the tooth.

Would I perhaps need to create an array from the selected number then pop them off or something?

Posts: 37
Reputation: 415

Post » Thu Feb 05, 2015 5:40 am

The question is what do you want to do with each letters ?
You can go and have a loop that will read the content of the array at specific coordinates, letters by letters.

Example you want to display the letters in a text object. That would give something like :

For "wordLength" Start 0 End len(,coordY))
Text.text = Text.text & " _ " & mid(,coordY), loopindex, 1)

Will give
"D _ O _ G" (possibly even "TextD _ O _ G")
for coordX = 0 and coordY = 0

No need for an extra array in that case.

Text manipulation system expressions are awesome.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Posts: 7,036
Reputation: 59,187

Post » Thu Feb 05, 2015 5:49 am

Whoooaaa. I think I will need an hour and 2 cups of coffee to understand that :) but I think I might be able to work it out. Basically I don't want to append to the same text box, but to a individual text boxes for each character like a crossword layout.

Thanks Kyatric. I will see what I can do with this.
Posts: 37
Reputation: 415

Return to How do I....?

Who is online

Users browsing this forum: Greaver, resdesign, Yahoo [Bot] and 10 guests