Simple Single Frame AddOn
So I'm kind of new to Lua scripting and all I need is this ridiculously simple AddOn.
I need 1 frame implemented into my UI, but I don't want to get kgPanels to put it in, since it's just a single frame, but I want it there all the time. I have the texture but all I need to do is enable the frame but it won't work. :( Just for the purposes of this, the texture is located at "Interface\\AddOns\\Textures\\Frame.tga". What Lua code would I need so that when I go into WoW, this texture is just there in the middle of my screen as a background image. I would be able to adjust the xpos and ypos myself but I just need to know how to put it into the game. Thanks for your time! |
It might be worth the time to look at wow wikis pages on lua and xml scripting for wow. It helped me get my toes into the water and then I found an addon that did something similar to what I wanted and looked at what they did and went from there.
|
The annoying thing is that that sends me to external links or doesn't help me at all, I mean, I already know drips and drabs of Lua but it's just flying by my head why this isn't working. If I were to have someone code the script for me (And I presume it's just a few lines or I'm doing something wrong) I would be able to see why my initial ones have failed and what it does.
|
Hmm strange Ive never had that happen to me .. but let me see .. do you use xml with lua or just pure lua ?
Here's what I do in pure lua code. It is pretty basic but putting this into the lua file it should create a small window with a slightly transparent background. Hopefully that will help you. Code:
|
Currently it's pure Lua, and I'd prefer that if you can.
If you have an IRC client would it be easier to talk through that? 1. Well actually, all I need it to do is put a texture into WoW as a base. I just need it hung to the top of my screen as a backdrop for my SLDT Elements. Currently I have... Code:
local a = CreateFrame("Frame", nil, UIParent) |
Ah, thats cool I prefer pure lua myself.
Feel free to take a look at any of my addons. TotemDeathWatcher is the most basic one for displaying information with LootAlerter the more informative one. |
Frames don't have a SetTexture method. You need to
Code:
a:SetFrameStrata("BACKGROUND") http://www.wowwiki.com/API_Frame_CreateTexture |
Ok so now I have:
Code:
local a = CreateFrame("Frame", nil, UIParent) |
Code:
local t = a:CreateTexture() Code:
t:SetAllPoints() And don't forget to use :Show() on your frame at the end. Code:
local a = CreateFrame("Frame", nil, UIParent) |
That doesn't work either. :p
Would there be a way to, instead of putting in the texture, just make a block of colour to test it? |
Quote:
Quote:
|
:) Showing a black square in center of screen:
TestFrame.toc Code:
## Interface: 30100 Code:
local f = CreateFrame("Frame", "TestFrame", UIParent) Also, you said you wanted to pin your texture to the top of the screen, so you'll want to change it to f:SetPoint("TOP", UIParent, "TOP", 0, 0) I think. (yeah, I use the long version of SetPoint =x) If this works, then make sure your image follows the correct rules maybe? http://www.wowwiki.com/API_Texture_SetTexture Quote:
|
Well the thing Waverian said works. So there must be something wrong with my texture! Awesome. Now to figure this one out...
I have the texture in saved as a .tga file. And when I open it my texture is there with a black background. But apparently the texture doesn't show in game so what would be wrong? EDIT: So I've looked at a similar, shorter version of the texture and I notice there is an outline around the actual texture, where as on the one I created, there is no such line. I guess this indicates to the game the part that needs to be put in the game. |
Quote:
|
Quote:
EDIT: My texture just doesn't want to work, even with a selection added. |; |
Quote:
Also, if you didn't already know, textures need to have a resolution that is powers of 2 (i.e. 256x128, etc...) -- I think they also have to be 24 bit color + alpha channel. |
Why bother with creating a second frame for the texture? All you need to do is set your image as the backdrop to the original frame. What you had originally, CalciumIRL, is correct, except you need to use this function instead of SetTexture. (You also don't need to call Show(), as a frame is implicitly shown upon creation.)
Code:
local a = CreateFrame("Frame", nil, UIParent) |
Quote:
|
Well I couldn't get my texture to work but I used another one and just stacked it using :SetFrameLevel() and it actually turned out better than my initial idea for it :)
|
All times are GMT -6. The time now is 08:33 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI