Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Recommended Posts

Hello Guys! Are there any method for persistent icon when i press one key? 

Share this post


Link to post
Share on other sites

probably yes even though I'm not sure what you mean by persistent icon

 

I mean if i press Shift + P i want that an icon remains on the right side of the display, but i don't know how. Any ideas?

Share this post


Link to post
Share on other sites

I get DLC browser if I press Shift+P

 

Yeah i know is an example lol

Share this post


Link to post
Share on other sites

Hello Guys! Are there any method for persistent icon when i press one key? 

 

Hello silente, try this code:

[] spawn {
        with uiNamespace do {
                icon = findDisplay 46 ctrlCreate ["RscPicture", -1];
                icon ctrlSetPosition [0.94 * safeZoneW + safeZoneX, 0.46 * safeZoneH + safeZoneY, 0.064 * safeZoneW, 0.085 * safeZoneH];
                icon ctrlCommit 0;
        };
        findDisplay 46 displayAddEventHandler ["KeyDown", {
                if (_this select 1 isEqualTo 59) then {
                        (uiNamespace getVariable "icon") ctrlSetText "\A3\ui_f\data\map\vehicleicons\iconTank_ca.paa";
                };
                false
        }];
        findDisplay 46 displayAddEventHandler ["KeyUp", {
                if (_this select 1 isEqualTo 59) then {(uiNamespace getVariable "icon") ctrlSetText ""};
                false
        }];
};

Your persistent icon is activated by pressing "F1" in the example above

 

Hope this helps!

 

Nikander

  • Like 3

Share this post


Link to post
Share on other sites

Hello silente, try this code:

[] spawn {
        with uiNamespace do {
                icon = findDisplay 46 ctrlCreate ["RscPicture", -1];
                icon ctrlSetPosition [0.94 * safeZoneW + safeZoneX, 0.46 * safeZoneH + safeZoneY, 0.064 * safeZoneW, 0.085 * safeZoneH];
                icon ctrlCommit 0;
        };
        findDisplay 46 displayAddEventHandler ["KeyDown", {
                if (_this select 1 isEqualTo 59) then {
                        (uiNamespace getVariable "icon") ctrlSetText "\A3\ui_f\data\map\vehicleicons\iconTank_ca.paa";
                };
                false
        }];
        findDisplay 46 displayAddEventHandler ["KeyUp", {
                if (_this select 1 isEqualTo 59) then {(uiNamespace getVariable "icon") ctrlSetText ""};
                false
        }];
};

Your persistent icon is activated by pressing "F1" in the example above

 

Hope this helps!

 

Nikander

 

Are there any method for change that key in one like Shift + H?

Share this post


Link to post
Share on other sites
 [] spawn {
            with uiNamespace do {
                    icon = findDisplay 46 ctrlCreate ["RscPicture", -1];
                    icon ctrlSetPosition [0.94 * safeZoneW + safeZoneX, 0.46 * safeZoneH + safeZoneY, 0.064 * safeZoneW, 0.085 * safeZoneH];
                    icon ctrlCommit 0;
            };
            findDisplay 46 displayAddEventHandler ["KeyDown", {
                    if ((_this select 1 isEqualTo 35) AND (_this select 2))  then {
                            (uiNamespace getVariable "icon") ctrlSetText "\A3\ui_f\data\map\vehicleicons\iconTank_ca.paa";
                    };
                    false
            }];
            findDisplay 46 displayAddEventHandler ["KeyUp", {
                    if ((_this select 1 isEqualTo 35) AND (_this select 2)) then {(uiNamespace getVariable "icon") ctrlSetText ""};
                    false
            }];
    };

This works but for it to be persistent you need to release shift before H

Share this post


Link to post
Share on other sites
 [] spawn {
            with uiNamespace do {
                    icon = findDisplay 46 ctrlCreate ["RscPicture", -1];
                    icon ctrlSetPosition [0.94 * safeZoneW + safeZoneX, 0.46 * safeZoneH + safeZoneY, 0.064 * safeZoneW, 0.085 * safeZoneH];
                    icon ctrlCommit 0;
            };
            findDisplay 46 displayAddEventHandler ["KeyDown", {
                    if ((_this select 1 isEqualTo 35) AND (_this select 2))  then {
                            (uiNamespace getVariable "icon") ctrlSetText "\A3\ui_f\data\map\vehicleicons\iconTank_ca.paa";
                    };
                    false
            }];
            findDisplay 46 displayAddEventHandler ["KeyUp", {
                    if ((_this select 1 isEqualTo 35) AND (_this select 2)) then {(uiNamespace getVariable "icon") ctrlSetText ""};
                    false
            }];
    };

This works but for it to be persistent you need to release shift before H

 

 

Ok thank you! It work fine. But i want that, if you re-pressed Shift+H, it go away. I'm using that script for sound, i don't know if i mean well...

Share this post


Link to post
Share on other sites

×