Solved How do I make a money system for a batch RPG?

Dell Inspiron black 15r notebook
August 5, 2013 at 13:02:08
Specs: Windows 7, N/A
I have been trying to make a batch rpg for ever. I just got around to it but I can't figure out how to make a working money system

Like you buy stuff and it takes money and When you sell stuff you get it or by leveling up.

Help? :S



See More: How do I make a money system for a batch RPG?

Report •


#1
August 6, 2013 at 06:08:31
So, do you want my standard rant against performing anything remotely complex in batch, or are you good?

How To Ask Questions The Smart Way


Report •

#2
August 6, 2013 at 11:08:46
It's not too complex I'm sure it easy the problem was this.

@echo off
set money=100
:start
echo Press 1 for a taco
set /p item=
if %item%==1 & %money%>0 set %money%=%money%-20
pause>nul
goto show

:show
echo %money%
pause


But It always says

"& was unexpected"


Report •

#3
August 6, 2013 at 14:32:45
✔ Best Answer
::@echo off
::set /a money=100
::start
::presuming that a taco costs one unit of money
::echo Press 1 for a taco
::set /p item=
::if %money% lss 1 echo you do not have enough money && goto start
::set /a money=money-1
::show
::echo %money%
::pause


::another other choice would be to assign each item of food an amount and compare variables.
@echo off
set /a money=100
:start
::presuming that a taco costs one unit of money
echo you may select the following items: taco : sprite : chicken
set /a taco=1
set /a sprite=2
set /a chicken=3
set /p item="please type what you want: "
set /a item=%item%
set /a cost=item
if %money% lss %cost% echo you do not have enough money && goto start
set /a money=money-item
:show
echo %money%
pause
goto start

:: mike


Report •

Related Solutions

#4
August 7, 2013 at 14:57:00
THANKS BRO! You're awesome! :D

Report •

#5
August 8, 2013 at 06:20:05
I still agree with Razor2.3, that batch is not the best for this kind of setup, however, its still fun to mess with if you want to. Not knowing your experience with batch you might consider thinking about

http://ss64.com/nt/call.html
http://ss64.com/nt/syntax-redirecti...

I am not sure how complicated you are getting, however it might help

:: mike


Report •


Ask Question