Keypress or Wait?
Posted: 02 Nov 2008, 23:33
Is there a way to detect in code if a key was pressed?
Also, what is the best way to have your code "wait" for something. Trying to work on my Ferry widget again and at the moment I have it so that your transport is put on Wait, and you start Shift+Right Clicking to create the waypoints. When I'm done doing that, hitting W will activate the rest of the ferry actions (stop waiting, convert last point to unload zone, add load zone at current position, repeat). But I don't know of how to have my widget wait till I'm done. I think the last time I used a while() loop I froze something. Is there a proper way to either detect if they key is pressed, or perhaps if the unit started moving (while speed is not 0)?
Also, what is the best way to have your code "wait" for something. Trying to work on my Ferry widget again and at the moment I have it so that your transport is put on Wait, and you start Shift+Right Clicking to create the waypoints. When I'm done doing that, hitting W will activate the rest of the ferry actions (stop waiting, convert last point to unload zone, add load zone at current position, repeat). But I don't know of how to have my widget wait till I'm done. I think the last time I used a while() loop I froze something. Is there a proper way to either detect if they key is pressed, or perhaps if the unit started moving (while speed is not 0)?