How to check for input. in Developer Help
|
|
So far I have this code that makes icons A,S,D, and F pop up on screen. I also have macros to press if for example you have to press A,S, or etc. But I want to make something to check when and if a the right key is pressed for the right icon in the PHY_Training proc. Thank you.
proc/PHY_Training() var/Rand_Training = rand(1,4)
var/icon/A = icon('TArrows.dmi',"A") var/icon/S = icon('TArrows.dmi',"S") var/icon/D = icon('TArrows.dmi',"D") var/icon/F = icon('TArrows.dmi',"F")
if(Rand_Training == 1) usr<<"\icon[A]"
else if(Rand_Training == 2) usr<<"\icon[S]"
else if(Rand_Training == 3) usr<<"\icon[D]"
else if(Rand_Training == 4) usr<<"\icon[F]"
else return
obj/Training/Dummy icon = 'smoke.dmi' icon_state = "TrainingDummy" density = 1 verb/Train() set category = "Training" set src in oview(1) PHY_Training()
|
|
For your question. You'll have to make a built-in game macro for each of the keys (technically, you don't have to, since the players can make their own) through the interface editor.
The macros should all refer to the same (hidden) verb with the key as an argument. From the verb you can then check if the key is correct or do whatever with it.
Just make sure though, that if a player sends the wrong command (or presses the wrong key;same thing) then you explicitly make him fail the test; if your only condition is sending the right command, then a pesky player might be able to cheat by making a macro to send all the possible commands "at once".