I see a couple of things that could cause problems. First, the GMCP thing. Your scripts fire when Mudlet loads the profile, not when you connect to the MUD. This means, of course, that you won't
have any GMCP data to use at load time. The simplest solution for you in this case is to initially fill your variables with dummy values.
Like so:
NioSys.currentHP = gmcp and tonumber(gmcp.Char.Vitals.hp) or 100
NioSys.totalHP = gmcp and tonumber(gmcp.Char.Vitals.maxhp) or 100
...
Basically, this says "If the gmcp variable is not nil, then use this value. Else, use 100." It's not strictly necessary here, since we
know that the GMCP table doesn't exist yet. But it's a good practice to learn and use elsewhere.
Now, the next thing I see is the way you're passing your addresses to the Gauge constructor. Vyzor uses a function that iteratively tracks through the global variable table (in Lua, this is _G) using the string you passed in, period delimited.
When you pass in something like "totalHP", it's actually looking in _G["totalHP"] (_G.totalHP) and finding nothing. It finds nothing, of course, because you actually stored that value in the variable NioSys.totalHP. Therefore, you want to pass in the address "NioSys.totalHP". This translates to _G["NioSys"]["totalHP"] (_G.NioSys.totalHP).
And, finally, the reason that your XP gauge maximum is 1 is because you passed in "100". This means that Vyzor is looking for a value stored at _G["100"]. Obviously, it doesn't find it, and Vyzor defaults the value to 1. Looking at it now, it may be a nice feature to allow you to pass numbers directly. However, for the foreseeable future, you'll want to make a variable to store that 100 in; something like NioSys.totalXP, to follow your naming convention.
So, to recap, you want something that looks vaguely like...
NioSys.currentHP = 100
NioSys.totalHP = 100
...
NioSys.currentXP = 100
NioSys.totalXP = 100
...
NioSys.HpGauge = Vyzor.Gauge("HpGauge", "NioSys.currentHP", "NioSys.totalHP", ...)
NioSys.ExpGauge = Vyzor.Gauge("ExpGauge", "NioSys.currentXP", "NioSys.totalXP", ...)
Hell, just as a bonus, here's how you could turn the whole thing into one loop, since there's a lot of repetition (disclaimer: written in browser):
local gaugesToMake = {
"Hp",
"Mp",
"End",
"Will",
"Exp"
}
for _, gaugeToMake in ipairs( gaugesToMake ) do
local current = "current" .. gaugeToMake
NioSys[current] = 100
local total = "total" .. gaugeToMake
NioSys["total" .. gaugeToMake] = 100
local front = gaugeToMake .. "Front"
NioSys[front] = Vyzor.Frame(front)
local back = gaugeToMake .. "Back"
NioSys[back] = Vyzor.Frame(back)
local gauge = gaugeToMake .. "Gauge"
NioSys[gauge] = Vyzor.Gauge(gauge,
NioSys[current],
NioSys[total],
NioSys[back],
NioSys[front])
local frame = gaugeToMake .. "Frame"
NioSys[frame]:Add(NioSys[gauge])
end
I'll leave the colours as an exercise for you, if you choose to go down this route. But it may involve tables or functions. As a general practice, it's always helpful to identify areas of repetition, as these areas are usually great candidates for loops; cutting down on the sheer number of lines in your code makes it easier to modify and maintain over time.