View Single Post
06-10-05, 01:13 PM   #23
diiverr
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 67
Originally Posted by Beladona
no problem. just trying to balance "direction / help" with "do it this way".

Just know everything I tell you is the way I would do it, but doesn't mean it HAS to be done that way. In some case that may be true, due to the way lua wants it, but in many cases I show you the way I would do it if I was doing your mod.

On taht note however, I am not doing your mod, and don't really want to, or else it wouldn't be your mod - so I will stick to helping, giving input, and correcting, as long as you want it, and are willing to take the criticism. After all, criticism makes us better in the long run, and hopefully will make your addon one of the better, more well written ones out there!
I think it's confessional time. Last night, while dismantling what was left of the old AddOn, I noticed a slight oversight. I have the AddOn currently organized with seperate files for the basic frames displayed on screen, and the control elements. I had apparently forgotten to include<Script file="DiivSkinsControl.lua"/> in the DiivSkins.xml. So I believe any script calls to a function from the bar xml weren't being executed. BIG <blush> I would wager that previous suggestions would have likely had me up and running quite a while back in this thread.

So, thank you so much, particularly Gello, for the assistance thus far. I'm sorry it couldn't have been more productively applied.

That little embarassing tidbit off my chest, I must say I am quite impressed with "your way" Beladona, and happily embrace it, and your guidance, as we move forward.

Now, next up would be "plugging in" additional elements to the existing code. So we're all on the same page, this is the lua as of current, including the replotted textures. (I snuck home for lunch).

Code:
-- Global Functions ---------------------------------------
function DS_FirstLoad()
	DS_ControlConsole:Show();
	DS_startup:Show();
	DiivSkinSettings.setup = true;
end
function DS_TextureOnEvent()
	if (event == "VARIABLES_LOADED") then 
		if (not DiivSkinSettings) then DiivSkinSettings = {}; end
		if (not DiivSkinSettings.hbar1) then DiivSkinSettings.hbar1 = 1; end
		if (not DiivSkinSettings.setup) then DS_FirstLoad(); end
		DS_TextureUpdate();
	end
end
function DS_TextureUpdate()
	local key = DiivSkinSettings.hbar1;
	local var = DiivSkinTextures[key];
	DiivSkins_hbar1Texture:SetTexCoord(var.a, var.b, var.c, var.d);
end

-- Configuration Variables ---------------------------------
DiivSkinTextures = {};
DiivSkinTextures[1] = {a = 0.0, b = 1.0, c = 0.9023437, d = 0.984375};
DiivSkinTextures[2] = {a = 0.0, b = 1.0, c = 0.8203125, d = 0.9023437};
DiivSkinTextures[3] = {a = 0.0, b = 1.0, c = 0.7382812, d = 0.8203125};
DiivSkinTextures[4] = {a = 0.0, b = 1.0, c = 0.65625, d = 0.7382812};
DiivSkinTextures[5] = {a = 0.0, b = 1.0, c = 0.5742187, d = 0.65625};
DiivSkinTextures[6] = {a = 0.0, b = 1.0, c = 0.4921875, d = 0.5742187};
DiivSkinTextures[7] = {a = 0.0, b = 1.0, c = 0.4101562, d = 0.4921875};
DiivSkinTextures[8] = {a = 0.0, b = 1.0, c = 0.328125, d = 0.4101562};
DiivSkinTextures[9] = {a = 0.0, b = 1.0, c = 0.2460937, d = 0.328125};
DiivSkinTextures[10] = {a = 0.0, b = 1.0, c = 0.1640625, d = 0.2460937};
DiivSkinTextures[11] = {a = 0.0, b = 1.0, c = 0.0820312, d = 0.1640625};
DiivSkinTextures[12] = {a = 0.0, b = 1.0, c = 0.0, d = 0.0820312};
Looking at that, logic tells me that I will need to add additional lines to the DS_TextureOnEvent function and the DS_TextureUpdate function to reflect a DiivSkinSettings.hbar2. Obviously, corresponding changes would then be made in the new slider frame as well, but a new bar frame would reference the universal Texture_Update. (?)

Where you really lost me, is where I would redirect attention to a new set of plots for the configuration variables once I move beyond horizontal bars and on to a new texture, say, for vertical bars.

I don't have time to fiddle with this in-game right now, but I'm guessing I will define a new set of Variables, a new [key], DiivSkinTextures_02 for example, for the new element. Or would I stay in DiivSkinTextures, and progress to something more to the tune of:
Code:
DiivSkins_vbar1Texture:SetTexCoord(var.e, var.f, var.g, var.h);
?

Am I close?
  Reply With Quote