How do I Test For Keyboard Presses

Get help using Construct 2

Post » Sun Nov 29, 2015 11:06 pm

Hi, again.

Currently, I'm trying to get a system working where if you press on the keyboard, the button is typed down on screen and the system can compare that text to a text constant and figure out what to do next.

I have it down as the following:
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Global constant text PRESSN = "N"
Global constant text typeCheck = 0

System PRESSN= "Keyboard.StringFromKeyCode" | System typeCheck (greater or equal to) 1 | System Every tick
Cursor2 Append "N"
--------------------------------------------------------------------------------------------------------------------------------------------------------------
(Note: the point of the "typeCheck" variable is to limit when the text will be type on screen and is changed to "1" once you are allowed to type on another event)
And then from there on another event I would have it check that "Cursor2" would have written down "N" and continue on with the event for "N". My problem is that I don't necessarily understand the keyboard expressions and therefor probably am using it wrong. Please help!
B
5
S
1
Posts: 6
Reputation: 337

Post » Sun Nov 29, 2015 11:13 pm

I guess I don't understand what exactly you are trying to do..

Why not just use text append : Keyboard.StringFromKeyCode

Or a simple keyboard on n pressed?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Nov 29, 2015 11:20 pm

I just had a dumb moment. I didn't realize that Keyboard On meant that you could then choose which key you pressed. Thanks for clearing that up for me.
B
5
S
1
Posts: 6
Reputation: 337


Return to How do I....?

Who is online

Users browsing this forum: khelaghor and 9 guests