Home   Help Search Login Register  

Author Topic: [SOLVED] Detecting Key Press?  (Read 1968 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
[SOLVED] Detecting Key Press?
« 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.
« Last Edit: 21 Oct 2007, 18:15:20 by JasonO »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Key Press?
« Reply #1 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.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detecting Key Press?
« Reply #2 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
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detecting Key Press?
« Reply #3 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: