This is an old revision of the document!
Obj progs are attached in oedit with addoprog command.
Obj progs are always lua scripts.
Script Argument | Type | Note |
---|---|---|
obj2 | OBJ | see table |
ch1 | CH | see table |
ch2 | CH | see table |
trigger | string | see table |
trigtype | string | see table |
The actual object to which the script is attached can be referenced in the script through 'obj' global variable (type OBJ).
trigtype | obj2 | ch1 | ch2 | trigger | type | Description |
---|---|---|---|---|---|---|
give* | none | giver | receiver | none | number(%chance) | |
drop* | none | dropper | none | none | number(%chance) | |
eat* | none | eater | none | none | number(%chance) | |
drink* | none | drinker | none | none | number(%chance) | |
quaff* | none | eater | none | none | number(%chance) | |
sacrifice* | none | saccer | none | none | number(%chance) | |
wear* | none | wearer | none | none | number(%chance) | |
remove* | none | remover | none | none | number(%chance) | |
spell* | none | caster | none | spell name | string(spell name or *) | Triggers when the object itself is target of spell |
speech | none | speaker | none | full speech text | string(keyword or *) | If in inventory, fires on speech of character holding it, if in room, fires on speech of anyone in room |
try | none | tryer | none | full try text | string(phrase or *) | If in inventory, fires on try of character holding it, if in room, fires on try of anyone in room |
put* | container | putter | none | none | number(%chance) | oprog goes on the object that is being put, not a container. |
get* | container | getter | none | none | number(%chance) | oprog goes on the object that is being get, not a container. |
rand | none | none | none | none | number(%chance) | Checks every tick |
greet | none | ch | none | none | number(%chance) | No vis check |
look* | none | looker | none | look argument | string(phrase or *) | Triggered on look or examine |
lore* | none | lorer | none | none | number(%chance) | |
enter* | none | enterer | none | none | number(%chance) | When player enters the object (portal) |
unlock* | none | unlocker | none | none | number(%chance) | When player unlocks an object (container only) |
open* | none | opener | none | none | number(%chance) | When player opens an object (container only) |
sit* | none | sitter | none | none | number(%chance) | When player sits on an object (furniture only) |
wake* | none | waker | none | none | number(%chance) | When a player wakes/stands from sitting/resting/sleeping on object (furniture only) |
fight | none | wearer | enemy | none | number(%chance) | Checked every round of a fight. Only checked for worn/wielded items. |
prehit* | none | hitter | victim | damage | number(%chance) | Checked on weapon before successful hit. |
hit | none | hitter | victim | none | number(%chance) | Checks on weapon after successful hit (and after other effects such as weapon flag, stance, behead, etc). |
timer | none | none | none | none | number(seconds interval) | Fires at an interval of x seconds (provided as phrase) |
(*)If trigger fires, command is prevented from going through unless 'return true' in the script. ![]() |