Key inputs
BlitzPlus Forums/BlitzPlus Beginners Area/Key inputs
| ||
for some reason i want to use key inputs more than once hope it makes sense: (not working code just an horrible example) selectcounter = 1 if selectcounter = 1 if keyhit(28) selectcounter = 2 end if end if if selectcounter = 2 if keyhit(28) selectplay = true end if end if |
| ||
KeyHit(), for any key being tested, will return either '1' or 'zero', and these are Integer numerical values. You can store the call in a variable to register the keystate at that time. You can also use them in interesting ways, mathematically (since you can use '1' or 'zero' multiplied by a value to modulate it, and spare the necessary IFs for that). [bbcode] ;Key Sampling: Local enterHit = KeyHit(28) ;Sampling Enter key state. Local ctrlHit = KeyHit(29) Or KeyHit(157) ;Sampling both left and right CTRLs at the same time. ;Key Testing: If enterHit Then selectCounter = 2 EndIf If ctrlHit Then ;If at least one of the CTRL keys is being pressed, [...]. EndIf [/bbcode]Only do the above for KeyHit()'s. For KeyDown() you should really call it repeatedly, and as many times as needed; it's supposed to be used this way. |
| ||
didnt work Last edited 2012 |