Get Name to Save for High Score Array?

  • Oh yeah that was the issue, sorting. It's been a while so I had forgotten.

    Yes the array needs to be full first, do you know where that logic is and when it has all the data?

    Once full I would use something like this to convert back to int, this logic assuming Y=0 and Y=1 are values to turn back to int :

    System for from 0 to array.width : array set value at xy(loopindex,0) to int(array.at(loopindex,0))

    System for from 0 to array.width : array set value at xy(loopindex,1) to int(array.at(loopindex,1))

    That should convert all the string numbers to ints that can be properly sorted

  • Array full check...i can see what is in the list when debugging but there is no pre-set array with scores or names. It is adding as the player plays. So in theory after 10 plays it would be full...but then the sort would be off until they played 10 times...so maybe i should create a preset array data...but I dont know how :)

  • Can you show me screen shots in C2 for what you suggest with sorting. Trying to find on my own and struggling like an idiot. I'm sorry and i appreciate all your help...you will be getting a you as a programming consultant to my game credits :)

  • tried this...not full array yet but does this make sense? The lcik is a button i have to test the code

  • I did find my Global_variable I wasa using to generate the array but I had all 0's Clearing Array and adding some manual ones...stay tunred

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • By full array I meant all the data available not that it must be full of scores. You can sort it whenever you want but I guess after adding all data which I assume you do on start of layout? I also thought you had done sorting already because you mentioned it earlier? There is an array sort which puts them from lowest to highest, you use this, then you use array reverse to put them highest to lowest.

    As for the int conversion, i said to put it inside a for loop. All this logic can go within the other event you had for filling the array as long as its done after. You use a for loop to run through all scores in the column and convert them to int. You can do this on a button click but you need to add the for loop as mentioned above as a sub event otherwise loopindex does not mean anything.

  • I tried adding to both of my loops and it does not seem to help...im sure i am doing something wrong. I dont need it on the button it was just for testing.

  • Blah....cannot get it,,,,sweet crap. I tried for many variations and thought I got it once but then it was not saving the score...i quit :0

  • Hmm again the actions are not added into the loop I mentioned. You should create a new for loop, for from 0 to array.width and add those actions.

  • i tried adding to both loops that are in the layout...unless i am completely missing what a loop is. :)

  • You are adding it to a loop but the wrong loop, you need to create a new one as a sub event at the point in time where you need to convert all numbers to int.

  • I love you.

  • noticed something is duplicating at the bottom of the list...just now...

  • Think I got it. Changed Sort X to above the int commands...

  • I really appreciate all your help in this. Thanks for sticking with me my patient, friend!

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