Is there a way to stop the enter key from restarting a project?
The problem is that when I take user input, if the user hits "Enter" when the dialog box is not up the program restarts.
Thanks, Dave
Offline
Not much of a problem for me.
I don't think there's a way to change that though. It might not happen with panther and some of the other mods.
Offline
The enter key doesn't necessarily restart the project, it just runs all the green-flag scripts. For this reason, I would recommend avoiding the "When flag pressed" hat as much as possible. Instead, start all your scripts with "When I receive [startProject]". Then add a single script to trigger all of these scripts:
When flag clicked: broadcast [startProject]
This can be improved upon to prevent the enter key from doing anything. Create a variable called "runAlready" and use this script:
When flag clicked: if <runAlready = 0> change runAlready by 1 broadcast [startProject]
That way, [startProject] is only broadcasted once, unless the runAlready variable is reset. Hope this helps!
Offline
woah! i never noticed that...
O_o
just had my mind blown...
Offline
fullmoon wrote:
The enter key doesn't necessarily restart the project, it just runs all the green-flag scripts. For this reason, I would recommend avoiding the "When flag pressed" hat as much as possible. Instead, start all your scripts with "When I receive [startProject]". Then add a single script to trigger all of these scripts:
Code:
When flag clicked: broadcast [startProject]This can be improved upon to prevent the enter key from doing anything. Create a variable called "runAlready" and use this script:
Code:
When flag clicked: if <runAlready = 0> change runAlready by 1 broadcast [startProject]That way, [startProject] is only broadcasted once, unless the runAlready variable is reset. Hope this helps!
Thanks fullmoon- I tried this but it causes the program to hang if the player presses "enter" twice by acccident when using the "ASK" to get keyboard input.
Thanks, Dave
Offline
irobot wrote:
fullmoon wrote:
The enter key doesn't necessarily restart the project, it just runs all the green-flag scripts. For this reason, I would recommend avoiding the "When flag pressed" hat as much as possible. Instead, start all your scripts with "When I receive [startProject]". Then add a single script to trigger all of these scripts:
Code:
When flag clicked: broadcast [startProject]This can be improved upon to prevent the enter key from doing anything. Create a variable called "runAlready" and use this script:
Code:
When flag clicked: if <runAlready = 0> change runAlready by 1 broadcast [startProject]That way, [startProject] is only broadcasted once, unless the runAlready variable is reset. Hope this helps!
Thanks fullmoon- I tried this but it causes the program to hang if the player presses "enter" twice by acccident when using the "ASK" to get keyboard input.
Thanks, Dave
Actually, that glitch appears to be universal. Try a project that uses a lot of green-flag hats and then test the "ask" block...the same thing will happen.
Offline