Riftui

Riftui (https://www.riftui.com/forums/index.php)
-   General Authoring Discussion (https://www.riftui.com/forums/forumdisplay.php?f=20)
-   -   Riftwindow problem (https://www.riftui.com/forums/showthread.php?t=153)

Lildry 10-18-11 07:26 PM

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"})

My problem is that the window that is created is open by default. I want to use the slash command /lilbag to open the window. I thought the
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.

doxxx 10-18-11 08:06 PM

When is init() being called?

Lildry 10-18-11 10:13 PM

Quote:

Originally Posted by doxxx (Post 533)
When is init() being called?

Thanks doxxx and to answer your question init() wasn't being called and that would be the problem.

Myrroddin 10-19-11 07:23 AM

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.

Lildry 10-22-11 11:21 AM

Quote:

Originally Posted by Myrroddin (Post 537)
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.

Hello Myrroddin I am currently a student in college for information technology/web design. I am using my elective classes for all programming classes that are offered. All the feedback you give to me are things I really didn't think about, but I do plan to put it to use. I think the local function init() is something that is causeing a problem with the application I am working on now, need to look at this closer and make some changes.

thanks for the feedback

Lildry

Myrroddin 10-23-11 02:58 AM

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! :D

Lildry 10-26-11 09:58 PM

I think the work that everyone does here at riftui is by far greater than anything I hope to develop. Lets just say My Work <<<<< your work and this makes me shy about shareing. But I am getting there. What about dropbox? I have droped a few version of my work there and shared with ingame friends that think they can help but none of them have experience with Lua, only C++.

Sunspots 10-26-11 11:36 PM

Don't worry about feeling inferior. I felt like that a month ago but after way too many hours of tinkering I'm starting to get a hang of things.

Lildry 10-27-11 01:14 AM

Quote:

Originally Posted by Myrroddin (Post 556)
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! :D

http://pastebin.com/kZ78GzJe

First time using pastebin so here it is hope this works the way I believe it will work. I added a bunch of notes, more for myself then for anyone who views it.

Note: this is for RiftLoot the completed project would look similar to runecraft helper.


All times are GMT -6. The time now is 04:34 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2022 MMOUI