Originally Posted by Phanx
Well, you're loading your Lua twice, you're using XML, everything is global, your buttons are not parented to your frame, and you're trying to set scripts to functions that you didn't define anywhere, so there are a lot of problems... just get rid of the whole XML file and replace your Lua file with this:
Code:
local frame = CreateFrame("Frame", "FinalFrame", UIParent)
-- you may want to actually position the frame somewhere, give it visible regions, etc.
local button =CreateFrame("Button", "$parentButton", frame, "UIPanelButtonTemplate")
button:SetPoint("BOTTOMRIGHT", UIParent, 0, 66)
button:SetWidth(80)
button:SetHeight(22)
button:SetText("Twelve")
button:SetScript("OnClick", function(self, mouseButton)
-- do something here when clicked
end)
local chanbutton = CreateFrame("Button", "$parentChannelButton", UIParent, "UIPanelButtonTemplate")
chanbutton:SetPoint("BOTTOMRIGHT", UIParent, 0, 88)
chanbutton:SetWidth(160)
chanbutton:SetHeight(22)
chanbutton:SetText("Fav. Channel")
chanbutton:SetScript("OnClick", function(self, mouseButton)
-- do something here when clicked
end)
|
The reason nothing is defined is because I didn't post the whole script.
The only error when I post the whole lua script is that final() is a nil value.
I NEED to use XML to call the function, its part of the project.
Could you just tell me why its saying Final is a nil value?
Heres the whole lua script
Lua Code:
function finalproj()
print("So I guess this works");
mybutton = CreateFrame("Button","mybutton",UIParent,"UIPanelButtonTemplate")
mybutton:SetPoint("BOTTOMRIGHT",0,66)
mybutton:SetWidth(80)
mybutton:SetHeight(22)
mybutton:SetText("Twelve")
mybutton:SetScript("OnClick", buttontest)
chanbutton = CreateFrame("Button","chanbutton",UIParent,"UIPanelButtonTemplate")
chanbutton:SetPoint("BOTTOMRIGHT",0,88)
chanbutton:SetWidth(160)
chanbutton:SetHeight(22)
chanbutton:SetText("Fav. Channel")
chanbutton:SetScript("OnClick", channeljoin)
end
--[[function partybutton()
print("Would you like to add them to your party?");
accbutton = CreateFrame("Button","accbutton",UIParent,"UIPanelButtonTemplate")
accbutton:SetPoint("BOTTOMRIGHT",0,22)
accbutton:SetWidth(80)
accbutton:SetHeight(22)
accbutton:SetText("Accept")
accbutton:SetScript("OnClick", InviteUnit("target"))
decbutton = CreateFrame("Button","decbutton",UIParent,"UIPanelButtonTemplate")
decbutton:SetPoint("BOTTOMRIGHT",0,44)
decbutton:SetWidth(80)
decbutton:SetHeight(22)
decbutton:SetText("Decline")
decbutton:SetScript("OnClick", break)
trdbutton = CreateFrame("Button","trdbutton",UIParent,"UIPanelButtonTemplate")
trdbutton:SetPoint("BOTTOMRIGHT",0,66)
trdbutton:SetWidth(80)
trdbutton:SetHeight(22)
trdbutton:SetText("Trading Request")
trdbutton:SetScript("OnClick", InitiateTrade("target"))
end--]]
function buttontest()
print("AW DUDE THIS BUTTON ROCKS!");
if UnitIsUnit("player", "target") then
print("This players name is " .. UnitName);
print("They are a " .. UnitClass("target") .. " " .. UnitRace("target"));
print("They currently have " .. UnitHealth("target") .. " health, out of " .. UnitMaxHealth("target") .. " health.");
partybutton();
end
end--]]
--[[function dpshealth()
if(UnitHealthMax("target") / UnitHealth("target") <=50% then
if(GetLFGRoles() == isDPS) then
print("DONT FORGET THE DPS!")
end
end
end
function otherenddps()
print("Please target the Healer. If you do not target the healer, this will not work")
if UnitGroupRolesAssigned("target") == DAMAGER then
print("That is not the healer, please target the healer")
end
if UnitGroupRolesAssigned("target") == TANK then
print("That is not the healer, please target the healer")
end
if UnitGroupRolesAssigned("target") == HEALER then
messagedman == "target"
print("That is the healer. When you are at 50% or lower health, this addon will automatically send a message to the healer")
end
if(UnitHealthMax("player") / UnitHealth("player") <=50% then
SendChatMessage("HEAL ME!","WHISPER","nil",messagedman);
end
end--]]
function questions()
question = CreateFrame("Frame","question",UIParent,"UIFrameTemplate")
question:SetPoint("BOTTONLEFT",0,0)
question:SetWidth(800)
question:SetHeight(100)
--[[question:SetScript("OnLoad", questionone)--]]
end
SLASH_TWELVE1 = '/12'
function SlashCmdList.TWELVE(msg, editbox)
print("TWELVE. That Unit is a " .. UnitIsPlayer("target"));
end
--[[function channeljoin()
AddChatWindowChannel;(chatwindow1, "TWELVE");
end--]]
This used to work yesterday, barely anything has changed.
I used comments so I could try and debug it.