Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Set up a method as an event handler in the GUI (easiest, but only allows one handler pr script)
    • Create a new script
    • Give it a name, e.g. "onGmcpCharVitals"
    • in the script, create a function with the same name, eg function onGmcpCharVitals()
    • Add the event name to the "Add user Event Handler" (e.g. gmcp.Char.Vitals) and click the "+" button, so that the event name is pushed up to the "Registered Event Handlers"
  2. Use an AnonymousEventHandler (this is somewhat more complex to do right, but allows multiple handlers in the same script), e.g. 
    • handlerId = registerAnonymousEventHandler("gmcp.Char.Vitals", "processCharVitals")

    • Note! make sure to save the handlerid, and check for its existance before you register a handler when usign this method, otherwize you might get multiple fires pr event


Event Handler from the GUIAnonymousEventHandler


CMUD Specific

To use GMCP in CMUD, you use Triggers,

  1. Make a new trigger
  2. Set its pattern to the gmcp module name you are interested in, e.g. "Char.Vitals" (This means the trigger will automatically fire when the mud sends updated vitals)
  3. Change the Trigger type to "GMCP"
  4. In the script part, you can now access the variables directly using %gmcp.Char.Vitals.hp, e.g.
    • #VAR hp %gmcp.Char.Vitals.hp
    • or
    • hp = %gmcp.Char.Vitals.hp

Image Added