Thread Tools Display Modes
10-27-10, 07:25 AM   #1
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
lua problem

Why does this not work.
anyone know how to fix it

Code:
A1 = CreateFrame("Frame", nil, self)
A1:SetParent(UIParent)
A1:SetFrameStrata(BACKGROUND)
A1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Textures\\A1.tga"})
A1:SetHeight(80)
A1:SetWidth(512)
A1:SetPoint("BOTTOM",-0,-1);
A1:SetFrameLevel(0)

A2 = CreateFrame("Frame", nil, self)
A2:SetParent(A1)
A2:SetFrameStrata(BACKGROUND)
A2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Textures\\A1L.tga"})
A2:SetHeight(80)
A2:SetWidth(128)
A2:SetPoint("LEFT",0,-1);
A2:SetFrameLevel(0)

A3 = CreateFrame("Frame", nil, self)
A3:SetParent(A1)
A3:SetFrameStrata(BACKGROUND)
A3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Textures\\A1R.tga"})
A3:SetHeight(80)
A3:SetWidth(128)
A3:SetPoint("RIGHT",0,-1);
A3:SetFrameLevel(0)
any sugestions
__________________
  Reply With Quote
10-27-10, 07:51 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Code:
A1 = CreateFrame("Frame", nil, self)
A1:SetParent(UIParent)
The third arg to createframe is the parentframe.

Replace your two lines with

Code:
A1 = CreateFrame("Frame", nil, UIParent)
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-27-10, 01:31 PM   #3
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Got the normal state working.
But I must be missing something.

anyone knows what to do with the events

Code:
AI1 = CreateFrame("Frame", nil, UIParent)
AI1:SetFrameStrata(BACKGROUND)
if UnitInVehicle("player") then
	AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1.tga"})
else
	AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
end
AI1:SetHeight(80)
AI1:SetWidth(512)
AI1:SetPoint("BOTTOM",-0,-1)
AI1:SetFrameLevel(0)

if not UnitInVehicle("player") then
	AI2 = CreateFrame("Frame", nil, UIParent)
	AI2:SetFrameStrata(BACKGROUND)
	AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
	AI2:SetHeight(80)
	AI2:SetWidth(128)
	AI2:SetPoint("RIGHT", AI1, "LEFT", 0, 0)
	AI2:SetFrameLevel(0)

	AI3 = CreateFrame("Frame", nil, UIParent)
	AI3:SetFrameStrata(BACKGROUND)
	AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	AI3:SetHeight(80)
	AI3:SetWidth(128)
	AI3:SetPoint("LEFT", AI1, "RIGHT", 0, 0)
	AI3:SetFrameLevel(0)
end

AI1:RegisterEvent('UNIT_ENTERED_VEHICLE')
AI1:RegisterEvent('UNIT_EXITED_VEHICLE')
__________________
  Reply With Quote
10-27-10, 01:49 PM   #4
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Code:
AI1:SetScript("OnEvent", function(self, event, ...)
    if event == "UNIT_VEHICLE_ENTERED" then
        --show Vehicle UF
    elseif event == "UNIT_VEHCILE_EXITED" then
        --show normal UF
    end
end)
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
10-28-10, 02:22 AM   #5
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Originally Posted by Xubera View Post
Code:
AI1:SetScript("OnEvent", function(self, event, ...)
    if event == "UNIT_VEHICLE_ENTERED" then
        --show Vehicle UF
    elseif event == "UNIT_VEHCILE_EXITED" then
        --show normal UF
    end
end)
this did not work out. for some reason
the
Code:
-------------------------- AI-Panels by Quokka (T.C) ------------------------

AI1 = CreateFrame("Frame", nil, UIParent)
AI1:SetFrameStrata(BACKGROUND)
AI1:SetHeight(80)
AI1:SetWidth(512)
AI1:SetPoint("BOTTOM",-0,-1)
AI1:SetFrameLevel(0)

AI1:SetScript("OnEvent", function(self, event, ...)
    if event == "UNIT_VEHICLE_ENTERED" then
        AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1.tga"})
    elseif event == "UNIT_VEHCILE_EXITED" then
        AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
	else
		AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"}) -- backup
	end
end)

if not UnitInVehicle("player") then
	AI2 = CreateFrame("Frame", nil, UIParent)
	AI2:SetFrameStrata(BACKGROUND)
	AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
	AI2:SetHeight(80)
	AI2:SetWidth(128)
	AI2:SetPoint("RIGHT", AI1, "LEFT", 0, 0)
	AI2:SetFrameLevel(0)

	AI3 = CreateFrame("Frame", nil, UIParent)
	AI3:SetFrameStrata(BACKGROUND)
	AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	AI3:SetHeight(80)
	AI3:SetWidth(128)
	AI3:SetPoint("LEFT", AI1, "RIGHT", 0, 0)
	AI3:SetFrameLevel(0)
end

AI1:RegisterEvent('UNIT_ENTERED_VEHICLE')
AI1:RegisterEvent('UNIT_EXITED_VEHICLE')
__________________
  Reply With Quote
10-28-10, 10:58 AM   #6
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
You Don't register your Frame to listen to any events... Use calls like

Frame:RegisterEvent('EVENTNAME')

To actually listen to events before the SetScript-call.

Posted via phone, so fix typos yourself
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Graphics Help » lua problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off