mercredi 8 avril 2020

Why is my randomised code not working in Batch?

I don't really understand what the problem is. I am not a pro at Batch since I've only been learning it for a few weeks now. I am trying to make a Pokémon game. Right now I am coding a bin looting function. If you do change the code, can you make it not complicated because I want to understand it, thanks. Here is the code:

@echo off
:setvariables
cls
set/a pokeballs=0
set/a potions=0
set/a pokemondollar=0

:Loot_Bin1
cls
echo You loot the bin.
pause
set/a a=%random% %% 3 + 1

if %a% == 1 set/a potions+=2;goto PotionConfirmation
if %a% == 2 set/a pokeballs+=2;goto PokeballConfirmation
if %a% == 3 set/a pokemondollar+=200;goto DollarConfirmation


:PotionConfirmation
cls
echo You now have %potions% Potions!
pause
exit

:PokeballConfirmation
cls
echo You now have %pokeballs% Pokeballs!
pause
exit

:DollarConfirmation
cls
echo You now have %pokemondollar% Pokemon Dollars!
pause
exit



Aucun commentaire:

Enregistrer un commentaire