Register to post in forums, or Log in to your existing account
 

 Related 
Contents
See also:
  Editing Events
  Introduction to Events
Feature Reference
  Aliases
  Macros
  Variables
  Functions
  Classes
  Triggers
  Buttons
  Gauges
  Paths
  Menus
  Events
  Modules
  Windows
  Packages
  Shared Package Library
  Package Editor
  Docked Windows
  Customizeable Toolbars
  Sessions
  Expressions
  Automapper Module
  Database Module
  Syntax Checking
  Tab Completion
  Status items
  Preferences
  Simutronics Support
  Pueblo Emulation
  Keyboard shortcuts
  MXP
  Threads
  ATCP
  Script Debugger
  Timestamps
  Lua Scripting
Related Links:
  #T+
  Terminology
  Feature Summary
  atconnect alias replaced with Events
Events [[cmud_events]] 
An Event is similar to a trigger, but instead of firing when text from the MUD is received, it is fired internally by CMUD when a certain situation occurs. For example, the "onConnect" event is fired when CMUD connects to the MUD.

There are several Pre-defined Events within CMUD. You can also create your own user-defined events.

Simply use the #EVENT command to create your own event handler, and then use #RAISE to fire the event.

For example, you might want to detect when the MUD prompt is received from the MUD:

#TRIGGER {(%d)hp (%d)mana >} {#RAISE onPrompt %1 %2} "" {prompt}

This will cause all "onPrompt" event handlers to fire, in any package, when the MUD prompt is received. Arguments are passed to the event handler, just like with aliases. In fact, the #EVENT command can use named-arguments, just like an alias. For example:

#EVENT onPrompt($hp,$mana) {#IF ($hp < 50) {cast heal}}

This event handler checks the first argument (the hp from the prompt) and heals the character if the hp value is too low. You can create as many event handlers for each event as you want. You can even put these event handlers in different packages.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net