Reply
Thread Tools Display Modes
Unread 10-18-11, 07:26 PM   #1
Lildry
Claw of Regulos
Join Date: Oct 2011
Posts: 13
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.
Lildry is offline   Reply With Quote
Unread 10-18-11, 08:06 PM   #2
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 11
When is init() being called?
doxxx is offline   Reply With Quote
Unread 10-18-11, 10:13 PM   #3
Lildry
Claw of Regulos
Join Date: Oct 2011
Posts: 13
Quote:
Originally Posted by doxxx View Post
When is init() being called?
Thanks doxxx and to answer your question init() wasn't being called and that would be the problem.
Lildry is offline   Reply With Quote
Unread 10-19-11, 07:23 AM   #4
Myrroddin
Endless Captain
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 50
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.
Myrroddin is offline   Reply With Quote
Unread 10-22-11, 11:21 AM   #5
Lildry
Claw of Regulos
Join Date: Oct 2011
Posts: 13
Quote:
Originally Posted by Myrroddin View Post
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
Lildry is offline   Reply With Quote
Unread 10-23-11, 02:58 AM   #6
Myrroddin
Endless Captain
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 50
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!
Myrroddin is offline   Reply With Quote
Unread 10-26-11, 09:58 PM   #7
Lildry
Claw of Regulos
Join Date: Oct 2011
Posts: 13
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++.
Lildry is offline   Reply With Quote
Unread 10-26-11, 11:36 PM   #8
Sunspots
Claw of Regulos
 
Sunspots's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 23
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.
Sunspots is offline   Reply With Quote
Unread 10-27-11, 01:14 AM   #9
Lildry
Claw of Regulos
Join Date: Oct 2011
Posts: 13
Quote:
Originally Posted by Myrroddin View Post
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!
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.

Last edited by Lildry : 10-27-11 at 01:20 AM.
Lildry is offline   Reply With Quote
Reply

Go BackRiftui » Developer Discussions » General Authoring Discussion » Riftwindow problem

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off