showCommandingMenu - Help needed with dynamic coloring

Discussion in 'Scripting/Addon Discussion' started by KrisiS, Apr 11, 2018.

  1. KrisiS

    KrisiS Member

    Joined:
    Aug 17, 2013
    Messages:
    91
    Likes Received:
    1
    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 :)
     
  2. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    719
    Likes Received:
    94
    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.
     
  3. KrisiS

    KrisiS Member

    Joined:
    Aug 17, 2013
    Messages:
    91
    Likes Received:
    1
    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 :)
     
  4. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    719
    Likes Received:
    94
    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.
     

Share This Page