| Message |
Hi Couto. Glad to see my plugins are still getting some use. :) That version is actually outdated though. In particular, it only supports a certain selection of ATCP messages that the Iron Realms MUDs provide.
I provide a more up-to-date version on my website at <http://jonathan.com/mushclient-achaea-plugins>. This version can receive and transmit any arbitrary ATCP message. Make sure to read the instructions on that page for installation, because the plugins use a directory structure instead of a single-file format.
You can download one of the GMCP-dependent plugins (such as the Gauges plugin) to get an idea of how to access the protocol data. They say GMCP-based, but they include handlers for both GMCP and ATCP, so just look for the one that makes mention of 'atcp' instead. For example, from my Gauges plugin:
local atcp_stats = {H = "hp", M = "mp", E = "ep", W = "wp", NL = "nl"}
PPI.OnLoad("7c08e2961c5e20e5bdbf7fc5", function(atcp)
atcp.Listen("Char.Vitals", function(message, content)
for stat, curr, max in string.gmatch(content, "(%w+):(%d+)/(%d+)") do
gauges.stats[atcp_stats[stat]].curr = curr
gauges.stats[atcp_stats[stat]].max = max
end
gauges.draw()
end)
end)
The PPI.OnLoad() call is what registers your plugin with PPI (which is that communication mechanism I mentioned). When the plugin at the given ID (this one is for the ATCP plugin) is known to be loaded and available, it executes the callback with a special interface object. You can use that to call the other plugin's interface methods, which for ATCP are Send, Listen, and GetContent (which you don't normally need).
As you can see above, atcp.Listen() is being called. This tells the ATCP plugin what message you want to listen for. When that message is received, it will pass your callback the message name and its contents. This is where you would update your gauges display.
Here's a couple links to previous discussions about topics I've mentioned. If you have any questions, let me know!
Directory structure for plugins: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=10081
Plugin-to-Plugin Interface: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=9970 |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|