1. #1

    Lightbulb Grid2 advanced customization

    I was wondering if someone very experienced might be able to help me with Grid2.

    I have set up my health indicator so that

    1) Statuses = health-current
    2) Color = custom color (transparent black)
    3) Layout -> Enable background is checked, invert bar color isn't checked

    Now what needs to be done to make that background color class colored (The purple part in the picture below which is health deficit, just for demonstration)?




    I haven't been able to do it in-game. I'd like to add an option to set is as classcolor, but Grid2 is so well written I suppose, that it's difficult to find the correct things. The property that needs to be changed is backColor which I found in these files:

    Grid2\modules\IndicatorBar.lua
    Grid2Options\modules\indicators\IndicatorBar.lua

    So for the IndicatorBar.lua in the options module I can create in-game options that IndicatorBar.lua in the core module should obey. This is the part to modify:

    Code:
    	options.enableBack = {
    		type = "toggle",
    		name = L["Enable Background"],
    		desc = L["Enable Background"],
    		order = 45,
    		get = function () return indicator.dbx.backColor~=nil end,
    		set = function (_, v)
    			if v then
    				indicator.dbx.backColor = { r=0,g=0,b=0,a=1 }
    			else
    				indicator.dbx.backColor = nil
    			end
    			self:RefreshIndicator(indicator, "Create")
    		end,
    	}
    	options.backColor = {
    		type = "color",
    		order = 46,
    		name = L["Background Color"],
    		desc = L["Background Color"],
    		hasAlpha = true,
    		get = function() 
    			local c = indicator.dbx.backColor
    			if c then
    				return c.r, c.g, c.b, c.a
    			else
    				return 0,0,0,1
    			end	
    		end,
    		set = function(info,r,g,b,a) 
    			local c = indicator.dbx.backColor
    			if not c then c = {}; indicator.dbx.backColor = c end
    			c.r, c.g, c.b, c.a = r, g, b, a
    			self:RefreshIndicator(indicator, "Layout", "Update")
    		end,
    		hidden = function() return not indicator.dbx.backColor end
    	}
    How to make this so that

    1) There is a checkbox option (lets say it's called options.ccBack) to enable class-colored background that shows up when "enable background" is toggled on
    2) It actually sets the dbx.backColor to be class colored
    3) The background color picker (options.backColor) only shows up if class-colored is not chosen

    If 1-3 could be done then the dbx.backColor that is used by the main IndicatorBar.lua would be always correct and that file wouldn't have to be modified?

    1) I can create simply by copy-pasteing options.backColor and changing the type to "Toggle" but of course it doesn't do anything.

    I think the biggest question is how to inject class colors into those options? Any ideas?

    Edit: And yes, I do know that modifying the IndicatorBar options affects all bar indicators, not just health, which is why having a "class color" toggle before picking the color would be a nice option
    Last edited by Ibis; 2014-07-24 at 12:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •