Jump to content
Rosso777

addAction key change?

Recommended Posts

On Biki, the addAction reads like this: "Adds an entry to the action menu of an object (scroll wheel menu)."

 

Is it possible to add a menu that's NOT activated by the scroll wheel?

 

For example, I am thinking about giving the itemRadio object a few more options (Call a Taxi, Call for Extraction, etc.) but the menu only appears if a specific button is pressed; having a permanent scroll wheel menu once picking up a radio would be obnoxiously annoying.

 

Is this doable?

Share this post


Link to post
Share on other sites

Not sure if I understood your intentions correctly, but you may try inputAction method to have a "shortcut" keys to those options you want to implement. For this use "shortcut" param within the addAction command and choose one of the specific "action name" from the table below. This way, you could have for example: "Q" (leanLeft action) bound to "Call a Taxi" option and "E" key (leanRight action) bound to "Call for Extraction" option. Is this what you want to achieve, more or less?
https://community.bistudio.com/wiki/inputAction/actions

Share this post


Link to post
Share on other sites

Could theoretically be done as an extension of ACE's self-interaction menu perhaps. Though I'm no expert when it comes to that sort of thing but I imagine any documentation explaining the process could be found on the ACE website/github/wiki/whatever.

  • Like 1

Share this post


Link to post
Share on other sites

Use the dialog widget library to create a menu, which is shown when a key is pressed if the item in inventory.

https://community.bistudio.com/wiki/Arma:_GUI_Configuration#Controls

But hard coded keys will make your mod unplayable to anyone that does not use your key binding scheme.  Another option is to have a button display near the radio icon in the inventory, like how Invade and Annex has a lock backpack toggle button.

  • Like 2

Share this post


Link to post
Share on other sites

Yes, it's possible.

You need a little code for setting a variable, then a condition with this variable in your addAction.

 

Say, you want to add action on a box named box1.

 

code (init.sqf or initPlayerlocal.sqf)

[] spawn {
  waitUntil {sleep 1; !isNull findDisplay 46};
  (findDisplay 46) displayAddEventHandler["KeyDown","
    if ((_this select 1) == 35) exitWith {box1 setVariable ['useIt',TRUE]};
    box1 setVariable ['useIt',FALSE];
  "];
  (findDisplay 46) displayAddEventHandler["KeyUp","

    _this spawn {

      sleep 2;
      if ((_this select 1) == 35) then {box1 setVariable ['useIt',FALSE]};

    };
  "];
};

 

Notes:

1 - this code runs for pressing/depressing H key (so DIK code = 35)

2 - I added a sleep 2 (so spawned the keyUp EH code) just to avoid keeping the H key while enter for the add action. You have 2 seconds to choose the menu.

 

So, now, you addAction must also looks like:

this (or box1)  addAction ["call taxi",{
  params ["_tgt","_caller","_id"];
  hint "ok";
},nil,0.8,false,true,"", "(_target getvariable ['useIt',false])"];

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×