基于Batch编写叙事驱动型办公室RPG游戏的技术咨询
Batch Scripting: Building a Narrative-Driven Office RPG – Technical Questions
Hey everyone! I’m currently learning Batch scripting and working on a narrative-driven mini adventure RPG for the RPG fans in my office. I’ve hit a few technical snags and wanted to reach out for advice. Here’s the partial code I’ve written so far:
@echo off color F0 title The Kingdom of Kovalor type Titlescreen.txt pause >nul goto MainMenu :MainMenu cls type mainmenu.txt echo. echo Type in option and press Enter. Set /p menu= if "%menu%" equ "new game" goto NewGame if %menu% equ credits goto Credits if "%menu%" equ "load game" goto LGame echo T...
Key Issues I’m Trying to Solve
Looking at my current code, I’ve spotted a few areas that need work and would love input:
- Case sensitivity: Right now, input checks are case-locked—if someone types "New Game" instead of "new game", the script won’t recognize it. I need to make these checks case-insensitive.
- Invalid input handling: If a user types something that isn’t one of the three options, the script just outputs "T..." and stalls. I want to add logic to catch bad inputs and loop back to the main menu.
- Variable quoting inconsistency: The second check uses
if %menu% equ creditswithout quotes around%menu%—I’m worried this will cause syntax errors if someone enters input with spaces or special characters. Should I be quoting all variable references here?
Any guidance on these points, plus general tips for making an interactive, smooth narrative RPG in Batch would be a huge help!
内容的提问来源于stack exchange,提问作者DavidRM
相关产品推荐
相关产品推荐

