I'm sure I'm doing something wrong. The world properties show the MXP vars are updating correctly, so I think maybe the WatchValue call is wrong? Or the way I'm making a local copy of the variable in OnMXPVariable? Not sure as I can't find much info on it. Any help would be appreciated!
<!-- Script -->
<script>
require "InfoBox"
require "wait"
-- PLUGIN GLOBALS
statusbar = InfoBox:New("Menu")
statusbar.window_width = 200
statusbar:Columns(1)
statusbar:Rows(3)
mxp_health=0
mxp_credits = 0
hpbar = statusbar:AddBar("Health", 80, "green")
hpbar.padding = 4
hpbar.threshold = 100
hpbar:WatchValue("mxp_health")
cashbar = statusbar:AddBar("Credits", 80, "green")
cashbar.padding = 4
cashbar:WatchValue("mxp_credits")
cashbar.threshold = 100
statusbar.windowposition = InfoBox.windowPositions.SE
-- Do on connect thing
function OnPluginDisconnect ()
end --function
function OnPluginConnect ()
-- show windows
statusbar:Update();
-- bind keys
end -- function
-- Updates the info bar
function OnMXPvariable(key, value)
SetVariable(key, value)
hpbar:Update()
cashbar:Update()
statusbar:Update()
end -- function
-- ... unrelated code
</script>