Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Help with creating and sorting a high score table

Author
Message
Darkwatch67
14
Years of Service
User Offline
Joined: 31st Jan 2012
Location:
Posted: 14th Mar 2012 22:32 Edited at: 14th Mar 2012 22:45
Hey guys. So after hours of coding, my game is finally complete. What I'm wanting to do now is implement a high score table comprised of 10 ranks. At the moment, my code is pretty much this:



I think I've set up the high score table, but I don't know how to get it on screen.

What I want to do now is take the name and score from this piece of code and put it into the array for the highscores. Just so you guys know, highscores.txt is basically 20 lines with a name and random score.

Once I'm able to read in the high score table, I want to be able to sort the player's high score into it. I have no idea how to implement this, and any help would be grateful.

Thanks as always! =D
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 14th Mar 2012 23:41 Edited at: 14th Mar 2012 23:43
sorting our arrays its very complicated,
but first, im not suggesting you to use multi arrays. its not that implented well in dbp. use types instead.


this seens the last 7.7 bug fix, there was a massive change in array, so if you got array error inside it, you will have to upgrade your dbp version to the beta one.

as i said before, sorting arrays is very complicated, but it is possible.
i hope you understand the code, cuz its not that easy to read.


[edit] wtf! his thread is moved (i see only my answer to his thread but i dont see his thread at all.. lol)

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
Darkwatch67
14
Years of Service
User Offline
Joined: 31st Jan 2012
Location:
Posted: 14th Mar 2012 23:47
Hey Sergey, I don't know what happened. I tried editing the post because of a spelling error, and it disappeared! I wrote it up again just in case. Anyway, I'll read your full post now. x]
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Mar 2012 22:33
I'd like to suggest something even simpler - use the sort command from my plug-ins.

The idea is that you make the hiscore array 1 slot larger than the table you require, drop the new score into the very last slot, sort it, then display everything except the last slot.



The link in my signature will take you to where I've posted the plug-ins.

Login to post a reply

Server time is: 2026-07-10 08:57:00
Your offset time is: 2026-07-10 08:57:00