mardi 22 décembre 2015

If statement in batch: a variable equals a certain number range, it should echo JUST ONE of the echos

I'll try to keep it simple.

echo Your Stats:

echo Health: %hp%
if %hp% LEQ 100 echo (Healthy)
if %hp% LEQ 75 echo (Hurt)
if %hp% LEQ 25 echo (Injured)
if %hp% LEQ 1 echo (Near Death)
if %hp% LEQ 0 echo (Rekt)
echo Reputation: %rep%
if %rep% LEQ 500 echo (King of the School)
if %rep% LEQ 200 echo (Popular)
if %rep% LEQ 50 echo (Accepted)
if %rep% LEQ 1 echo (Bully-Victim)
if %rep% LEQ 0 echo (Queerboy)
echo Confidence: %conf%
if %conf% LEQ 300 echo (Feels like he can do anything)
if %conf% LEQ 200 echo (Very Confident)
if %conf% LEQ 100 echo (Confident)
if %conf% LEQ 1 echo (So-So Confident)
if %conf% LEQ 0 echo (What's Confidence?)
echo Intelligence: %int%
if %int% LEQ 500 echo (Know-It-All)
if %int% LEQ 300 echo (Brainy)
if %int% LEQ 100 echo (Smart)
if %int% LEQ 1 echo (Decent Grades)
if %int% LEQ 0 echo (Dumb)
echo Strength: %str%
if %str% LEQ 500 echo (The Incredible Jackie Chan Hulk)
if %str% LEQ 300 echo (Mike Tyson on steriods)
if %str% LEQ 100 echo (Strong)
if %str% LEQ 1 echo (Average Joe)
if %str% LEQ 0 echo (Paper feels like a Boulder)
echo Happiness: %hap%
if %hap% LEQ 300 echo (WOOOOO!)
if %hap% LEQ 100 echo (Happy)
if %hap% LEQ 50 echo (Sort of Happy)
if %hap% LEQ 1 echo (Barley Happy)
if %hap% LEQ 0 echo (Depressed)
echo Stamina: %stam%
if %stam% LEQ 100 echo (Energetic)
if %stam% LEQ 75 echo (Wide-Awake)
if %stam% LEQ 50 echo (Tired)
if %stam% LEQ 1 echo (Barley Awake)
if %stam% LEQ 0 echo (Passed Out)
echo Swag: %swg%
if %swg% LEQ 500 echo (Swag Master)
if %swg% LEQ 300 echo (Swag King)
if %swg% LEQ 100 echo (Swag)
if %swg% LEQ 1 echo (Some Swag)
if %swg% LEQ 0 echo (Cancer)
echo Hunger: %hngr%
if %hngr% LEQ 100 echo (Well-Fed)
if %hngr% LEQ 75 echo (Little Hungry)
if %hngr% LEQ 25 echo (Pretty Hungry)
if %hngr% LEQ 1 echo (Near Starvation)
if %hngr% LEQ 0 echo (No Stomach)
echo Thirst: %trst%
if %trst% LEQ 100 echo (Well Quenched)
if %trst% LEQ 75 echo (Little Thirsty)
if %trst% LEQ 25 echo (Pretty Thirsty)
if %trst% LEQ 1 echo (Nearly Dried up)
if %trst% LEQ 0 echo (Dryer Than a Bone)
echo Money: $%cash% 
echo You Got the "%end%" ending!
set /a deaths=%deaths%+1
pause
goto start

So basically, what I want to happen here is that it lists your stats, and for each stat it gives you a rank. (I.E Having 100 Health, it will say "Healthy")

However, it seems to list ALL of the ranks. (I.E If %int%=0, it will say Know-It-All, Brainy, Smart, Decent Grades, and Dumb, whereas I just want it to say "Dumb") Is there a way I can make it so that it only lists one rank per stat?

Let me know if there is any clarification needed, and thank you in advanced.

Aucun commentaire:

Enregistrer un commentaire