Missing operand and aslo crashing

November 2, 2014 at 13:57:19
Specs: Windows 8
I am still working on cookie clicker and I have hit another roadblock, since coming here worked last time so I thought I might come here again.

I am having troubles with this part of the code, every time I add another cookie to the "Cookie_Count" my program closes, and also im getting that missing operand again on my Main Menu...

:Start
@echo off
title Cookie Clicker!
cls
cd C:\Users\Games\Desktop\Game_Info
set /p Cookie_Count=<Cookie_Clicker.txt
set /a Oven=<Oven(s).txt
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Welcome To Cookie Clicker!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo 1) Start
echo 2) Store
echo 3) Info
echo 4) Cridits
echo.
echo You Have Baked %Cookie_Count% Cookies's!
echo.
set /P Select= Please Choose One Of The Options:

if %Select%==1 goto Game
if %Select%==2 goto Store

:Game
cls
cd C:\Users\Games\Desktop\Game_Info
set /p Cookie_Count=<Cookie_Clicker.txt

echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Just Press Any Key To Start
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo.
echo You Have Baked %Cookie_Count% Cookies's!
echo.
pause
if %Oven%==0 set /a Cookie_Count=%Cookie_Count%+1
if %Oven%==1 set /a Cookie_Count=%Cookie_Count%+10
if %Oven%==2 set /a Cookie_Count=%Cookie_Count%+20
if %Oven%==3 set /a Cookie_Count=%Cookie_Count%+30
if %Oven%==4 set /a Cookie_Count=%Cookie_Count%+40
if %Oven%==5 set /a Cookie_Count=%Cookie_Count%+50
if %Oven%==6 set /a Cookie_Count=%Cookie_Count%+60
if %Oven%==7 set /a Cookie_Count=%Cookie_Count%+70
if %Oven%==8 set /a Cookie_Count=%Cookie_Count%+80
if %Oven%==9 set /a Cookie_Count=%Cookie_Count%+90
if %Oven%==10 set /a Cookie_Count=%Cookie_Count%+100
del Cookie_Clicker.txt
@echo %Cookie_Count% >> Cookie_Clicker.txt
goto Game
:Store
@echo off
title Store
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Welcome To The Store
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo Welcome to the store, with your cookies you can trade for goods!
echo.
echo 1) Oven ( Each one bought adds ten cookies per batch )
echo Cost: 1000 Cookies
echo 2)
echo 3)
echo 4)
echo 5)
echo.
echo type "back" to goto the main menu
echo.

set /P Buy= Please Choose One...

cd C:\Users\Games\Desktop\Game_Info
if %Buy%==1 set /a Oven=%Oven%+1
set /a Oven=<%Oven(s)%.txt
del Oven(s).txt
if %Buy%==1 @echo %Oven% >> Oven(s).txt
if %Buy%==1 set /a %Cookie_Count%-1000
goto StartCan anyone please help?

message edited by Smev1


See More: Missing operand and aslo crashing

Report •


#1
November 2, 2014 at 17:47:05
Same as last time:
set /a Oven=<Oven(s).txt

this calls for an "a" Arithmatic operation, not a "p" Prompt operation, which is what you wanted. In this case, the prompt is filled by the first line of the file.
When using () in filenames, (which I don't recommend), I DO recommend that you use quotes around it in batch.
set /p Oven=<"Oven(s).txt"


Report •

#2
November 4, 2014 at 13:29:58
Dude, you are the best, but I added more code to the program im not sure if this makes your advice irrelevant.

If your answer works then ill tell you if not then please look at the code again


Report •

#3
November 4, 2014 at 13:33:20
Umm, I cant seem to edit this question so im going to just start a new one with the new code

Report •
Related Solutions


Ask Question