I've started using this plugin in my systems on IRE games. I've seen it suggested in other threads and it's worked so far. I couldn't find a forum post for FAQs and updates, so I'm asking here.
This plugin explains:
--
Purpose is to receive incoming GMCP messages and populate the global table 'gmcpdata' with the values as received so that GMCP under Mushclient can use partial refreshes of data. For example, we might receive:
Then next time, if only HP and Mana have changed, receive:
char.vitals { "hp": 100000, "mana": 85000 }
The previous value for 'moves' will be remembered and available until it is refreshed.
--
This is specifically bad with Aetolia and its Char.Afflictions and Char.Afflictions.list (I think they end up being the same thing). When you cure an affliction, the original global table isn't updating because it's not supposed to by design. I can't clear this table from local script, and I'm not really understanding how/when the plugin builds the original table.
In the above example, what I'd want:
--
We might receive from char.vitals:
I can't demonstrate the issue without showing what's incoming from the MU* _without_ the plugin, and the only tool I know that'll do that is Wireshark. And incoming from the MU* is spitting gibberish to me, with exception to the loggin.
So, the example I'd provide, you'd have to trust that I'm not talking out of my rump or that the game isn't behaving like it shouldn't.
Three seconds for the later, unless you know how to work Wireshark.
It doesn't look to me like it is sending a subset of the data. Also for you to use the plugin you need to have your own plugin that receives the data. So I'm not sure what you are trying to do, what you expect to happen, and what is actually happening.
This small plugin demonstrates how you might use GMCP. I tested it in Aetolia.
To save and install the GMCP_demo plugin do this:
Copy the code below (in the code box) to the Clipboard
Open a text editor (such as Notepad) and paste the plugin code into it
Save to disk on your PC, preferably in your plugins directory, as GMCP_demo.xml
The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
Go to the MUSHclient File menu -> Plugins
Click "Add"
Choose the file GMCP_demo.xml (which you just saved in step 3) as a plugin
Click "Close"
Save your world file, so that the plugin loads next time you open it.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="GMCP_demo"
author="Nick Gammon"
id="b9171e77bc4ed6d2926eebdc"
language="Lua"
purpose="GMCP demonstration"
date_written="2014-06-09"
requires="4.73"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
fulldata = {}
--=================================================================================
-- Called when plugin receives telnet data - main entry point for actually running
-- the plugin.
--=================================================================================
function OnPluginBroadcast (msg, id, name, text)
-- Look for GMCP handler.
if (id == '3e7dedbe37e44942dd46d264') then
if (text == 'reload') then
-- invalidate current data
fulldata = {}
return
end
-- print ("GMCP packet = ", text)
if (text == "Char.Base" or text == "Char.Vitals" or text == "Char.Status" or text == "Char.Maxstats") then
res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","Char")
luastmt = "gmcpdata = " .. gmcparg
assert (loadstring (luastmt or "")) ()
-- copy into fulldata
for k, v in pairs (gmcpdata) do
fulldata [k] = v
end -- for
if text == "Char.Vitals" then
ShowHealth ()
end -- if
end
end
end
oldequilibrium = 0
oldbalance = 0
function ShowHealth ()
hp = tonumber (fulldata.Vitals.hp)
maxhp = tonumber (fulldata.Vitals.maxhp)
equilibrium = tonumber (fulldata.Vitals.equilibrium)
balance = tonumber (fulldata.Vitals.balance)
SetStatus ("Health: " .. hp .. "/" .. maxhp .. " Equilibrium = " .. equilibrium .. " Balance = " .. balance )
if equilibrium == 1 and oldequilibrium == 0 then
ColourNote ("darkgreen", "", "You have regained equilibrium")
elseif equilibrium == 0 and oldequilibrium == 1 then
ColourNote ("darkred", "", "You have lost equilibrium")
end --if
oldequilibrium = equilibrium
if balance == 1 and oldbalance == 0 then
ColourNote ("darkgreen", "", "You have regained balance")
elseif balance == 0 and oldbalance == 1 then
ColourNote ("darkred", "", "You have lost balance")
end --if
oldbalance = balance
end -- ShowHealth
]]>
</script>
</muclient>
This gets the stats from the GMCP data, and in the function ShowHealth updates the status bar with your hit points, and shows a message when you gain or lose equilibrium or balance.