Reply
Thread Tools Display Modes
Unread 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
__________________
Quokka is offline   Reply With Quote
Unread 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: 537
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!
Rilgamon is online now   Reply With Quote
Unread 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')
__________________
Quokka is offline   Reply With Quote
Unread 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 >.>
Xubera is offline   Reply With Quote
Unread 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')
__________________
Quokka is offline   Reply With Quote
Unread 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
__________________
Mischback is offline   Reply With Quote
Unread 10-28-10, 12:29 PM   #7
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Originally Posted by Mischback View Post
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
m8 you might need a bigger phone screen.
at the bottom I register the frames

Code:
AI1:RegisterEvent('UNIT_ENTERED_VEHICLE')
AI1:RegisterEvent('UNIT_EXITED_VEHICLE')
__________________
Quokka is offline   Reply With Quote
Unread 10-28-10, 01:03 PM   #8
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
You're registering the right events, but your onevent is mixed up.
Code:
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)
Change them to UNIT_ENTERED_VEHICLE and UNIT_EXITED_VEHICLE.
Dainton is offline   Reply With Quote
Unread 10-28-10, 10:32 PM   #9
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by Quokka View Post
m8 you might need a bigger phone screen.
at the bottom I register the frames
Doh!

Overlooked that bit...
__________________
Mischback is offline   Reply With Quote
Unread 10-29-10, 04:51 AM   #10
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Originally Posted by Dainton View Post
You're registering the right events, but your onevent is mixed up.
Code:
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)
Change them to UNIT_ENTERED_VEHICLE and UNIT_EXITED_VEHICLE.
thanks.. how can I mix that up
__________________
Quokka is offline   Reply With Quote
Unread 10-29-10, 05:25 AM   #11
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
okay got it working.

but I need some sort off check, to make sure the textures show when I log in.
since my backup function fails.


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

AI2 = CreateFrame("Frame", nil, UIParent)
AI2:SetFrameStrata(BACKGROUND)
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:SetHeight(80)
AI3:SetWidth(128)
AI3:SetPoint("LEFT", AI1, "RIGHT", 0, 0)
AI3:SetFrameLevel(0)

AI1:SetScript("OnEvent", function(self, event, ...)
    if event == "UNIT_ENTERED_VEHICLE" then
        AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1.tga"})
		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1L.tga"})
		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1R.tga"})
--	elseif event == "UNIT_EXITED_VEHICLE" then
--		AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
--		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
--		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	else
		AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	end
end)

AI1:RegisterEvent('UNIT_ENTERED_VEHICLE')
AI1:RegisterEvent('UNIT_EXITED_VEHICLE')
Not sure If I should use
Code:
AI1:RegisterEvent("PLAYER_ENTERING_WORLD")
and use

Code:
AI1:SetScript("OnEvent", function(self, event, ...)
	if event == "PLAYER_ENTERING_WORLD" then
		AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	elseif event == "UNIT_ENTERED_VEHICLE" then
        AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1.tga"})
		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1L.tga"})
		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\V1R.tga"})
	else
		AI1:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1.tga"})
		AI2:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1L.tga"})
		AI3:SetBackdrop({bgFile = "Interface\\AddOns\\AI-Suite\\Art\\A1R.tga"})
	end
end)

AI1:RegisterEvent("PLAYER_ENTERING_WORLD")
AI1:RegisterEvent('UNIT_ENTERED_VEHICLE')
AI1:RegisterEvent('UNIT_EXITED_VEHICLE')
this works, but i'm not sure if i would run into problems on other ocations.
could somebody give me some advice to use it this way or how to do this the best way
__________________
Quokka is offline   Reply With Quote
Unread 10-29-10, 05:58 AM   #12
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
*note: I didnt read your code, just your question.

if your concerned about the code being called more than once

PLAYER_ENTERING_WORLD is called pretty much anytime you hit a loading screen... going into an instance, leaving an instance, and what not

PLAYER_LOGIN is called at login or a reloading of the ui
__________________
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 >.>
Xubera is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Graphics Help » lua problem

Thread Tools
Display Modes

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