showCommandingMenu - Help needed with dynamic coloring

Is it possible within this menu to add colors to the vehicle parts needing to be repaired based on their damage percentage like dayz mod was?

Code:
ASL_Show_Repair_Options_Menu_Array =
[
    ["Repair Menu",false],
    ["Repair Body",[0],"",-5,[["expression","['repairCarHull'] Call salvage_setup"]],"1","1"],
    ["Repair Wheel",[0],"",-5,[["expression","['repairWheel'] Call salvage_setup"]],"1","1"],
    ["Repair Engine",[0],"",-5,[["expression","['repairCarEngine'] Call salvage_setup"]],"1","1"],
    ["Repair Fuel Tank",[0],"",-5,[["expression","['repairCarFuel'] Call salvage_setup"]],"1","1"],
    ["Repair Glass",[0],"",-5,[["expression","['repairCarGlass'] Call salvage_setup"]],"1","1"]
];
showCommandingMenu "";
showCommandingMenu "#USER:ASL_Show_Repair_Options_Menu_Array";

salvage_setup = {
_vehicle = cursorObject;
_action = _this select 0;
[_action,_vehicle] execVM 'Custom\advancedRepair\Bones_fnc_salvageAndRepair.sqf';
};
I would like to have a hitpoint item show up on the menu in different colors depending on it's current damage..



I have come across the following dayz switch to give an idea of what I am looking for but cannot for the life of me get the menu to work as I would like.

Code:
    if (_damage > 0) then {
        _color = switch true do {
            case (_damage <= 0.25): {"color='#00ff00'"}; //green
            case (_damage <= 0.50): {"color='#ffff00'"}; //yellow
            case (_damage <= 0.75): {"color='#ff8800'"}; //orange
            default {"color='#ff0000'"}; //red
        };
Any help is much appreciated, thanks :)
 

Inkko

Valued Member!
Is it possible within this menu to add colors to the vehicle parts needing to be repaired based on their damage percentage like dayz mod was?

Code:
ASL_Show_Repair_Options_Menu_Array =
[
    ["Repair Menu",false],
    ["Repair Body",[0],"",-5,[["expression","['repairCarHull'] Call salvage_setup"]],"1","1"],
    ["Repair Wheel",[0],"",-5,[["expression","['repairWheel'] Call salvage_setup"]],"1","1"],
    ["Repair Engine",[0],"",-5,[["expression","['repairCarEngine'] Call salvage_setup"]],"1","1"],
    ["Repair Fuel Tank",[0],"",-5,[["expression","['repairCarFuel'] Call salvage_setup"]],"1","1"],
    ["Repair Glass",[0],"",-5,[["expression","['repairCarGlass'] Call salvage_setup"]],"1","1"]
];
showCommandingMenu "";
showCommandingMenu "#USER:ASL_Show_Repair_Options_Menu_Array";

salvage_setup = {
_vehicle = cursorObject;
_action = _this select 0;
[_action,_vehicle] execVM 'Custom\advancedRepair\Bones_fnc_salvageAndRepair.sqf';
};
I would like to have a hitpoint item show up on the menu in different colors depending on it's current damage..



I have come across the following dayz switch to give an idea of what I am looking for but cannot for the life of me get the menu to work as I would like.

Code:
    if (_damage > 0) then {
        _color = switch true do {
            case (_damage <= 0.25): {"color='#00ff00'"}; //green
            case (_damage <= 0.50): {"color='#ffff00'"}; //yellow
            case (_damage <= 0.75): {"color='#ff8800'"}; //orange
            default {"color='#ff0000'"}; //red
        };
Any help is much appreciated, thanks :)
I don't believe it is possible to do what you want with commandingmenu. It supports a string for input of the menu option but I couldn't find anything about it including advanced string options like being able to color the text. With addaction it'd be possible to change the color based on damage but its looking like commandingmenus sadly don't have that option.
 
Thanks very much for the reply, it is much appreciated. It's not a crucial addition to a script to be honest but I just like visuals to pop out at me on menus like this.

Thanks again :)
 

Inkko

Valued Member!
Thanks very much for the reply, it is much appreciated. It's not a crucial addition to a script to be honest but I just like visuals to pop out at me on menus like this.

Thanks again :)
I know what you mean, would be nice if you could have the
Repair Body ect show up in the color of damage to it, it does make it looks nicer in my opinion.
 
Top