The Daily Click ::. Forums ::. Klik Coding Help ::. Custom high score table?
 

Post Reply  Post Oekaki 
 

Posted By Message

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
21st April, 2012 at 21/04/2012 01:52:07 -

Could someone point me to a tutorial how to make a custom high score table using ini or something? I've searched the site but I've only found dead links. The built-in high score table does not seem to work for me this time. Thanks.

 
i hate moderators

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
21st April, 2012 at 21/04/2012 04:26:37 -

Tell me exactly what you want this custom high score table to be able to do and I'll make you an example.

 
n/a

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
21st April, 2012 at 21/04/2012 10:07:54 -

Well just a normal high score table but I want it to be able to take scores from two players at a time (it's a 2 player coop game with seperate scores). And preferably without having to use a "windows pop-up" window for name entry like the standard one does, because I want to be able to submit scores during gameplay without having to pause (if player 2 gets a game over he could type his name while P1 is still playing).
The table won't be visible during gameplay, it just has to check and take scores, the table is on another screen.
I made one (very ineffectively) myself that I think should work in theory but it crashes my game. I can make it read scores from an INI, but the checking and updating stuff didn't turn out as good.;;
I haven't really messed around with INIs before yesterday, but with an example I should probably be able to figure out how it works.

Edited by Wilderness (Ultra Soft)

 
i hate moderators

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
22nd April, 2012 at 22/04/2012 05:29:20 -

Ok sure. One more thing... do you want players to type their names, click the letters with the mouse or use their movement keys to select the letters?

Also, I am gonna use an array instead of an ini. Unless you really want it with ini for some reason...

 
n/a

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
22nd April, 2012 at 22/04/2012 09:38:20 -

No an array is fine, I've just never used it. Just thought it'd be practical with an INI as I could store it in the same file as the options and settings (unsecure as that may be). But as long as I can save the scores to the hard drive.
The letters have to be selected with the movement controls, since I want the players to be able to enter their scores while the other player is still playing.

Edited by Wilderness (Ultra Soft)

 
i hate moderators

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
22nd April, 2012 at 22/04/2012 20:50:23 -


Done!

http://www.whenthereisnoroominhellthedeadwalktheearth.com/MMF/highscores.mfa

It automatically sorts the array every time you add a new score.

 
n/a

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
22nd April, 2012 at 22/04/2012 21:53:10 -

Thanks! I'll check it out right away.

 
i hate moderators

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
23rd April, 2012 at 23/04/2012 01:24:37 -

Think I pretty much got it, except I can't seem to make it limit entrys to a certain amount (10), now it just keeps adding scores even after the screen is full... I can't find a function to remove lines, but maybe it isn't needed. As I said, I've never used arrays before. I'll probably figure it out eventually, still I'd appreciate a hint.
The table is supposed to have some default scores to begin with, so it will never really be empty.
Also, is there a certain reason you used global values instead of regular counters or alterable values, are they faster or something?

Edited by Wilderness (Ultra Soft)

 
i hate moderators

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2012 at 23/04/2012 02:04:33 -

all you have to do is change the amount of times the loop "Display" runs. Change it in the Start of Frame event, and the Submit Scores event. The display loop runs as many times as there are scores, which changes during execution. Change this to a constant value to limit how many scores it displays. Min(10, TotalScores) is one way of doing this. It only runs it as many times as necessary with the limit of 10. so if theres only one score it only runs once, instead of 10 times which is 9 times too many. simply putting 10 is fine though because the extra 9 loops isnt going to cause a problem.

Also @ChrisBurrows, The Wipe Scores event is a bit excessive. It doesn't need to run all those loops to clear the table. Clear Array, Set TotalScores to 0, and Set Strings to "". Or maybe you just did a copypasta and forgot about it.

some other things i would suggest are that because it is limited to a specific number of scores, to keep the array sorted when inserting, moving scores down causing low scores to drop off of the array. This will help keep the array file small, and prevent sorting problems on arrays with large quantities of scores. It will also remove the need to run a massive sort loop.

Edited by Cecilectomy

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
23rd April, 2012 at 23/04/2012 05:15:58 -


@Cecilizer
Hardly excessive. It does the same thing but more elegantly. Each of those loops will stop instantly when it realises the array is empty.

@HSK
I've made an updated version for you. Now, there are only ever 10 scores displayed. But you can edit this by changing the TotalScores global value. A score will only be submitted if it is higher than the bottom score. If the list is empty, it is filled with default scores. Also, I used global values because to me, they seem neater in the event editor. You store the values anywhere you like.

http://www.whenthereisnoroominhellthedeadwalktheearth.com/MMF/highscores2.mfa

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2012 at 23/04/2012 06:45:12 -

The fact that it is running ANY loops at all is excessive. Set alterable string to "" accomplishes clearing the strings. Clear Array accomplishes clearing the array. Simply doing Set TotalScores to 0 accomplishes resetting the score count. The loops are irrelevant and therefore excessive, regardless of however many times it runs or how elegantly it is done. Running a loop to count to 0 is bad logic, especially when the outcome will ALWAYS be 0. Quite the opposite of elegance. It's like making a Rube Goldberg machine to turn on a TV. Just press the power button man.

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
23rd April, 2012 at 23/04/2012 15:53:42 -

How about you press the power button.

Instead of shouting abuse, smug from the sidelines.

Programming is a creative art. As the artist, I am free to code each particular aspect of my artwork as I please, deciding for myself what is elegant, neat and or excessive. Where you prefer the boring alternative of "set everything to 0", I find beauty in a loop that will, under all conditions, perform.

As is there no universal moral code by which to judge good or evil, there is no objective standard by which to judge excessiveness. Obviously, I was aware of the stale surrogate yet I opted to recall a simple loop, resulting in the exact same outcome at no cost, which once again, obviously, I did not deem excessive. Focusing primarily on the negative aspects in the works of others may make you happy today, and maybe even tomorrow, but ultimately you will find yourself unhappy and alone.

"You think you're so creative. You don't know what it's like to really create something; to create a life; to feel it growing inside you. All you know how to create is death and destruction" - Sarah Connor

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2012 at 23/04/2012 22:52:45 -

i am not shouting abuse and there was nothing abusive about anything i said. nor was anything i said false.

No there isn't a standard by which to judge excessiveness, but there are guidelines on good coding practices. Some professors would give you a zero on an assignment for doing something like that, and in the workplace your work would be deemed complicated and trashy. When coding you need to keep in mind the other people that will see and/or use your work. When i looked over the events, red flags immediately went up for me. Doing things like that just for fun can completely confuse someone who isn't thinking the same way as you.

I used to think the same way as you, and was told during an interview instances of where crap like that can screw stuff up. Someone comes in and solves a problem, and leaves behind "working code", but because they did it their way, the entire code base was scrapped, simply because it was incomprehensible to anyone else.

I propose you take criticism and suggestions with a grain of salt before you start lashing back, making false accusations, and being overall stubborn.

 
n/a

Wilderness (Ultra Soft)



Registered
  23/06/2003
Points
  94
23rd April, 2012 at 23/04/2012 23:23:54 -

Thanks again, it took me a while to get all of it but now I could make the best high score table I've ever made. And the array object seems incredibly useful.

 
i hate moderators

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
24th April, 2012 at 24/04/2012 02:36:50 -


@HSK
Glad to help comrade.

@The Cecilizer
Hmmm maybe you're right. I often forget about that place called "the real world".

 
n/a
   

Post Reply



 



Advertisement

Worth A Click