OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: JasonO on 21 Oct 2007, 04:32:44

Title: [SOLVED] Detecting Key Press?
Post by: JasonO on 21 Oct 2007, 04:32:44
Hi

I been trying to figure out how to get the Key press detection thing (that's what it's called, right? :P) to work, and I can't seem to get any output from it.

Code: [Select]
(findDisplay 46) displaySetEventHandler ["KeyDown", {hint format ["%1",_this select 1]}]
That should give me the id/number of the key pressed, I think?

I'm going to have a look at Mando Draw, or Mando Paint.. where you can draw in the middle of the screen from your weapon direction.. may be something obvious.
Title: Re: Detecting Key Press?
Post by: Mandoble on 21 Oct 2007, 13:53:19
This is correct, but display 46 is not "ready" as soon as you start teh mission, so if you use that in your init.sqs, make sure to wait a second before that line.
Title: Re: Detecting Key Press?
Post by: Spooner on 21 Oct 2007, 13:56:06
Code: [Select]
waitUntil { not (isNull (findDisplay 46)) };
Is the less fudgy way than waiting an arbitrary amount of time, but one second will always be enough :D
Title: Re: Detecting Key Press?
Post by: JasonO on 21 Oct 2007, 18:12:10
That was it. Was in init.sqs and no delay was before it. Added your line spooner (well sqs format, since thats what the rest of my init is).

Solved!  :good: