View Single Post
06-17-05, 07:34 PM   #5
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
After looking further into your script, I see the following:

Code:
function SathPanel_ColorG(min, max)
	local colorg = min / max;  
	return colorg;	  
end

function SathPanel_ColorR(min, max)
	local colorr = min / max;
	colorr = 1 - colorr;
	return colorr;
end

function PlayerBarThing(min, max)
	local value = min / max;
	value = value * 100;
	value = value / 100;
	value = value * 119;
	return math.floor(value+0.5);
end

function Percentize(min, max)
	local value = min / max;
	value = value * 100;
	return value;
end
By itself those are not a problem, however if max is every defined as zero, you will get an error. You might want to put an error check there and see if it clears your problems up. Possible reasons for this is that the event in your OnEvent function is independant of the VARIABLES_LOADED event, which means it may get called before all variables are loaded, which means some of the UNIT_HEALTH data could get returned as 0 since it is not yet initialized.

If a simple error check doesn't work, think about having the OnEvent function toggle a setting to true from false once variables are loaded. Then tell the other events in taht same function to only actually fire if that flagged variable has been toggled to true...

If that doesn't help I will try playing with the addon too installed in my client and see if I can locate the specific location of the error. I am trying to avoid doing that simply because its your mod. In my experience I learn more by fixing it myself, which may be the case for you too, so I don't want to take that away from you

on an unrelated note, min and max are part of the math library (math.min, math.max) and show as reserved by my syntax highlighter as well as a few others. I don't believe it will cause a problem by using them as identifiers, but I prefer to be more safe than sorry. You might consider renaming them a little just to avoid any potential problems...

Last edited by Beladona : 06-17-05 at 07:50 PM.
  Reply With Quote