How do I Loop through an Array and Create a New String from The Array Values?

0 favourites
  • 2 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • Hello Gaskin Design Studios (My user name might say RinesJoseph I'm the same GUY XD ) here and once again I am asking the community for help with a simple problem.

    I am trying to create a function that will loop through an array, take the values from that array and build a string from them.

    So far I got this below

    I'm figure out the right expression that will build the string.

    (TruSize the number of non(-1) values in the array. I want the loop to go from 0 to that value in the array building the string as it goes.)

    I need to be able to do this without hardcoding because I could have a random number of values in the array.

    If you can please help me with any suggestions I'll owe you a favor ;) Thank you Construct 2 community you never let me down yet!!!

    and I'm using Construct 2 not 3 hopefully it doesnt make too much of a difference

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solution:

    So I figured out my problem. I wasn't adding the previous string to itself (ROOKIE MISTAKE!!) So anybody who's looking for a way to build a string from stored inputs this is the expression you need..

    you could also replace loopindex with nameOfArray.CurX(or whatever Axis your trying to loop through)

    :D Happy coding ya!!!

    P.S. Make sure the string you what to rebuild is empty initialized as emnpty or is set to be empty before the loop starts

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