• 0

    posted a message on How to make your addon searchable on curse.com
    I am having the same issue with a war project. Even if I search for the name of my addon exactly (alertMod) it does not show up in the results.
    Posted in: Need Help?
  • 0

    posted a message on lua help plz?
    Hi, I am pretty new to lua and programming in general is only a part time hobby. So I am hoping someone here can help me with a problem I am having.

    The problem is with the saveSettings and getSettings functions for loops. The debug message in the saveSettings loop returns the expected values but the saved variable is the same for every alert type. If I get an answer to that problem it should also help me figure out what is wrong with the for loop in getSettings. I don't recall exactly what that one was doing because I commented it out til I got the saveSettings sorted.

    Here is the code (edited to save some space, removed all the slash commands and part of some tables)

    alertMod = {}
    
    local msgpad = AlertTextWindow.MESSAGE_HEIGHT_PADDING
    local hgtshift = AlertTextWindow.MIN_HEIGHT_SHIFT
    local fadein = AlertTextWindow.FADE_IN_TIME
    local displaytime = AlertTextWindow.DISPLAY_TIME
    local fadeout = AlertTextWindow.FADE_OUT_TIME
    local life = displaytime + fadeout --AlertTextWindow.ALERT_LIFE_TIME
    local timebetween = AlertTextWindow.TIME_BETWEEN_ALERTS
    --Alert Types
    local typeInfo = AlertTextWindow.TypeInfo
    local sysType = SystemData.AlertText.Types
    
    --Shortcut table
    local alertType = {}	
    	alertType["rank"] = typeInfo[ sysType.STATUS_ACHIEVEMENTS_RANK ]
    	alertType["rnwn"] = typeInfo[ sysType.STATUS_ACHIEVEMENTS_RENOUN ]
    	alertType["guild"] = typeInfo[ sysType.GUILD_RANK ]
    	alertType["rvr"] = typeInfo[ sysType.RVR ]
    	--Several entries removed to save space
    
    --Font Table
    local alertFont = {}
    	alertFont[9] = "font_alert_outline_half_tiny"
    	alertFont[12] = "font_alert_outline_half_small"
    	alertFont[15] = "font_alert_outline_half_medium"
    	alertFont[18] = "font_alert_outline_half_large"
    	alertFont[21] = "font_alert_outline_half_huge"
    	alertFont[24] = "font_alert_outline_half_giant"
    	alertFont[30] = "font_alert_outline_half_gigantic"
    	alertFont[36] = "font_alert_outline_large"
    	alertFont[42] = "font_alert_outline_huge"
    	alertFont[48] = "font_alert_outline_giant"
    	alertFont[60] = "font_alert_outline_gigantic"
    	
    local function print(text)
        EA_ChatWindow.Print(towstring(tostring(text)), ChatSettings.Channels[SystemData.ChatLogFilters.SAY].id);
    end
    
    function alertMod.Initialize()
    	if (alertModSettings == nil) then
    		alertModSettings = {}
    		alertMod.setDefaults()
    	end
    	getSettings()
    end
    
    function getSettings()
    	AlertTextWindow.MESSAGE_HEIGHT_PADDING = alertModSettings["msgpad"]
    	AlertTextWindow.MIN_HEIGHT_SHIFT = alertModSettings["hgtshift"]
    	AlertTextWindow.FADE_IN_TIME = alertModSettings["fadein"]
    	AlertTextWindow.DISPLAY_TIME = alertModSettings["displaytime"]
    	AlertTextWindow.FADE_OUT_TIME = alertModSettings["fadeout"]
    	AlertTextWindow.ALERT_LIFE_TIME = alertModSettings["life"]
    	AlertTextWindow.TIME_BETWEEN_ALERTS = alertModSettings["timebetween"]
    
    	for k, v in pairs( alertModSettings.alerts ) do
    		savedType = alertModSettings.alerts[k]
    		savedFont = savedType.font
    		newVal = alertType[k]
    		d("Changing "..k.." "..newVal.font.." to: "..savedFont)
    		newVal.font = savedFont
    	end
    end
    
    function saveSettings()
    	alertModSettings["msgpad"] = msgpad
    	alertModSettings["hgtshift"] = hgtshift	
    	alertModSettings["fadein"] = fadein
    	alertModSettings["displaytime"] = displaytime
    	alertModSettings["fadeout"] = fadeout
    	alertModSettings["life"] = life
    	alertModSettings["timebetween"] = timebetween
    	
    	if (alertModSettings["alerts"] == nil) then
    		alertModSettings["alerts"] = {}
    		d("alerts table created")
    	end
    	
           --WTF is wrong here? The debug message is not the same as what gets saved!
    	for k, v in pairs( alertType ) do
    		alertModSettings.alerts[k] = newTable
    		if (newTable == nil) then
    			newTable = {}
    		end
    		newVal = alertType[k]
    		newTable["font"] = newVal.font
    		d("Saving "..k.." to "..newVal.font)
    	end
    end
    
    function alertMod.setDefaults()
    	msgpad = 10
    	hgtshift = 275
    	fadein = 0.5
    	displaytime = 3.5
    	fadeout = 1.5
    	life = displaytime + fadeout
    	timebetween = 1.5
    	--alerts
    	alertType.rank.font = alertFont[36]
    	alertType.rnwn.font = alertFont[36]
    	alertType.guild.font = alertFont[36]
    	alertType.rvr.font = alertFont[30]
    	--Sveral alerts removed to save space
    	
    	saveSettings()
    	print("AlertMod: Settings returned to defaults.")
    end


    I hope my explanation is clear and someone can help. Been wanting to smash my face into my monitor trying to get this working.
    Posted in: Development Help
  • To post a comment, please or register a new account.