【发布时间】:2014-03-05 22:14:25
【问题描述】:
我正在尝试制作一个 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 的东西。那是我的错误。问题是带有这些箭头 (->) 的代码不会改变。
【问题讨论】:
-
代码中没有开始标签:if "%beginc%"=="start" goto start
-
if /i "%beginc%"=="text"也将/i添加到您的比较中,然后字母大小写无关紧要。 -
哇,我不知道 foxidrive,谢谢。你解决了我在其他游戏中遇到的问题!
标签: cmd calculator simulator