SciffyMUD

Programming SciffyMUD: Events

This document attempts to explain the concept of events.

The basic idea of event-based programming is that most of the time, you do nothing. However, sometimes something will happen upon which you must take action - such as someone logging on or completing a quest or picking up an object, or whatever.

There are a large number of events which happen in the game. These are all listed in this file.

Firstly, work out what it is that you are trying to do. (Such as giving someone 10000 experience when they complete a quest).

You will want something to happen, so work out the action which you need for that here.

Work out the conditional you need to say if the action is performed here

Work out what the event which triggers these is from the table below.

Event

When called

Values set for bound conditional and action

<name of emotional command> Upon use of the given command (e.g. if I type "happy", it generates a happy event) (does not work for non-predefined emotes)
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
<name of emote-on-someoneelse command> Upon use of the given command (e.g. if I type "bounce Fred", it generates a bounce event) (does not work for non-predefined emotes)
  • targetCharacter1 - who called the command
  • targetCharacter2 - whom the command was called upon ("Fred" in this example)
  • targetRoom1 - room containing targetCharacter1 and targetCharacter2
hello The "hello" command.
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
  • targetValue1 - "greetall" for normal hellos, "greetback" for greet-back, "cow" for the cow thing.
emote The general emote command (not any predefined macro)
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
  • targetValue1 - what was emoted
hit Someone hits someone else once (not called during normal combat; see fight below)
  • targetCharacter1 - person who throws a blow onto targetCharacter2
  • targetCharacter2 - person who recieves a blow from targetCharacter1
  • targetRoom1 - room containing targetCharacter1
fight Character begins combat

(note that if two people fight each other, then the two "strands" of combat are worked out independantly at the moment)

  • targetCharacter1 - person who throws blows onto targetCharacter2
  • targetCharacter2 - person who recieves blows from targetCharacter1
  • targetRoom1 - room containing targetCharacter1
password Character tries to change their password
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
drop Character drops an item
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1, into which item is dropped

    When dropping multiple items, this is to be called repeatedly.

  • targetObject1 - object which is to be dropped
get Character picks up an object
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
  • targetObject1 - object which has been taken
read attempt to read an item
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
  • targetItem1 - item to be read
who Someone tries to find out who is on the MUD
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
go Character moves into a new room
  • targetCharacter1 - who has moved?
  • targetRoom1 - Old room in which targetCharacter1 was previously
  • targetRoom2 - New room in which targetCharacter1 is now
  • targetValue1 - direction of motion in numerical form
  • targetValue2 - direction of motion in string form
complain A complaint has occurred
  • targetCharacter1 - who complained
  • targetRoom1 - room containing targetCharacter1
look Character examines something
  • targetCharacter1 - who does the examine
  • targetCharacter2 - character examined (or aetherial for none)
  • targetRoom1 - room containing targetCharacter1
  • targetRoom2 - room examined (or aetherial for none)
  • targetObject1 - object examined (or aetherial for none)
  • targetValue1 - either "room", "object", "npc", or "character" depending on what was examined
help Character invokes the help command
  • targetCharacter1 - who does the examine
  • targetRoom1 - room containing targetCharacter1
say Using the say command
  • targetCharacter1 - who called the command
  • targetCharacter2 - who the command was said to (or aethereal for things said aloud)
  • targetRoom1 - room containing targetCharacter1 (and targetCharacter2 if they exist)
  • targetValue1 - what was said
logoff Character has left the MUD
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1
inventory Character checks their inventory
  • targetCharacter1 - who called the command
  • targetRoom1 - room containing targetCharacter1

You now have an action, a conditional and an event.

bind <action> <condition> <event>

If you got the syntax right, it should now work. Some basic checking is done on the condition, but not much.

Test the binding! If it doesn't work, unbind it and try again...

You can get a list of bindings with dump bindings


Back to Magic

Back to Creation

Back to index

Zarlock the Superfluous to Requirements
Last modified: Tue May 8 23:21:42 BST 2001