i have an addon called BGCallouts that reports for battlegrounds if a capping object need help or is safe (in Arathi Basin for ex. Blacksmith is safe.)
Now i want to add a timer for that so it says how long iti is before it get fully capped. I know there is many good addon that do that but i want it on my addon too. Where can i find the API for getting the timers on capped object. I think its not so easy but if i can get an start it will help.
Hi
i am after a confirmation if i am right how to call a funtion from Another Lua file.
This is how i didi it. I maked a table and put the function in it and put all in namespace.cf.
Am i doing right?
File BGCallouts.lua
============
local ADDON_NAME, namespace = ...
local cf = namespace.cf
local BGFrame = {"ab","dwg","tbfg","eots","ssm"}
... some code
cf.createFrames(BGFrame)
and
Battlegrounds.lua
===========
local ADDON_NAME, namespace = ...
local L = namespace.L
local cf = {}
namespace.cf = cf
... some code
function cf.createFrames(name)
.. some code
end
Hi
i am confused. I have "L" as a my localised strings (you helped me alot with that).
1. Should i create a new Metatable as i did with "L" (using rawset...?) or can i create just a table ( i also seen you can have Modules but i dont know what that is)?
2. Should i also create a new namespace ?
3. Is it possible to get out the information in the table in same order they are put in? Now the addon swap order so my buttons is not where i would like to have them?
Hope my questions is relevant as i dont really understand this with namespace and modules and tables.
Hi,
i solved it this way. I put the local tables in main table.
1. Do i have to have a counter to get lenght of each subtable?
OBS! 2. The Icons is not showing up in same order as in table. Can i fix that? OBS! important
function L.createFrames()
L.BGFrame = {ab = {farm = "Farm",mine = "Mine",blacksmith = "Blacksmith",lumbermill = "Lumber Mill",stable = "Stable"},
dwg = {pandaren = "Pandaren Mine",center = "Center Mine",goblin = "Goblin Mine"},
tbfg = {mine = "Mine",lighthouse = "Lighthouse",waterworks = "Waterworks"},
eots = {felreaver = "Fel Reaver ruins",magetower = "Mage tower",draenei = "Draenei ruins",bloodelf = "Blood Elf tower",flag = "Flag at middle"},
ssm = {lava = "Lava cart",oil = "Oil cart",lake = "Lake cart"}
}
for i,v in next,L.BGFrame do
L.BGFrame[i] = CreateFrame("FRAME", i, UIParent)
SetupBGFrame(L.BGFrame[i])
local count = 0
for j,w in next,v do
AddLocationButton(L.BGFrame[i], w, j)
count = count + 1
end
if (count==5) then
L.BGFrame[i]:SetSize(58, 218)
else
L.BGFrame[i]:SetSize(58, 138)
end
end
end
Hi
I try to add image and name to my buttons on a frame. The problem in the code are that variable v is a string and i get an error for it wants an table. Is there a possibility to convert the string to a table. v Points to string 'ab' but i want it to point to table ab {}????
function L.createFrames()
L.BGFrame = {"ab","eots","dwg","tbfg","ssm"}
local ab = {farm = "Farm",mine = "Mine",...}
local dwg = {pandaren = "Pandaren Mine",...}
local tbfg = {mine = "Mine",lighthouse = "Lighthouse",...}
local eots = {felreaver = "Fel Reaver ruins",...}
local ssm = {lava = "Lava cart",oil = "Oil cart",lake = "Lake cart"}
for i,v in pairs(L.BGFrame) do
L.BGFrame[i] = CreateFrame("FRAME", v, UIParent)
SetupBGFrame(L.BGFrame[i])
if (v=='ab' or v=='eots') then
L.BGFrame[i]:SetSize(58, 218)
else
L.BGFrame[i]:SetSize(58, 138)
end
for j,w in pairs(v) do ---------->>> here is my problem
AddLocationButton(L.BGFrame[i], w, j)
end
end
end
Hi
i have a problem using tables. My addon has worked but then i realized that my tables didnt send right value . Before i got a "tablenumber" of some sort and now i try to create Frames with names as 'ab', 'eots' etc... In my main file i using namespace 'L' to call for function createFrames().
Question 1:
I want to set up the created Frames in same namespace 'L' for use in main file. So her is the code and i dont know how to set up L.BGFrame or if is is even nessessary since the name is same as in bgframe...????
Question 2
in function setupBGframe i get stuck on setMovable() even if it prints out 'ab'???
function L.createFrames()
local bgframe = {"ab","eots","dwg","tbfg","ssm"}
L.BGFrame = {}
for i,v in pairs(bgframe) do
L.BGFrame[i] = CreateFrame("FRAME", v, UIParent)
SetupBGFrame(v)
local function SetupBGFrame(frame)
print(frame)
frame:SetMovable(true)
frame:EnableMouse(true)
Hi
ofc it was my real code.. i am not a pro coder but i couldnt find anything else that affected the code. Now it works and i am happy and thank you very much for taking your time to help me. /hug
Hi
I solved using Backdrop.. it was hard to find "UI-DialogBox-<whatever>" that really linked as i should.
Do you have a list of what possible "backdrop textures" that is avaliable?
local function SetupBGFrame(frame)
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
frame:SetPoint("CENTER", UIParent, "CENTER")
-- The code below makes the frame visible
frame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark", tile = true, tileSize = 20,
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 32,
insets = { left = 10, right = 10, top = 10, bottom = 10 }
})
frame:SetBackdropColor(0.8,0.8,0.8,1)
frame:SetBackdropBorderColor(0.8,0.8,0.8,1)
return frame
end
0
in my addon i use 'UnitExists("focus")' and it shall return a boolean but returns nil.
'UnitExists("target")' works fine.
It is the same with 'GetUnitName('focus', true)' versus 'GetUnitName('target', true).
How can i come around this in my addon 'DungeonHelper2'. i really want to use to focus function in my addon.
/Niclas Thunberg alias Circoo
0
Does this work in random battlegrounds. What i wonder is if a random battleground is a raid Group?
found what was wrong
local playerName = UnitName("playerName") --- shall be
local playerName = UnitName("player")
tyvm for tip
Have a great new year
0
I am trying to check if i am raid leader or assistant in a raid Group. I was thinking of using GetRaidRosterInfo().
It is the rank that gives me the information i need. 2=raid leader, 1=assistant and 0=all other players
ex.
if (GetRaidRosterInfo(self,rank,_,_,_,_,_,_,_,_,_)==2 or GetRaidRosterInfo(self,rank,_,_,_,_,_,_,_,_,_)==1) then
... some code
But i cant do like this so my question is how the code will look like to get information from GetRaidRosterInfo()
0
Hi
i have an addon called BGCallouts that reports for battlegrounds if a capping object need help or is safe (in Arathi Basin for ex. Blacksmith is safe.)
Now i want to add a timer for that so it says how long iti is before it get fully capped. I know there is many good addon that do that but i want it on my addon too. Where can i find the API for getting the timers on capped object. I think its not so easy but if i can get an start it will help.
0
i am after a confirmation if i am right how to call a funtion from Another Lua file.
This is how i didi it. I maked a table and put the function in it and put all in namespace.cf.
Am i doing right?
File BGCallouts.lua
============
and
Battlegrounds.lua
===========
0
i am confused. I have "L" as a my localised strings (you helped me alot with that).
1. Should i create a new Metatable as i did with "L" (using rawset...?) or can i create just a table ( i also seen you can have Modules but i dont know what that is)?
2. Should i also create a new namespace ?
3. Is it possible to get out the information in the table in same order they are put in? Now the addon swap order so my buttons is not where i would like to have them?
Hope my questions is relevant as i dont really understand this with namespace and modules and tables.
0
i solved it this way. I put the local tables in main table.
1. Do i have to have a counter to get lenght of each subtable?
OBS! 2. The Icons is not showing up in same order as in table. Can i fix that? OBS! important
0
I try to add image and name to my buttons on a frame. The problem in the code are that variable v is a string and i get an error for it wants an table. Is there a possibility to convert the string to a table. v Points to string 'ab' but i want it to point to table ab {}????
0
0
i have a problem using tables. My addon has worked but then i realized that my tables didnt send right value . Before i got a "tablenumber" of some sort and now i try to create Frames with names as 'ab', 'eots' etc... In my main file i using namespace 'L' to call for function createFrames().
Question 1:
I want to set up the created Frames in same namespace 'L' for use in main file. So her is the code and i dont know how to set up L.BGFrame or if is is even nessessary since the name is same as in bgframe...????
Question 2
in function setupBGframe i get stuck on setMovable() even if it prints out 'ab'???
PS! tables in lua is a pain. DS!
/thanks Niclas
0
ofc it was my real code.. i am not a pro coder but i couldnt find anything else that affected the code. Now it works and i am happy and thank you very much for taking your time to help me. /hug
0
I solved using Backdrop.. it was hard to find "UI-DialogBox-<whatever>" that really linked as i should.
Do you have a list of what possible "backdrop textures" that is avaliable?
local function SetupBGFrame(frame)
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
frame:SetPoint("CENTER", UIParent, "CENTER")
-- The code below makes the frame visible
frame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark", tile = true, tileSize = 20,
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 32,
insets = { left = 10, right = 10, top = 10, bottom = 10 }
})
frame:SetBackdropColor(0.8,0.8,0.8,1)
frame:SetBackdropBorderColor(0.8,0.8,0.8,1)
return frame
end
0
0
0
thanks now my addon is up to date and i have no bugs in it. But the frame is still green or not visible... Can it have something to do with
frame.texture = frame:CreateTexture("ARTWORK")
You said ...File path incorrect, unsupported dimensions, unsupported file-type, etc.
/thanks