While I was making my small batch game I thought of implementing a "auto dialog" function. Here it is:
:Background_Work
SET /p Auto_Text=Would you like to have auto dialog on or off (y/n)?
IF '%Auto_Text%'=='y' GOTO Auto_Yes
IF '%Auto_Text%'=='n' GOTO Auto_No
:Auto_Yes
SET TMode=TIMEOUT /t 7 /nobreak
GOTO Speech_Start
:Auto_No
SET TMode=PAUSE
GOTO Speech_Start
Here is what happens after the "auto dialog" function:
:Speech_Start
ECHO Hello, my name is ZERO.
%TMode%
Everything works, if I were to input "y" then it will display the part under ":Speech_Start" as:
Hello, my name is ZERO.
Waiting for 7 seconds, press CTRL+C to quit...
and if I were to input "n" then it will display it as:
Hello, my name is ZERO.
Press any key to continue . . .
The issue I have is, I cant seam to get rid of the TIMEOUT and PAUSE messages. I have tried changing the "auto dialog" function to this:
:Background_Work
SET /p Auto_Text=Would you like to have auto dialog on or off (y/n)?
IF '%Auto_Text%'=='y' GOTO Auto_Yes
IF '%Auto_Text%'=='n' GOTO Auto_No
:Auto_Yes
SET TMode=TIMEOUT /t 7 /nobreak > NUL
GOTO Speech_Start
:Auto_No
SET TMode=PAUSE > NUL
GOTO Speech_Start
But it still displays the default messages. Anyone know how to get rid of them?
SET TMode=TIMEOUT /t 7 /nobreak > NULandSET TMode=PAUSE > NUL>is a redirector - a special character. If you were to tryset tmodebefore the%tmode%you'd see thattmodedoesn't have the>nul. Since>is a special character, you need to escape it with a caret if it's not being used as a redirector. TrySET TMode=PAUSE ^> NULor preferablySET "TMode=PAUSE ^> NUL"(the quotes ensure unwanted trailing spaces are not included in the value assigned).