Home » Immortals »

Triggers

Triggers provide the ability for mobs to react to events that are generated in their vacinity.

There are two types of triggers:

Challange Triggers - Which provide the mob with the ability to prevent other mobs (including players) from doing things

Reaction Triggers - Which provide the mob with the ability to take actions after it has 'seen' other mobs (including players) do something.

Triggers are the primary animating force for mobs, being used to drive the initiation of scripts in response to input that the mob recieves. In addition to the normal, visual, events that players see, there are a number of hidden events that only mobs can react to.

Trigger Data

Triggers are part of a mobs definition and are added through the OLC Trigger command.

The attributes for each trigger are:

Event Type (event type)

This is the type of the event that will be reacted to. A trigger can only match a single event type.

Sequence Number (int)

The triggers associated with each event type are checked in order of this sequence number. This is important as the order than the events are checked can determine which one matches the trigger.

Event subtype (event subtype)

This is the subtype defined within the event that the trigger should match. You can also speicfy 'none', in which case the trigger will match all events of its main event type.

Script Number (script)

The number of the script that should be run when the trigger is satisfied. There are no checks that the script is defined when the trigger is defined.

Text template (string)

This is an optional string of phrases combined with AND and OR logic that will be compared to the text present on the event. It should be used carefully, as text based matching is expensive.

Condition (condition)

The condition is evaluated for each event that reaches the trigger. If the condition is satisfied (as well as the type, subtype and text fields), the the trigger has matched the event. No further trigger comparisons will occur for the event (on this mob) and the script associated with the trigger will be enqueued to the mob for execution.

Trigger Evaluation

The processes for evaluating Challange and Reaction Triggers are slightly different. Reaction triggers are about letting all mobs react to an event that has happened. Challange triggers are about finding out if any of the mobs present objects to the action. The evaluation of challange triggers stops as soon as 1 mob in the room objects to the action (ie has a challange trigger which matches the event).

The process is thus:

  1. The events type is used to see if the mob has any triggers for that type. If it does not, there is assumed to be no reaction and no objection.

  2. The triggers for that type are then checked in sequence.

  3. If the subtype on the trigger isn't none, that is checked.

  4. If a text template is specified, that is checked.

  5. Finally, if one is present, the condition is checked.

  6. If there is a match on all of these, then the event is said to have matched the trigger and the reaction (or objection) is scheduled.

With challange triggers, it is the responsability of the mob builder to provide a script which will explain why the action was denied. The code will simply not perform it and no error messages will be issued to anyone.

It should also be noted that certain events do not have challange or reaction forms. These are either because it would be silly/impossible for the mob to deny permission, because the result of such a denial would be ambigious or paradoxical or because the reaction side would produce to much visual clutter for players.

Text Templates

Text templates consist of words or phrases separated by and (&) and or (∨) signs. The ANDs are always evaluated before the ORs.

The following is an example of a text temple:

   woman&white|lady&white|ghost&lady

This is parsed and checked as:

   ((woman)&(white))|((lady)&(white))|((ghost)&(lady))

It would match any of the following:

  • Have you see the woman in white?

  • Who is the white lady?

  • Where is the ghost of lady Zara?

But it would NOT match the following:

  • Tell me about the white ghost

  • Who is the ghost of the woman?

  • Who is the lady of the castle?

The strings being tested may not contain the '&', '|' or '~' characters.

Event Types and Subtypes

give
  1. gold

  2. item

get
  1. gold

  2. item

put
  1. item

drop
  1. gold

  2. item

  3. plant

  4. item_melt

poison
  1. food

  2. weapon

  3. fountain

fill
  1. fountain

drink
  1. fountain_ok

  2. fountain_bad

  3. item_ok

  4. item_bad

eat
  1. food_ok

  2. food_bad

  3. pill

  4. herb

  5. corpse

sacrifice
  1. pc_corpse

  2. corpse

  3. trash

  4. treasure

  5. item

gadget
  1. gadget_ok

  2. gadget_bad

search
  1. item

  2. room

  3. find_item

  4. find_mob

  5. find_door

  6. find_hound

depart
  1. walk

  2. sneak

  3. fly

  4. swim

  5. sail

  6. portal

  7. magic

  8. current

  9. fleeing

arrive
  1. walk

  2. sneak

  3. fly

  4. swim

  5. sail

  6. portal

  7. magic

  8. current

  9. fleeing

pulse
  1. 1_sec

  2. 3_sec

  3. 4_sec

  4. 5_sec

  5. 10_sec

  6. 30_sec

  7. area

time
  1. hour

  2. day

  3. sunrise

  4. sunset

  5. dawn

  6. dusk

control
  1. login

  2. logout

  3. linkdead

  4. reconnect

mob
  1. stop

  2. select

  3. echo

death
  1. slain

  2. stun

attack
  1. kill

  2. kick

  3. trip

  4. bash

  5. dirt

  6. backstab

  7. disarm

  8. circle

  9. rotate

  10. murder

  11. tail

  12. crush

combat
  1. miss

  2. hit

  3. block

  4. parry

  5. dodge

  6. absorb

  7. immune

damage
  1. injured

  2. hurt

  3. dirt

  4. trip

  5. bash

  6. env

oocc
  1. beep

  2. gossip

  3. music

  4. immtalk

  5. question

  6. answer

  7. tell

  8. gtell

icc
  1. tell

  2. say

  3. shout

  4. scream

  5. yell

  6. mtell

  7. telepathy

social
  1. emote

  2. fsoul

  3. nsoul

  4. hsoul

  5. csoul

idol
  1. hold

  2. pray

  3. object

  4. gold

society
     #  invite
     #  join
     #  advance
     #  resign
     #  expel
     #  demote
     #  test
     #  foe
     #  pardon
 dream
     #  walk
     #  awaken
     #  say
     #  psay
     #  emote
     #  pemote
     #  cast
     #  pcast
lock
  1. d_open

  2. i_open

  3. d_close

  4. i_close

  5. d_lock

  6. i_lock

  7. d_unlock

  8. i_unlock

  9. d_pick

  10. i_pick

activity
  1. start

  2. stop

heal
  1. hits

  2. mana

  3. moves

debate
  1. start

  2. continue

  3. finish

knock
  1. door

interpret
  1. strange

oprog
  1. use

  2. wear

  3. remove

  4. explosion

  5. photo

  6. destroy

  7. rebuild

  8. effect

learn
  1. learn

  2. practice