GMCP Tutorial Part 3

 Table of Contents

 

Sending GMCP

Your MUD might support sending commands via GMCP to it - for examples, take a look at this sheet for IRE games or Aardwolfs wiki. For example, on IRE games, you can ask the server Char.Skills.Get and the server will tell you what skills you have got - this can come in handy for auto-configuring scripts. In Mudlet, the function to send a GMCP request is sendGMCP() - so with our example, you’d do:

sendGMCP("Char.Skills.Get")

in a script and get an appropriate Char.Skills.Groups response (as the documentation mentions).

The same Char.Skills.Get request can take additional parameters with it, like the documentation mentions:

sendGMCP([[Char.Skills.Get { "group": "elemancy", "name": "firelash" }]])

(note how I replaced "" with [[]] now - that's because you can't have a " inside a "). You can either use the example above, or you can also use this:

sendGMCP("Char.Skills.Get "..yajl.to_string({group = "elemancy", name = "firelash"}))

Both have the same effect, but you might find the latter easier to work with as you get better with Lua.

Note: There is currently a known issue on IRE games - a response to a GMCP command will not be sent to you until you until the next line, if you have MCCP enabled. So to workaround, you might want to use a blank send() command:

sendGMCP("Char.Skills.Get"); send("\n")

 

 

Part 4: Triggering on GMCP