|
10-18-11, 07:26 PM | #1 |
Riftwindow problem
Code:
print ("LilBag is loaded") -- Create context for UIFrames local context = UI.CreateContext("Lilbag") local lilbagwindow = UI.CreateFrame("RiftWindow", "LilBag", context) -- Sets frame position and size local function init() lilbagwindow:SetVisible(false) lilbagwindow:SetWidth(800) lilbagwindow:SetHeight(600) lilbagwindow:SetPoint("CENTER", UIParent, "CENTER") lilbagwindow:SetTitle("Lilbag") lilbagwindow:SetLayer(1) end -- Shows the window local function showlilbag() lilbagwindow:SetVisible(true) end table.insert (Command.Slash.Register("lilbag"), {showlilbag, "LilBag", "Slash command"}) local function init() lilbagwindow:SetVisible(false) would make the window closed when rift starts up and then I would open it with the slash command. Anyone see what my problem is? Note: I am using the code for LuaPad as a learning tool. |
|
10-18-11, 08:06 PM | #2 |
When is init() being called?
|
|
10-18-11, 10:13 PM | #3 |
10-19-11, 07:23 AM | #4 |
I would replace local function init() with a do/end. But that's only if you need something like that; I ask because everything you have in init() can be put in the main chunk, right after creating the context and frame.
Further, and you probably have already thought of this, but you want an if/then statement checking the window's visibility. If false, show it, if true, hide it. Put that check in your slash command function. |
|
10-22-11, 11:21 AM | #5 | |
Quote:
thanks for the feedback Lildry |
||
10-23-11, 02:58 AM | #6 |
Since no addon is a national secret, you could put your entire code on pastebin.com and provide the link. That way, we can look over it and provide further, more accurate, help.
Good job being willing to learn, and good luck with your addon! |
|
Riftui » Developer Discussions » General Authoring Discussion » Riftwindow problem |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|