How do I get all values from Array on Dimension Z to show on

0 favourites
  • 9 posts
From the Asset Store
A small template showing how to build a firebase ranking
  • Hello ,

    I have an array which has x,y,z dimension.

    On Z dimension , i have five values , "orange" , "apple" , "strawberry" , "carrot" , "banana".

    I need to get all values and print them on text box.

    I am doing like this ;

    Now , i have several problems ,

    I can't pull all array values to textbox2 to show it who type "banana"

    I tried to use Array.CurZ expression or Array.Depth it didn't work.I checked getting random values from array , i understand the perfectly yet i can't managed to list all values to show in textbox2.

    Could you please show how i can make this right or should i make it same Array.at expressions for all choices to list on textbox2 ?

    Edit;Checked several times here scirra/manual/108/array ; couldnt figure it out which expression should i used it ...

    edit 2 ;

    I can do it like array.at(0,0,1)&","&array.at(0,0,2) and it works good but if i have hundreds values in array , it is not the good way to print it.

    So is there any trick on expressions that i do not know about to print all of them ?

  • For "z" 0 to Array.Depth-1 -> Array.At(loopindex("z"))

    That will loop through each item in Z.

  • Hello ,

    Thank you for your answer ,

    I tried and it was like this

    but i got this result;

    Thank you again for helping , sir/ma'dam.

  • Swap the For & the TextBox events.

  • I tried , i got same result. It shows only "banana,"

    edit; i guess it loops and stop on "banana" instead of printing all of them in 1 line.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you so much for example and sharing it for me and thank you for spending time to helping to me.

    If you dont mind , Can i ask , why do we required to use Variable1 ? was that an important function for this problem ?

  • You have to build up the list of elements. The Text object has an Append action, but TextBox doesn't, so you need to append the list manually. Otherwise you would be replacing each element with the next one. I think your main problem was not setting the size of the Z dimension, so your depth was actually only 1, therefore stopped at "banana".

  • I see , thank you for information and kindness.

    I checked array z dimension depth it was 7 so i still don't know what went wrong if that was good algorithm.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)