Hmm but then how does that go into the function? do i need to put each variable into the setpoint? Also the default is purely for reference right? in order to make the actual function default to that i have to use the "or"?
This is where ive gone with it so far and no luck yet with stopping the disconnects..
Code:
-- First, define a set of default properties for reference.
local frameDefaults = {
object = "Frame", -- string
parent = DashBoardFrame, -- nil or object
template = nil, -- nil or string
justify = "RIGHT", -- string; LEFT, RIGHT, or CENTER
text = "188",
framewidth = nil,
texture = nil, -- boolean
texturepath = nil,
textureheight = 12,
texturewidth = 12,
}
-- Now list the actual frames you want to create, as well as any
-- properties that differ from the default ones:
local dashFramesToCreate = {
["GUI_DashMail"] = {
texture = true,
texturepath = [[Interface\AddOns\]] .. addonName .. [[\Media\MailIcon]],
},
["GUI_DashQuest"] = {
object = "Button",
text = " 25/25",
texture = true,
texturepath = [[Interface\AddOns\]] .. addonName .. [[\Media\QuestIcon]],
},
["GUI_DashDurability"] = {
object = "Button",
text = " 100%",
texture = true,
texturepath = [[Interface\Icons\Trade_BlackSmithing]],
},
["GUI_DashInventory"] = {
object = "Button",
texture = true,
template = "SecureHandlerClickTemplate",
text = " 888/888",
textureheight = SIZE,
texturewidth = SIZE,
texturepath = [[Interface\AddOns\]] .. addonName .. [[\Media\BagIcon]],
},
["GUI_DashMoney"] = {
framewidth = 1,
object = "Button",
justify = nil,
text = nil
},
["GUI_DashSocial"] = {
object = "Button",
template = "SecureHandlerClickTemplate",
texture = true,
textureheight = 20,
texturewidth = 20,
texturepath = "Interface/FriendsFrame/UI-Toast-FriendOnlineIcon.blp",
},
["GUI_DashGuild"] = {
object = "Button",
template = "SecureHandlerClickTemplate",
texture = true,
textureheight = 26,
texturewidth = 21,
texturepath = "Interface/Buttons/UI-MicroButton-Guild-Banner.blp",
},
["GUI_DashClock"] = {
object = "Button",
texture = true,
text = " 18:88pm",
textureheight = SIZE,
texturewidth = nil,
texturepath = "Interface/PlayerFrame/UI-PlayerFrame-Deathknight-Glow.blp",
},
["GUI_DashLatency"] = {
text = " 888ms",
},
["GUI_DashFPS"] = {
text = " 188fps",
},
["GUI_DashSpeed"] = {
framewidth = 46,
texture = true,
text = " 100%",
textureheight = 10,
texturewidth = 10,
texturepath = "Interface/TAXIFRAME/UI-Taxi-Icon-Green.blp",
},
}
local function DashCreateFrame(name, data)
local frame = CreateFrame(
data.object or "Frame", -- default to "Frame" if not defined
name, -- required
data.parent or DashBoardFrame, -- default to UIParent
data.template -- optional
)
frame:EnableMouse(true)
frame:SetHeight(SIZE)
frame:SetScript("OnLeave", addon.HideTooltip)
frame:SetFrameStrata("HIGH")
if data.framewidth then
frame:SetWidth(data.framewidth)
end
frame.text = frame:CreateFontString(nil, "OVERLAY")
frame.text:SetPoint("RIGHT")
frame.text:SetFont([[Fonts\FRIZQT__.TTF]], 12)
frame.text:SetShadowOffset(1, -1)
frame.text:SetJustifyH(data.justify or "RIGHT")
frame.text:SetText(data.text or "188")
if data.object == "Button" then
frame:RegisterForClicks("AnyUp")
end
if data.texture then
frame.texture = frame:CreateTexture()
frame.texture:SetTexture(data.texturepath)
frame.texture:SetHeight(data.textureheight or 12)
frame.texture:SetWidth(data.texturewidth or 12)
if data.textureanchor then
frame.texture:SetPoint('RIGHT', frame.text, 'LEFT')
end
end
return frame
end
for name, data in pairs(dashFramesToCreate) do
DashCreateFrame(name, data)
end
-- Mail frame --
GUI_DashMail:SetWidth(GUI_DashMail.text:GetStringWidth() + GUI_DashMail.texture:GetWidth() - 8)
GUI_DashMail.texture:SetPoint('RIGHT', GUI_DashMail.text, 'LEFT')
-- Quests --
GUI_DashQuest.texture:SetTexCoord(0.25, 0.75, 0.25, 0.75)
GUI_DashQuest:SetWidth(GUI_DashQuest.text:GetStringWidth() + GUI_DashQuest.texture:GetWidth())
GUI_DashQuest.texture:SetPoint('RIGHT', GUI_DashQuest.text, 'LEFT')
-- Armor durability --
GUI_DashDurability.texture:SetTexCoord(0.07, 0.93, 0.07, 0.93)
GUI_DashDurability:SetWidth(GUI_DashDurability.text:GetStringWidth() + GUI_DashDurability.texture:GetWidth())
GUI_DashDurability.texture:SetPoint('RIGHT', GUI_DashDurability.text, 'LEFT')
-- Inventory --
addon.GUI_DashInventory = GUI_DashInventory -- Needs to be made global for secure attrib functions in other files
GUI_DashInventory:SetWidth(GUI_DashInventory.text:GetStringWidth() + GUI_DashInventory.texture:GetWidth())
GUI_DashInventory.texture:SetPoint('RIGHT', GUI_DashInventory.text, 'LEFT')
-- Clock --
GUI_DashClock:SetWidth(GUI_DashClock.text:GetStringWidth())
GUI_DashClock.texture:SetWidth((GUI_DashClock.text:GetStringWidth() - 6))
GUI_DashClock.texture:SetPoint("CENTER", GUI_DashClock, "CENTER", 5, 0)
GUI_DashClock.texture:Hide()
-- Latency --
GUI_DashLatency:SetWidth(GUI_DashLatency.text:GetStringWidth())
-- FPS --
GUI_DashFPS:SetWidth(GUI_DashFPS.text:GetStringWidth())
-- Social/Friends --
GUI_DashSocial:SetWidth(GUI_DashSocial.text:GetStringWidth() + GUI_DashSocial.texture:GetWidth() - 10)
GUI_DashSocial.texture:SetPoint('RIGHT', GUI_DashSocial.text, 'LEFT')
-- Guild Frame --
GuildMicroButtonTabard:SetParent(GUI_DashGuild)
GuildMicroButtonTabard:SetPoint('RIGHT', GUI_DashGuild.text, 'LEFT')
GuildMicroButtonTabard:SetHeight(5)
GuildMicroButtonTabard:SetWidth(5)
GuildMicroButtonTabard.emblem:SetHeight(9)
GuildMicroButtonTabard.emblem:SetWidth(9)
GuildMicroButtonTabard.background:SetHeight(26)
GuildMicroButtonTabard.background:SetWidth(21)
GuildMicroButtonTabard.emblem:SetPoint("CENTER", GuildMicroButtonTabard.background, "CENTER", 0, -4)
GUI_DashGuild.texture:SetPoint('RIGHT', GUI_DashGuild.text, 'LEFT', 0, 4)
GUI_DashGuild.texture2 = GUI_DashGuild:CreateTexture()
GUI_DashGuild.texture2:SetTexture("Interface/GUI_DashGuild/GuildEmblems_01.blp")
GUI_DashGuild.texture2:SetPoint('CENTER', GUI_DashGuild.texture1, 'CENTER', 0, -4)
GUI_DashGuild.texture2:SetHeight(9)
GUI_DashGuild.texture2:SetWidth(9)
GUI_DashGuild:SetWidth(GUI_DashGuild.text:GetStringWidth() + GUI_DashGuild.texture:GetWidth() - 10)
-- Speed --
GUI_DashSpeed.texture:SetPoint('LEFT', GUI_DashSpeed, 'LEFT')
GUI_DashSpeed.texture:SetTexCoord(0.25, 0.75, 0.25, 0.75)