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. NOT RECOMMENDEDUse 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


Warning

Note! I do not recomment method 2 unless you are very experienced with Lua and event programming. This is because it is VERY easy to get into a state where the handler will fire multiple times.




Event Handler from the GUIAnonymousEventHandler


CMUD Specific

To use GMCP in CMUD, you use Triggers,

...