GMCP Tutorial Part 2

  Table of Contents

 Written by Vadim Peretokin

Discovering GMCP’s data

Suddenly, your screen will be filled with things like this (clicking Debug again will turn it off, by the way):

GMCP 

The line where it says GMCP event <gmcp.Char.Vitals> tells us that the gmcp.Char.Vitals table was updated - and because you see it before the prompt, our prompt trigger works and uses the latest information! You might want to look at all that’s available in gmcp.Char.Vitals besides hp and maxhp - you can do that by installing the runLuacode alias and doing lua gmcp.Char.Vitals, which will show you all that’s available in that table.

lua gmcp.Char.Vitals

 

Recap

So now you know how to see GMCP events as they’re coming in (by enabling Debug), how to view what GMCP data you have (by doing lua gmcp), and how to retrieve GMCP data (by accessing gmcp, like gmcp.Char.Vitals.hp will get you your current health). There are two things left to learn: trigger on GMCP events and send GMCP requests to the server (which you can use to ask for more information!)

Note: as you might have noticed, Mudlet stores data from incoming GMCP events in the gmcp table, with the rest of the key name corresponding to the event name - so if you receive a Char.Vitals event from the server, it’s data will be stored in gmcp.Char.Vitals. Mudlet also raises events whenever you receive GMCP data - which you’ll read about later on - and the event name has the same format; gmcp.Char.Vitals

 

 

Part 3: Sending GMCP