!Beautycase getting started
Hey there.
How do i start with beautycase? In the addon description it says: First: DONT'T put the code snippets into the beautycase file. Create a little addons and put the code in its .lua file. I just found a video where the guy did put it directly into the code of every addon. Could someone provide me a little lua snipped of how it have to look that i can simply insert the Code:
myFrame:CreateBorder(borderSize) I for example tryed: Bagnon:CreateBorder(12,1,1,1) BagnonFrameinvnetory:CreateBorder(12,1,1,1) BagnonFrame:CreateBorder(12,1,1,1) Bagnon:CreateBorder(12,1,1,1) BagnonFramebank:CreateBorder(12,1,1,1) And simply bot them at "the end of the lua file" as it was exmplained in some comments. Everything did just end up with lua errors. |
You can put the code in each addon, but the problem with that is that you'll have to remember to re-do it every time each addon is updated. Using a separate addon is better.
For Bagnon (and some other addons) the problem is that they don't create their frames until they're actually needed. So for example, BagnonFrameinventory (which has a typo in your code, BTW) does not exist before the first time you open your bags. For these types of addons, you'll have to find the function in their code that creates the frames, and hook that function in your code: Code:
if Bagnon then Code:
## OptionalDependencies: Bagnon, SomeOtherAddon, YetAnotherAddon Code:
Minimap:CreateBorder(12,1,1,1) -- OK because Blizzard frames are created before any addons load |
Could you explain me how your day looks like? You did answer on nearly every question i got with a huge amount of informations. You got a bunch of addons running with properly a bunch of tickets each day o.o.
Ill try it out after some sleep but i got a short question flashing through my mind while remembering what you wrote. If i remember right you said that blizzard frames get created at the start and are always there so easy to hook. I tryed to give my skinned blizzard ui some borders but on some frames. For example .. the Guildframe. If i check it with Fstack i get nearly everywhere around it "GuildFrame" than "GuildMainFrame", "GuildNewPerksFrame", "GuildFrameInsert" and so on. I can clearly see that these frames are named but it seems like its a bit more difficult than i thought. Yesterday where i started to skin my Ui i was like ok, Blizz frames are easy to skin with a border i just need to get a bit into bagnon and than its cool. Anyways. Ill take a nap and than read again what you wrote and try it out :) |
Sorry for the double post but i got further questions and i dont know if posts on WoWInt. get flagged as "with new content" if i edit my last post.
I tryed the stuff now on Xloot. This is your example: Lua Code:
So by default i did rename every Bagnon into XLoot because, this is the addon :p Now i need to understand the Lua. "hooksecurefunc" does as i understand it hook functions. Simple as that im not sure what is the other stuff? (Bagnon [AddOn Name], "CreateFrame" [name of the func?] function [to tell the hooksecurefunc that is has to hook a function?] (Bagnon [AddOn Name], id [no clue what it is. Maybe if there are more than 1 function with the same name] The secound part with the reference to the frame object is as i understand it the way we tell the hooksecurefunc where the frames to hook are located? so in the XLoot. Lua i found this: Lua Code:
It is like on the top of the lua script, contains "frame = CreateFrame("Frame") and stuff like "OnEvent" that basicly means if a Event (loot window or something like this) does popup it gets created through this function. With that lets call it "interpretation" of the lua code and informations i found my result does look like: Lua Code:
I got this Lua Error: Lua Code:
So im not realy sure how to handle the error message. I can definitly see a "CreateFrame" function in the XLoot.lua and since "hooksecurefunc():" is a part of the lua code i cant even imagine whats wrong here. |
Quote:
Quote:
For example, there's at least one place where they literally run 30+ if/elseif checks to convert a string to all-caps instead of just calling string.upper one time. :( Quote:
Quote:
There are two ways to use hooksecurefunc. For global functions: Code:
hooksecurefunction(CastSpellByName, function(name) Code:
hooksecurefunction(MinimapZoneText, "SetText", function(self, text) Code:
function Bagnon:CreateFrame(id) Code:
function Bagnon.CreateFrame(self, id) http://www.wowinterface.com/forums/s...573#post295573 Quote:
1. The XLoot addon defines a table or frame object with a global name of "XLoot". 2. The XLoot addon defines a function as a method on that object with the name of "CreateFrame". 3. That method receives two arguments, the first being a reference to the "XLoot" object, and the second being something that identifies the frame being created. 4. There is a table defined as under the "frames" key on the "XLoot" object (eg. XLoot.frames = {}). 5. The identifier passed to the XLoot:CreateFrame method is used as a key in that table, and its value is a reference to the frame that was created. Since XLoot is a completely separate addon from Bagnon, and is not written by the same author, it's extremely unlikely that its frame creation code is exactly the same as Bagnon's frame creation code. After a quick look at XLoot's code, I can tell you that you don't need to hook anything. XLoot only creates one loot frame (whereas Bagnon creates an inventory frame and a bank frame and possibly more frames depending on your settings) and it creates it right away when the addon loads (whereas Bagnon doesn't create any frames until you want to see them). In XLoot_Frame\Frames.lua, in the main chunk (outside of any functions, so it's executed as soon as the file is read): Code:
local XLootFrame = CreateFrame("Frame", "XLootFrame", UIParent) 1. Creates a frame object with the type "Frame" (as opposed to "Button" or "ScrollFrame" etc.) 2. Gives that object the global name "XLootFrame". 3. Parents that object to the already-existing frame with the global name "UIParent" (by reference, not by name). 4. Assigns a reference to the new object to the local variable "XLootFrame". So, since that line is executed and the frame is created right away, all your addon needs to do is: 1. Add XLoot_Frame to its optional dependencies to make sure XLoot_Frame loads before your addon if it's installed. 2. Check if XLootFrame exists (if it doesn't at this point, then the addon isn't installed). 3. Add a border to the frame: Code:
if XLootFrame then Code:
local addonFuncs = {} |
Holy ... thats a whole bunch of text! Beside the topic realated informations i learned a lot of things. To be fair i didnt even started to learn anything in Lua / WoW Api but i got that i dont know:
Quote:
As i can say it looks a bit different. If i guess right frames are created in .xml and "what stuff does" in the .lua so its a bit like .lua = .html, .xml = .css. Overall ill try that xloot skinning out. After that i properly just need to skin the other blizzard frames and do some last modifications and than i have to check the licenses and so on of all the addons im using and ask the authors if i can use them for my "UI" or "UI Pack" however you want to call it. And after this is done and my basic ui is ready ill start to rebuild it bymyself step by step without any real 3. party addon. Not even sure if i will be able to finish it untill world of warcraft will die since it is a bunch of work and will properly need years >.< So. Today ill finally sleep a bit and think about how ill start to learn the whole stuff. I mean yea there are a lot of informations for free around there but im 100% sure i can read every information ic an find in the next 3 months and wont even be able to write a chat print addon blind without copy paste. Rly annoying to lose the ability to learn something by your self just with the informations you get in the internet and to be honest. I would feel realy retarded if i try to write addons and just open threads on wowinterface for every thing i cant find a solution for. Anyways, again thanks for that huge answer. Ill properly should check all your recent forum posts since they are like always usefull. Sometimes my worse english is struggeling a bit. I definitly do understand it better than i speak (seems to be usuall if i compare it to .lua :D) but ye. Thanks for taking the time to answer me! :) |
How a table looks compared with a frame
A frame is really just a table with some special properties. Anything you can do with a table, you can also do with a frame: Code:
-- make a table: Code:
local t = CreateFrame("Frame") Code:
local t = CreateFrame("Frame") Code:
local t = CreateFrame("Frame") Technically "userdata" is a fancy way of saying "a pointer to something that only exists in the C code outside of the Lua scripting environment" since Lua is a scripting language running inside a program written in C (actually I think WoW is in C# but that doesn't matter for this demonstration) just like JavaScript is a scripting language running inside your web browser, or your web browser runs inside your operating system (probably Windows) etc. Anyway, metatables are probably beyond the scope of what you'll be doing in the near future, but they're not actually that complicated, so if you're interested I can explain that a bit more. ------------------------------ What a Method realy does with a frame The short answer: Nothing. The long answer: A method is just a function, but it's defined in a special way so that it's attached to a table (maybe a frame, maybe some other kind of UI object, or maybe just a plain old table). Code:
local WhatAnimalsDo = { Code:
function WhatAnimalsDo.Explain(self, who) Code:
WhatAnimalsDo.Explain("cats") -- note the dot! But if you call it like this, it works: Code:
WhatAnimalsDo:Explain("cats") -- colon! Code:
WhatAnimalsDo.Explain(WhatAnimalsDo, "cats") So, as you can see, a method doesn't "do" anything with the table it's defined on, unless you do something with it inside the function. It's just a special way of writing functions that attach them to tables/frames/other objects, and "magically" pass references to the object. ------------------------------ What local variables do Assuming you already know what a variable is, the "local" keyword just limits where a variable exists. If you write: Code:
MyVariable = 5 Code:
local MyVariable = 5 Code:
local function PrintMyVariable() Code:
do Code:
local x = 10 You can think of scopes like those Russian nesting dolls, made out of one-way glass. If you're in between dolls, you can see outward to see what's in all the bigger dolls, but you can't see inward to see what's in the smaller dolls. Functions also create scopes, as do loops of all kinds (for, while, repeat), and basic control structures like if, elseif, and else. As a general rule, you should always define your variable in the narrowest (or lowest, or the smallest doll) scope that's needed. This keeps your code readable, helps avoid unexpected conflicts if you use the same variable name in different scopes for different purposes, and avoids wasting memory by holding onto values that are no longer needed (since any variables that are local to a scope are effectively erased at the end of the scope). ------------------------------ Quote:
Quote:
Quote:
Quote:
|
Quote:
I think Hearthstone was made using the Unity engine, which allows you to program the game in C# and other .NET languages. When I looked at Hearthstone's files a while back, they definitely looked like a .NET application rather than a native one. Back to the topic of the thread, that was quite a nice explanation of those concepts. |
Damn Phanx you drive ma crazy. Thanks for all the advices and informations! I guess i can start learning lua in around 1 week. Ill definitly tell you after i'd understand that world of warcraft dev if/elseif example cause for now i dont even get whats wrong with it or how i could get the same result in a other way :p.
Ill come back to that bunch of snippeds in the week ill start learning lua and the wow api so ye, for now i just want to tell you that i tryed your addon check / border modification snipped. Lua Code:
Since you missed a [/code] at the end of your post i thought there is something missing. the Error code was: Code:
1x LightboundUI\LightboundUI-v1.0.1.lua:46: "end" expected (to close "for" at line 13) near "<eof>" Lua Code:
and Lua Code:
Also played with the Arguments. Borders wont appear. |
Well, this won't work:
Code:
addonFuncs["Bagnon"] = function() As for the other part, try adding some print statements so you can see what's going on: Code:
addonFuncs["XLoot_Frame"] = function() Code:
if IsAddOnLoaded(addon) then Code:
eventFrame:SetScript("OnEvent", function(self, event, addon) (Also fixed the missing /code tag in my last post, so if you re-copy you'll have correctly indented code.) |
Just finished reading this thread and had to say thanks to Phanx for his knowledge and well written explanations. Was checking the forums for changes for WoD and saw this thread and had to read it. :)
|
Quote:
|
All times are GMT -6. The time now is 08:50 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI