Error number: 0
Event: Run-time error
Description: [string "Plugin"]:7: attempt to perform arithmetic on a nil value
stack traceback:
[string "Plugin"]:7: in function 'percent'
[string "Plugin"]:41: in function 'draw'
[string "Plugin"]:51: in main chunk
Called by: Immediate execution
Here is the plugin, im royally confused now.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Gauges"
author="Trevize"
id="0860ccb8e0e747814da4d907"
language="Lua"
purpose="gauges"
date_written="2008-08-18"
requires="4.35"
version="1.01"
>
</plugin>
<script><![CDATA[
TextRectangle (300, 0, 0, 0, 0, 0x000000, 0, 0x000000, 0)
stats = {
percent = function (health)
local x = math.floor (tonumber (GetPluginVariable ("Health", health))/tonumber (GetPluginVariable ("", "max" .. health))*100)
if x > 100 then x = 100 elseif x < 0 then x = 0 end
return x
end, -- func
}
gauges = {
name = GetWorldID () .. "1",
position = {5, 20, 35, 50, 65},
create = function (txt, num, col, pos)
WindowRectOp (gauges.name, 1,
26, gauges.position[pos]-1, 127, gauges.position[pos]+1,
ColourNameToRGB ("silver"))
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127, gauges.position[pos]+10,
0x010101)
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127-(100-num), gauges.position[pos]+10,
ColourNameToRGB (col))
local txtwidth = WindowTextWidth (gauges.name, "font", txt)
WindowRectOp (gauges.name, 2,
25-(txtwidth), gauges.position[pos], 25, gauges.position[pos]+10,
0x010101)
WindowText (gauges.name, "font", txt,
25-(txtwidth), gauges.position[pos], 0, gauges.position[pos]+10,
ColourNameToRGB ("silver"), false)
end, -- func
draw = function ()
gauges.create ("H:", stats.percent ("health"), "red", 1)
end, -- func
}
WindowCreate (gauges.name, 0, 0, 133, 80, 10, 4, ColourNameToRGB ("black"))
WindowFont (gauges.name, "font", "Lucida Console", 8, false, false, false, false)
gauges.draw ()
WindowShow (gauges.name, true)
]]></script>
</muclient>
|