MuffinMOTD

Since the addon (MuffinMOTD) has been abandoned, I've been trying to fix the issues myself. I fixed a lot of the simpler issues, but now I've run into one I can't figure out. Can anyone lend a hand? Error below:

Error Message

1x MuffinMOTD/MuffinMOTD.lua:301: attempt to call global 'InterfaceOptions_AddCategory' (a nil value)
[string "@MuffinMOTD/MuffinMOTD.lua"]:301: in function `MuffinMOTDFrameOpts_OnLoad'
[string "*MuffinMOTD.xml:40_OnLoad"]:1: in function <[string "*MuffinMOTD.xml:40_OnLoad"]:1>

Locals:
panel = MuffinMOTDFrameOpts {
name = "Muffin|cFF00FF00MOTD|r"
}
(*temporary) = nil
(*temporary) = MuffinMOTDFrameOpts {
name = "Muffin|cFF00FF00MOTD|r"
}
(*temporary) = "attempt to call global 'InterfaceOptions_AddCategory' (a nil value)"
MuffinMOTD_colour_name = "Muffin|cFF00FF00MOTD|r"
MuffinMOTD_panel_name = "Muffin|cFF00FF00MOTD|r"

**** Edited for formatting & spelling ****

You should be able to find information the change to the new Settings system here.

1 Like

Yeah - been looking at that post. Kind of makes my head hurt. LOL I know how to fix simple things, but this I think is a little more complex than what I can figure out.

Change the line:

MuffinMOTDFrameOpts_Head:SetText(MuffinMOTD_colour_name .. " Options (" .. GetAddOnMetadata("MuffinMOTD", "Version") .. ")")

To:

MuffinMOTDFrameOpts_Head:SetText(MuffinMOTD_colour_name .. " Options (" .. C_AddOns.GetAddOnMetadata("MuffinMOTD", "Version") .. ")")

Change the line:

InterfaceOptions_AddCategory(panel);

To:

	local category = Settings.RegisterCanvasLayoutCategory(panel, "MuffinMOTD")
	Settings.RegisterAddOnCategory(category)	

I don’t know if there are any other problems.

2 Likes

Tks for all the help! Was able to fix it all tks to you both!

Had to add a semi colon on the end of the line:

local category = Settings.RegisterCanvasLayoutCategory(panel, “MuffinMOTD”)
Settings.RegisterAddOnCategory(category);

lua doesn’t use semi colons (it ignores them) so…?

1 Like

Thought it was fixed - but apparently still throwing errors. Can’t find the API info.

Edit: I kind of have it working. It opens up the game options, but does not open up directly to the addon settings.

Error Message

2x MuffinMOTD/MuffinMOTD.lua:319: attempt to call global 'InterfaceOptionsFrame_OpenToCategory' (a nil value)
[string "@MuffinMOTD/MuffinMOTD.lua"]:319: in function `OnClick'
[string "@ChocolateBar/Chocolate.lua"]:295: in function

Locals:
clicked_frame = ChocolateMuffinMOTD {
icon = Texture {
}
labelText = ""
obj =

{
}
name = "MuffinMOTD"
settings =
{
}
text = FontString {
}
bar = ChocolateBar1 {
}
}
button = "RightButton"
(*temporary) = nil
(*temporary) = "Muffin|cFF00FF00MOTD|r"
(*temporary) = "attempt to call global 'InterfaceOptionsFrame_OpenToCategory' (a nil value)"
MuffinMOTD_panel_name = "Muffin|cFF00FF00MOTD|r"

At the top of the file after:

local ADDON_NAME = ...

Add:

local category, layout

next, change :

local category = Settings.RegisterCanvasLayoutCategory(panel, "MuffinMOTD")

to be:

category, layout = Settings.RegisterCanvasLayoutCategory(panel, "MuffinMOTD")

Replace (both lines):

InterfaceOptionsFrame_OpenToCategory(MuffinMOTD_panel_name)
InterfaceOptionsFrame_OpenToCategory(MuffinMOTD_panel_name)

with (single)

Settings.OpenToCategory(category.ID)