I want to make a game in MS-DOS and I'm stuck with a problem:
How to ask the user for input without stopping the console?
I've considered stopping it for a few milliseconds and giving the illusion that the console didn't stop:
@echo off
:inicio
choice /c awds0 /t 0.30 /d 0
if %errorlevel%==1 echo izquierda.
goto inicio
pause
exit
But it gives me an error:
Only a number from -1 to 999 is allowed
I have also tried to place:
choice /c awds0 /t 0 /d 0
But the key is not detected even if I put it in a bucle
goto:
@echo off
:inicio
choice /c awds0 /t 0 /d 0
if not %errorlevel%==5 goto end
goto inicio
:end
echo se terminó el programa
pause
exit
input: a....
output: Infinity loop
The other option I think is to capture the click event of the window, but I don't know how and I can't find how to do it.
Note: I use windows 7 32bits. The console that I use is the one that comes by default with the operating system.
External links:
- Answer from: Read key in batch? : This answer is pretty close to what I'm looking for, but running it freezes the console until I type the key.