Reputation: 13
hello i'm making a basic text based adventure game in windows batch, i cant have spaces in user input.
my code is:
:quest1
cls
echo MUM: %PlayerName%, your breakfast is ready!!!
set /p PlayerInput1=">"
if %PlayerInput1%=="look around" echo you are in your bedroom upstairs in your house, in %PlayerHome%
with PlayerInput1 i want the user to input look around but when i try to run it it said: around=="look around" was unexpected at this time
how do i fix this
Upvotes: 1
Views: 1119
Reputation: 3256
:quest1
cls
echo MUM: %PlayerName%, your breakfast is ready!!!
set /p PlayerInput1=">"
if "%PlayerInput1%" =="look around" (echo "you are in your bedroom upstairs in your house, in" "%PlayerHome%")
You forget the quotes in if "%PlayerInput1%", and echo don't need to be between() but is a good practice. *Thanks to @Dennisvagils *
Upvotes: 2
Reputation: 9545
Put string between your variavle too :
set /p "PlayerInput1=^> "
if "%PlayerInput1%"=="look around" echo you are in your bedroom upstairs in your house, in %PlayerHome%
Upvotes: 1