Array Cell Number by Alpha?

0 favourites
  • 3 posts
From the Asset Store
Is a system for building scorecards and achievements online for use in games Using this system, you can create a scorebo
  • Hi! This may be a totally obvious thing but I can't seem to figure it out.

    I have an array filled with object names:

    0 "Alpha01"

    1 "Alpha02"

    2 "Beta01"

    3 "Beta02"

    4 "Beta03"

    5 "Delta01"

    6 "Delta02"

    7 "Delta03"

    8 "Delta04"

    9 "Epsilon01"

    I would like to scan each cell for first letter and return the cell value of the first cell to contain that value.

    Looking for "A" would return 0.

    Looking for "D" would return 5.

    Bonus: Looking for "C" would return 5 or the next closest letter in line.

    Basically I am trying to create an alphabet index to jump around the long list in my array to make access quicker...

    I think I am just lacking a way to look at only the first letter of each cell and not the whole cell itself.

    I will try and make a simpler capx to post... this is one small part of a much larger project, I should have done a prototype in a standalone capx first!

    Thanks!

  • I've figured out how to use IndexOf() and it works great as long as my string is exactly the same as my IndexOf(str).

    I am guessing there is a way to add in Left (text, count) to get the rest of this done...

    *edit

    Looking farther it doesn't seem there is an easy/elegant way to do this.

    IndexOf("B"wildcard) would be ideal.

    Without that option I have to pull each cell value individually, ForEach, truncate it, check it vs my conditions, reject or accept it, set a variable with its cell number, and move on.

    That's a lot to do... No Wildcard??

    No way to do like command line style "DIR B*.exe"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try a dictionary object.

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