Strange bug with player input

Asyranok
06 Apr 2013, 22:56
Hey guys,

The following code isn't working properly. I have identical code in WAKE (only difference being content) that works perfectly.

However, in a demo game that I have made, this code is not working properly.

It requests the user's first name. It then displays that name back to them in a personalized greeting. However, it ignores the first input that a user gives it. You have to type your name into the command line and press enter, and then type your name again and press enter again. On the second try, it works.

However - If I delete the "ClearScreen" and test it again, then the code works correctly the first time. Then, every consecutive time it stops working. The same thing happens when adding "ClearScreen" back. I'm fairly certain it is a bug, but I realize it could be a mistake on my part as well. Any help is appreciated. And if it is a bug, any workaround would be amazing as I will have to present this program on Monday or Tuesday.

ClearScreen
msg ("What is your first name?<br/><br/><br/><font size=\"2\"><i>(Type it below)</i></font>")
get input {
player.alias = result
ClearScreen
msg ("It's nice to meet you, " + player.alias + ". Let's get started.")
msg ("<br/><br/><font size=\"2\">(Press any key to continue)</font>")
wait {
ClearScreen
msg ("You are at home on your computer, having just finished all of your work for the day.<br/><br/>You smile over the sense of satisfaction you feel in completing everything you've been assigned. As you exhale, the worries on your mind fade away.<br/><br/>Now it's time to play...<br/><br/>You grab your football, baseball glove, and game controller. Who knows what your friends will want to play today? Might as well bring it all!<br/><br/>But when you go to turn your computer off, something strange happens. The computer ignores your command.<br/><br/>So you reach down to the cord and safely pull it out. To your amazement, the computer is still on.<br/><br/>This defies logic. How could the computer be powered when there's no cord attached to supply it with electricity?<br/><br/>You decide to investigate...<br/>")
MakeObjectVisible (Computer)
MakeObjectVisible (SportsGear)
MakeObjectVisible (PowerSocket)
MakeObjectVisible (Desk)
}
}

Asyranok
07 Apr 2013, 00:49
It is now working correctly - not thanks to anything I have done. It just happens when it wants to, and stops happening because it enjoys confusing me. :D

Sora574
07 Apr 2013, 00:53
Asyranok wrote:It is now working correctly - not thanks to anything I have done. It just happens when it wants to, and stops happening because it enjoys confusing me. :D


I was about to post that I couldn't find anything wrong with it... I tested and re-tested and it seems to work perfectly every time.
Maybe you put it inside of another script by accident?

Anyways, glad you fixed it.