Easy GMCP with Vadim Peretokin

  Table of Contents

Written by Vadim Peretokin

Welcome to the wonderful, invisible world of GMCP that’ll make your life a lot easier! GMCP is a data channel that’s implemented in IRE and other MUDs that provides you with easier access to many types of new info - like your vitals stats, detailed geographical data as to where you are, what items you have, and what skills you’ve got!

So let’s get started with it, then. This will be a thorough, newbie-friendly tutorial filled with pictures you can spy at - and we’ll be using the latest version of the freely-available MUD client, on Windows, Mac and Linux OS, called Mudlet (get it here), which supports GMCP. Once you’ve got it, make sure that you’ve got GMCP enabled (Settings → General), and you’re all set to start learning!

Retrieving GMCP data

One of the most useful GMCP features across all IRE games is that with each prompt comes easily-accessible character vitals (like health, mana) data. This removes the need to make complicated regex patterns that work with all different kinds of prompts - this solution will take care of that! So let’s make a prompt trigger that will easily capture our vitals for us.

Start off by clicking on Triggers:


Then Add Item:



return isPrompt()

to the first field, and by setting the pattern type to Lua function


We’ve got ourselves a basic prompt trigger now - let’s add GMCP magic, and use it to capture our current and max health/mana amounts into variables myhealth and mymaxhealth. Add the code from the box below into the big white space in your new trigger:

myhealth, mymaxhealth = tonumber(gmcp.Char.Vitals.hp), tonumber(gmcp.Char.Vitals.maxhp)

echo(string.format("[%d/%dh]", myhealth, mymaxhealth))

Should everything be setup alright, our echo will be doing this on every prompt, verifying that our data capture is working:


  How awesome is that? Now you’d probably wonder - how did I know that gmcp.Char.Vitals.hp corresponds to your current health, and gmcp.Char.Vitals.maxhp to your max health? The trick is simple, and you’ll see it when you ‘unshroud’ GMCP - by clicking the ‘Debug’ button bottom-left:



Part 2: Discovering GMCP's Data