试图制作cmd游戏/模拟游戏

时间:2014-03-05 22:14:26

标签: cmd calculator simulator

我正在尝试制作cmd游戏/ sim卡。但数字不会改变!我觉得这样的磨砂膏,我可能是一个大白痴...这里是所有的代码,如果你想对我大喊大叫

*YELLING* text here *YELLING*

所有代码:

@echo off
title Gold Economics Sim. 2014

goto info

:info
set/a money=100000
set/a gold=10
set/a gldpk=31300
set/a golda=0
set/a moneya=0

goto begin

->:tstpg
->cls
->echo You have %money% Dollar
->echo You have %gold% KG gold
->echo The gold price is %gldpk% Dollar
->echo How much gold do you want?
->
->:tstpgc
->set/p tstpgc=""
->goto buytst
->
->:buytst
->set/a golda=gold+testpgc
->set/a moneya=money-testpgc*gldph
->
->goto tstpg2
->
->:tstpg2
->echo You have %moneya% Dollar
->echo You have %golda% KG gold
->echo The gold price is %gldpk% Dollar
->pause

:begin
cls
echo ==============================================================================
echo                                  Main Menu
echo ==============================================================================
echo  Welcome to Gold Economics Sim. 2014! The goal of this 'Game' is to earn
echo  as much money as you can in three-four years. There's also a custom mode where
echo  you can edit all the game settings! Hope you enjoy this preview game!
echo(
echo  Type "start"          to begin
echo  Type "options"        to change the settings
echo  Type "help"           to get help
echo  Type "quit" or "exit" to quit
echo(
echo V0.1
echo ==============================================================================

:beginc
set/p beginc=""
if "%beginc%"=="start" goto start
if "%beginc%"=="help" goto help
if "%beginc%"=="options" goto options
if "%beginc%"=="quit" exit
if "%beginc%"=="exit" exit
if "%beginc%"=="test page" goto tstpg 
if "%beginc%"=="clean" goto begin
echo Sorry, but I don't understand that.
goto beginc

我很抱歉,如果这只是一个非常愚蠢的错误,我对此感到沮丧一个小时并且无法修复它,所以我希望有人可以修复它吗?如果你帮忙,我会把你放在学分中,试图解决它,修复它或没有修复它。

编辑:很抱歉,我没有真正解释我的问题/问题,我还没有使用if "%beginc%"=="options" goto options这个问题。那是我的错。问题是带有这些箭头的代码( - >)不会改变。

2 个答案:

答案 0 :(得分:0)

唯一最大的问题是缺少的目的地。

if "%beginc%"=="start" goto start
if "%beginc%"=="help" goto help
if "%beginc%"=="options" goto options
if "%beginc%"=="quit" exit
if "%beginc%"=="exit" exit
if "%beginc%"=="test page" goto tstpg 
if "%beginc%"=="clean" goto begin

:start:options:help尚未在代码中的任何位置定义。

至于Windows Batch是否适合任何语言,请参阅RosettaCode上的batch language solutions

答案 1 :(得分:0)

哦,我知道,你没有任何适当的变量,例如: 如果你想让这个人在输入PLAY时开始你需要这个:

echo THE FRAME UP HERE!
set /p P1=
if %P1% equ PLAY goto PLAY_1
if %P1% neq PLAY goto MENU

(P1是将被调用的变量)

(neq one不是必需的,但它允许你制作拼写错误但不能杀死cmd.exe)