View Single Post
06-09-05, 08:37 AM   #9
diiverr
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 67
Thank you for the replies. I know I'm clueless, but I sincerly appreciate your patience. I really am learning a lot.

Beladona,
I did as suggested... The update function now reads:
Code:
function DiivSkins_hbar1Update()

	if(DiivSkinsSettings) then
		if not (DiivSkinSettings) then
			DiivSkinSettings = {}
			DiivSkinSettings.hbar1 = 2
		end
		elseif(DiivSkinSettings.hbar1 == 1) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.9023437, 0.984375);

		elseif(DiivSkinSettings.hbar1 == 2) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.8203125, 0.9023437);

		elseif(DiivSkinSettings.hbar1 == 3) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.7382812, 0.8203125);

		elseif(DiivSkinSettings.hbar1 == 4) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.65625, 0.7382812);

		elseif(DiivSkinSettings.hbar1 == 5) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.5742187, 0.65625);

		elseif(DiivSkinSettings.hbar1 == 6) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.4921875, 0.5742187);

		elseif(DiivSkinSettings.hbar1 == 7) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.4101562, 0.4921875);

		elseif(DiivSkinSettings.hbar1 == 8) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.328125, 0.4101562);

		elseif(DiivSkinSettings.hbar1 == 9) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.2460937, 0.328125);

		elseif(DiivSkinSettings.hbar1 == 10) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.1640625, 0.2460937);

		elseif(DiivSkinSettings.hbar1 == 11) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.0820312, 0.1640625);

		elseif(DiivSkinSettings.hbar1 == 12) then
			DiivSkins_hbar1Texture:SetTexCoord(0.0, 1.0, 0.0, 0.0820312);
		end
	end
end
I then added the suggested <Scripts> to the original texture frame's xml. (better quote them too, just to be safe)

Code:
		<Scripts>
			<OnLoad>
				this:RegisterEvent("VARIABLES_LOADED");
			</OnLoad>
			<OnEvent>
				if (event == "VARIABLES_LOADED") then 
					DiivSkins_hbar1Update(); 
				end
			</OnEvent>
		</Scripts>
That, save the check in the Update function itself for the variable, is a variation of what I have been trying, although I was calling for the Update function from elsewhere, typically in my normal OnEvent function. The net result of your suggestion, assuming I executed it properly) produced the same nil error as before regarding the Update function itself. I get this error at startup or reload, or, I assume, when VARIABLES_LOADED fires.

you did say:
... although the syntax is badly written, so you may want to fix that. I can assist if you need.
I think(?) Gello set me straight there. I hope I did that correctly. For the record, I will ALWAYS welcome help in that arena, or any other for that matter, so don't be shy, and thank you.




Gello,

I will definitely take a look at Recap, and see if that doesn't shed any light for me, thank you. From a cursory examination of what you posted here, there does seem to be some pretty fundamental structural differences in the way you coded it all. (I don't understand the "arg" notion either, but admittedly I haven't attempted to dissect them yet.)
EDIT: Whoah, how have I missed this! (sorry, just got into game with recap, that looks to be a very slick little toy. )

RE:
Don't try fitting everything into the xml. In many cases it's better to manipulate stuff in your OnEvent handlers than the control's own event handlers.
I probably poorly worded that. When I said fire, I meant I have the line: DiivSkins_hbar1Update(); in my <OnValueChanged>, and that seems to be the only place it doesn't return a nil error when called.

Last edited by diiverr : 06-09-05 at 08:56 AM.
  Reply With Quote