Game crashes at set /p race=:.

November 30, 2013 at 20:32:56
Specs: Windows 7
So I am making an RPG in batch since it is the programming language I am fluent in. I typed the following code:

echo.
echo Welcome %name%!
echo.
echo What race are you?
echo.
set /p race=:

The window closed once it got to "set /p race=:". Anyone know the problem?


See More: Game crashes at set /p race=:.

Report •

#1
November 30, 2013 at 20:41:51
Well, if that's the entirety of the script, it's because the script ended.

How To Ask Questions The Smart Way


Report •

#2
November 30, 2013 at 23:35:58
It is not the entire script. I have more but the coding should at least give me the option to have an input instead of simply closing. This part of the script worked perfectly fine until I started adding more to other parts. Then it stopped working.

Report •

#3
December 1, 2013 at 11:33:08
For some reason the snippet worked ok, or at least the set /p race part of it.

if you remove the @echo off, it should show where(roughly) it is failing.

you could always try set /p race=":" see if that makes a difference on your system.

::mike


Report •

Related Solutions

#4
December 1, 2013 at 19:31:37
yeh, the "set /p" should hang for an input, unless something is feeding into it via a redirect, such as:
set /p x=<file.txt

which would not hang if there is one crlf in file.txt. I would try putting a pause immediately before and after the "set" statement, to try and get some error message output before the window closes. (As microsoft advances, batch-support and cmd support seem to decline. Win-7 does not allow "full-screen" mode, which is my most comfortable zone.) ANYway, once the window closes, you can no longer see any errormsg which flash quickly, without a "pause" or else sending &2 output to a logfile.

Report •

#5
December 2, 2013 at 03:57:32
There's probably a syntax error just before the prompt. Of course, we can't point it out because your snippet doesn't include the error.

How To Ask Questions The Smart Way


Report •

#6
December 2, 2013 at 19:22:36
I put a pause before and after the "set /p race=:" However it did not make a difference. The program just shut off before the second pause. Also adding "s did not make any difference.

Report •

#7
December 2, 2013 at 21:20:14
It might be a WIN-7 issue, or it might be your additional code. If you could post your code, I could try to duplicate the problem on my terrain (always essential to solving). The only other suggestion I have is to have all the output redirected to a log file so the window-slam doesn't erase error-messages. (they should subsequently reside in a text file somewhere of your own delineation.)
(Or maybe it's a political correctness virus! You used the "race" word!)
Oh! one last thought: make sure there are no "strange" characters in your batch at the line in question. You can use "edit /70" to see them.

message edited by nbrane


Report •

#8
December 3, 2013 at 07:24:50
Look, the code you posted works. We know that.
The code you're not posting doesn't work. We know that.

We can keep running around in circles, but these are very boring circles. Either post the entire thing so we can find the problem, or leave echo on, and run your script from the Command Prompt so you can follow the script's flow.

How To Ask Questions The Smart Way


Report •

#9
December 3, 2013 at 13:27:47
@razor: my win-7 won't let me run cmd in full-screen mode (alwyas my preference). Is there a way to override that? I'd like to be able to. Or does it depend on which 7 is running (ultimate, proffessional, etc - they give you several choices and I never know which one is best to choose).

Report •

#10
December 4, 2013 at 05:32:49
I think that's part of the 16-bit subsystem they removed in x64. You can get a decent approximation by playing with the font and window size, but that's the best I can suggest.

How To Ask Questions The Smart Way


Report •

#11
December 4, 2013 at 12:11:28
if you want to just play around with a command prompt, in "dos", I use oracle with a dos 7.1 install. It seems to run great in full screen.

::mike


Report •

Ask Question