View Full Version : LF .lua frame manipulation guide for noobs like me....
ChaosInc
29-07-2007, 05:58 AM
Got XML down and most of .lua with the exception of frame creation/management. Been trying to figure it out on my own (cause I learn the best hands on...) but I keep breaking ****.
Haven't found a guide for it like most that can be found at wowwiki. If anyone can point me in a direction of a guide for this it'd be appreciated. My MageTaxi mod is getting into more advanced coding that I'm slowly teaching myself, but everyone needs help at some point. :cool:
Jumpy
29-07-2007, 09:11 AM
I think WowWiki is all you are going to find. Sadly the information is spread all over the place in bits and pieces. The only other source is to study other addons.
Telic
29-07-2007, 11:34 AM
Once you have used "CreateFrame" to create a component, then WoWwiki's Widget API lists most of the things you need to then setup/manipulate the component...
I'm not saying its easy or intuitive, and I am happy using XML myself, but I think you will be able to do most things via LUA ... ;)
What kind of things are you trying to do ?
ChaosInc
29-07-2007, 02:11 PM
Just added buttons to the frame to cast portals, but I would like to have it automatically switch the buttons based on whether the player is Alliance or Horde (since they obviously have different cities to port to.
The mod already detects which faction the player is when it loads and sets city selection for the spamming buttons. I'd also like to apply this the port buttons (if Alliance set button to port to Stormwind; if Horde set button to port to Undercity).
Hope this makes sense.
Telic
29-07-2007, 04:21 PM
Spell casting and Secure frames are definitely NOT my specialty, but if you are dynamically creating the XML buttons in the LUA code, then can't you just set different Attributes depending on the player's Faction ?
local pFrame = CreateFrame("Button", "MyPortalButton", MyButtonsFrame, "SecureActionButtonTemplate");
pFrame:RegisterForClicks("LeftButtonDown");
pFrame:SetAttribute("unit","none");
pFrame:SetAttribute("type1", "spell");
if ( Horde ) then
pFrame:SetAttribute("spell1", "My_Horde_Spell");
else
pFrame:SetAttribute("spell1", "My_Alliance_Spell");
end
The brute force way of doing it might be to have 2 buttons and show/hide them depending on which Faction the player is :wink:
ChaosInc
29-07-2007, 06:34 PM
The frames are actually not being created from the .lua. I've created a virtual button template in the XML and plan to use the .lua to change the attributes, as you've noted. I just haven't been able to get it to work yet without it breaking something else. :undecided:
Although after discussing it and with the various suggestions, I've think I've figured out a way to do it. Trying it later tonight or tomorrow when I have time. But for the time being, I already thought of the two frames that you suggested and working on making it happen as a temp "fix" for it til I get the .lua swap figured out.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.