Jump to content

Curator Interface "dynamic" button

Recommended Posts

I would like to add a custom button to the zeus/curator interface that disappears and reappears whenever backspace is pressed.


Can someone please help me in hooking the interface? About the button creation no problem.

Example code for the button


_display = findDisplay 312;

 _btn = _display ctrlCreate ["ctrlStaticPicture", -1];
 _btn ctrlSetPosition [0.85 * safezoneW + safezoneX, 0.15 * safezoneH + safezoneY, 0.062 * safezoneW, 0.020 * safezoneH];
 _btn ctrlSetText "#(rgb,8,8,3)color(0,0,0,0.675)";
 _btn ctrlCommit 0;


Thank you!

Share this post

Link to post
Share on other sites
#include "\a3\ui_f\hpp\definedikcodes.inc"
_curatorDisplay = findDisplay 312;
([] call BIS_fnc_GUIGrid) params ["", "", "_GUI_GRID_W", "_GUI_GRID_H"];
_btn = _curatorDisplay ctrlCreate ["RscButton", 2020];
_btn ctrlSetPosition [
	safezoneX + safezoneW - 23.6 * _GUI_GRID_W,
	safeZoneY + 1.6 * _GUI_GRID_H,
	11 * _GUI_GRID_W,
	1 * _GUI_GRID_H
_btn ctrlSetText "ACTION";
_btn ctrlCommit 0;

_curatorDisplay displayAddEventHandler ["KeyDown",{
	params ["_curatorDisplay", "_key"];
	if (_key in actionkeys 'curatorToggleInterface') then {
		_screenshotMode = uiNamespace getVariable ["RscDisplayCurator_screenshotMode", false];
		_btn = _curatorDisplay displayCtrl 2020;
		_btn ctrlEnable _screenshotMode;
		_fade = [0,1] select !_screenshotMode;
		_btn ctrlSetFade _fade;
		_btn ctrlCommit 0.1;

Adjusted the script so it fits the style of zeus interface. Your UI coordinates will not work on other UI settings (UI scale, aspect ratio, ...) so I switched them to the grid used by the Zeus interface. Also the base class "ctrlStaticPicture" is not interactable with. The hiding and showing of the button can be detected by a keyDown UIEH. The variable I used I got from the script that is executed when the Zeus display is opened (\a3\ui_f_curator\ui\displays\rscdisplaycurator.sqf).

  • Like 4

Share this post

Link to post
Share on other sites
21 hours ago, 7erra said:

_key in actionkeys 'curatorToggleInterface'

This will not work properly if the user has edited their Zeus toggle interface keybind to include a modifier ctrl, alt shift etc. It will only catch a none modifier key that could be bound to/or related to some other binding.

Maybe instead use inputAction "curatorToggleInterface", which will return 1 when ever the user actually uses their exact binding for this functionality.


  • Like 2

Share this post

Link to post
Share on other sites

@Larrow True. I used the way that BI does it in the script which I mentioned above. But inputAction seems to have quite a few problems of its own according to the BIKI notes?



This command also returns values other than 0 and 1 (like 0.02 or 1.3). Any value greater than zero usually signals that the key or button is pressed. inputAction does not work reliably when used in RscDisplayMission's onKeyDown event handler (the same is probably true for other input related event handlers).

Posted on May 8, 2014 - 15:18 (UTC)



inputAction does not return the actual state of the queried key when a dialog screen is open. Instead, it will always return 0.

Posted on July 31, 2015 - 05:33 (UTC)


Waffle SS.

inputAction is capable of returning the state of analog inputs. This includes mouse, joystick, and even TrackIR. A joystick axis will return a value from 0 to 1, while mouse movement returns the rate of change, which can be > 1.
Right mouse click is currently not supported, but right mouse hold is: https://feedback.bistudio.com/T83382


Share this post

Link to post
Share on other sites

Thank you guys. Both inputAction and actionKeys doesn't seem to work. I tried to have them in a hint under an onEachFrame loop (really simple and stupid debug), but I can't get anything prompted. I "solved" with a keyDown EH, when ctrl+shift+backspace are pressed, then the buttons get hidden/shown.

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