0

I'm making a game called "Super Tycoon Master" and I want a high score system. How would I list the score variables in an order that's similar to a high score system? I got that you would have to make the user input a name for the variable, and you would have to save it as a file for later loading. But how do I make this scoreboard? The only code that I know that would work (kinda) is:

set playcount=0
goto Boot_Up

It would then load playcount from a .stmsave (.stmsave is really a .txt) file and it would read that and the goto a frame where it interprets it, like:

:Super_Tycoon_Master
cls
if %playcount% equ 1 goto Setup_1
if %playcount% equ 2 goto Setup_2
if %playcount% equ 3 goto Setup_3
if %playcount% equ 4 goto Setup_4
if %playcount% equ 5 goto Setup_5
if %playcount% neq 1 goto Setup_1

Then the Setup frames would be like this:

:Setup_1
echo Name your character.
set /p Name_1=
pause
goto Game_Start

Then the Scores frame would be like this:

:Scores
cls
echo %Name_1%
echo %Name_2%
echo %Name_3%
echo %Name_4%
echo %Name_5%
pause
goto Menu

The only thing is, how do I order the echo to make i look like the scores went lowest to the bottom and highest to the top? Any relevant help is appreciated!

ender_scythe
  • 470
  • 7
  • 16
  • 1
    This is extremely broad. Please work through the problem on your own and post here when you have a specific question. As it stands now, this is off-topic. – Carcigenicate Jun 29 '15 at 22:54
  • @UnknownOctopus Which is a couple individual questions on its own: making a scoring system (which is itself pretty broad), and reading it from a batch (which there are likely many tutorials for). – Carcigenicate Jun 29 '15 at 22:59
  • @Carcigenicate odd, my last comment deleted, and yes i know it would be better for OP to post multiple with attempted code/ideas – UnknownOctopus Jun 29 '15 at 23:01
  • Batch files are a worst case fall-back for when you have nothing else, or when you enjoy their particular discomforts as a challenge. If you have a choice, and you don't know how to use them, and you aren't doing it so you can try to work it out for yourself ... why on earth are you using batch files at all? – TessellatingHeckler Jun 30 '15 at 00:35
  • 1
    @TessallatingHacker Yes I know that batch isn't good for games, but I'm new to programming, batch is my first language, so if you don't have anything that is useful look somewhere else. – ender_scythe Jun 30 '15 at 00:47
  • Please show a sample of your `.stmsave` file, don't assume we know what its format is. – Magoo Jun 30 '15 at 00:48
  • .stmsave is basically a .txt but with a fancier name. – ender_scythe Jun 30 '15 at 00:49
  • 1
    I suggest you to try to write better questions; for example: **1.** Don't provide information that is not directly related to the problem, like the name of the game, the extension used, and the multiple code segments that seems have not any purpose. **2.** Be much clearer in your request. I read several times this question and still don't understand what you want. Is "how to order several values stored in variables", perhaps? **3.** Always post a small example of your input data and the desired output. **->** Don't post additional information in comments! Edit the original question instead. – Aacini Jun 30 '15 at 03:37

1 Answers1

0

Commenters are right, your question is quite vague and confused. But to answer your only real question "The only thing is, how do I order the echo":

(
  echo %Name_1%
  echo %Name_2%
  echo %Name_3%
  echo %Name_4%
  echo %Name_5%
)|sort

I'm sure, that is not quite what you want, but it's what you asked for. Nevertheless, it should push you into the right direction.

Edit: Probably this can help you.

Community
  • 1
  • 1
Stephan
  • 53,940
  • 10
  • 58
  • 91