prancu's Recent Forum Activity

  • This is totally random and I don't know why it worked, but I finally got it to work by starting a whole new project and following the tutorial I originally used at the beginning of this post. And yes, that does mean I reverted some of the changes I made throughout this. But it's saving to the array now, so I'll just stick with that. So now that I finally have that, how would I sort the names by score? I figured I could include the global variable "score" in the text object after the name, but it keeps sorting it alphabetically.

  • Nope. Didn't work. And of course, I've tried every other solution that was suggested in this post and none of those worked for me either. Maybe there's some weird bug? Or I'm just doing something totally wrong. I have no idea at this point. I've been stuck on this for a while now though. Since the game works otherwise, I'm at the point where I'm thinking of doing a handwritten leaderboard on a whiteboard and leave it at that. It's just so frustrating. Thank you for all your help though!

  • Try Construct 3

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

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

    After checking it in debug view, the array is not saving correctly. Interestingly, a couple names that I entered using this same method earlier were still in there. So it was apparently saving it properly at some point. So I must've changed something that messed with that. No idea what though. I added the loop like you suggested, but it still doesn't seem to work. I also tried adding a "if missing" from local storage event and pull the array file using AJAX, but still no luck. No idea what I'm doing wrong.

  • lionz

    I think I followed all your directions? I was a bit confused by the set text Name to "", but I think I did it how you meant. I tried it both in its present location and in the sub event before the loop. Neither works. So maybe I have it in the wrong place? I also tried without and that just leads to overwriting the first line of the text object. Sorry for being so confused; I've just never done anything like this before.

  • lionz

    I made all these changes, and it's still just overwriting the first line every time without adding to the list. Interestingly, it pushed down two of the names the first couple run throughs, but stopped after that. Is there something that would cause that? I only made the changes you suggested so those were the only differences to the screenshot I posted above.

  • lionz

    Yes, like I said in my last post, I've only figured out how to push the names to the array so far. Since I didn't want to mess up my event sheet on my actual game, this is 100% a test game right now, so there's very limited data in it. And using tutorials online, I figured out how to save the names. But then that part seemed to stop working, so I figured I would find out how to do that first and then move on to figuring out how to link the scores to the names after. So yes, this event sheet has only the name part incorporated right now. Does that make sense?

  • Ok because I couldn't figure this out, I made a test game to play around with different options and find out what works. Following a forum post about how to make a top 10 leaderboard, I put together the following. It kind of worked initially, but was a bit messy for some reason. So I changed some things and somehow broke it. Now it just replaces the top score every time without moving scores down. If I could get this to work, it at least solves the name part of the leaderboard. I'm not sure how I'm going to keep it linked to player scores, but one step at a time, I suppose.

    Anyway, can anyone tell me what I'm doing wrong in the following event sheet? I just want a top 5 leaderboard with names (and eventually scores, but I haven't gotten that far yet). I want it to save in the array to local storage.

  • Thank you, but unfortunately that didn't work. It's still doing the same thing where it just overwrites the first score every time. I think I'm just missing something, but I even tried specifying each text object and it still just overwrites the first text box.

  • I'm completely new to all of this, but somehow I've managed to almost finish my platformer trivia game. All I need to finish is the leaderboard. After researching, I decided that the best method for our needs was to save scores in an array and use the local storage plug in. But for the life of me, I cannot get it to save multiple scores. Right now, I have an input box to type names and when "submit" is clicked, the text from the box and the player's final score are input into the first text boxes in the leaderboard. That part all works properly. But then when I play again, the new score overwrites the old score rather than adding to the list. And it doesn't seem to be saving to the blank array at all. I feel like that's my problem: saving the data to the array so it opens up next time the game is opened in the same browser. And being able to add to that data without overwriting it. I've read a ton of tutorials and utilized ChatGPT, but so far nothing has worked. The screenshot below shows what I have right now.

    I also have the Localstorage set item "highscores" to leaderboardarray.atJSON further down my event sheet when the scores need to be saved.

    For clarification, the array shown in the first event all works properly. I'm just having issues saving and pulling from my leaderboard array.

    So how should I go about doing this? I feel like I have to be missing something, but I've tried so many different things at this point. Could it just be an order thing? I'm terrible at keeping my event sheet ordered properly...

  • That worked! Thank you so much! I knew it had to be something silly...

  • Hello! I'm completely new to all of this but I've been surviving so far on forum posts, tutorials, and ChatGPT. I'm making a platformer trivia game, and for the life of me, I can't get my array json file with the questions to load properly. I've been following various help topics, but nothing works so far. When I go to debug it, it doesn't show my questions in the array (however my questions do appear in the AJAX portion?)Here's what I have right now:

    Is there a limit to how much data can be in the array? I have way more than the 10-20 questions that seem to be used in all the examples I've found. Or maybe I just have to go further and start putting the Array.At stuff in first? I just figured the data should show up in the debug layout feature after putting in those first events to load the array.

    I'm probably just missing something super obvious and I'm going to feel like a total idiot when I learn how to do it, but after trying so many different things, I just have no idea how to get it to work.

prancu's avatar

prancu

Member since 29 Mar, 2023

None one is following prancu yet!

Trophy Case

  • 1-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

3/44
How to earn trophies