I am trying to make the GMCP variables available to the general scripting space, through mediation of a plugin. In the plugin, I have a nested table called "vitals", and I'm trying to make an alias that can call information from the table. However, GetPluginVariable doesn't seem to be able to access the plugin.
vitals=GetPluginVariable("c19700e70d6a8d03b9866c24","vitals") --returned an empty value
vitals=GetPluginVariableList("c19700e70d6a8d03b9866c24") --returned a table of size 0
I double checked the ID of the plugin and the spelling of vitals. I also verified that IsPluginInstalled returned true for the plugin in question.
Thanks in advance for any help or insights.
The alias I'm using:
And the script file from the plugin itself:
vitals=GetPluginVariable("c19700e70d6a8d03b9866c24","vitals") --returned an empty value
vitals=GetPluginVariableList("c19700e70d6a8d03b9866c24") --returned a table of size 0
I double checked the ID of the plugin and the spelling of vitals. I also verified that IsPluginInstalled returned true for the plugin in question.
Thanks in advance for any help or insights.
The alias I'm using:
<aliases>
<alias
match="^update charvitals$"
enabled="y"
group="gmcp"
regexp="y"
send_to="12"
keep_evaluating="y"
sequence="100"
>
<send>require "tprint"
require "ppi"
vitals=GetPluginVariable("c19700e70d6a8d03b9866c24","vitals")
if vitals==nil then
print("vitals not found!")
end</send>
</alias>
</aliases>
And the script file from the plugin itself:
local PPI = require("ppi")
require "tprint"
require "json"
name=GetPluginID()
vitals={
hp = {curr=4500, max=4500},
mp = {curr=4500, max=4500},
ep = {curr=10000, max=10000},
wp = {curr=10000, max=10000},
nl = {curr=0, max=100},
}
charstats={}
statsArray={}
PPI.OnLoad("29a4c0721bef6ae11c3e9a82", function(gmcp)
gmcp.Listen("Char.Vitals", function(message, content)
content.maxnl = 100
for stat, data in pairs(vitals) do
data.curr = tonumber(content[stat] + 0)
data.max = tonumber(content["max" .. stat])
end
charstats=content["charstats"]
for k,v in pairs(charstats) do
local readout = {}
readout = utils.split(v,":")
statsArray[readout[1]]=string.sub(readout[2],2)
end
end)
end)
OnPluginListChanged = function()
PPI.Refresh()
end
OnPluginClose = function()
WindowDelete(name)
end
OnPluginEnable = OnPluginInstall
OnPluginDisable = OnPluginClose