User Tools

Site Tools


This is an old revision of the document!


Obj progs are attached in oedit with addoprog command.

Obj progs are always lua scripts.

Script ArgumentTypeNote
obj2OBJsee table
ch1CHsee table
ch2CHsee table
triggerstringsee table
trigtypestringsee table

The actual object to which the script is attached can be referenced in the script through 'obj' global variable (type OBJ).

trigtypeobj2ch1ch2triggerPhrase typeDescription
spell*nonecasternonespell namestring(spell name or *)Triggers when the object itself is target of spell
speechnonespeakernonefull speech textstring(keyword or *)If in inventory, fires on speech of character holding it, if in room, fires on speech of anyone in room
trynonetryernonefull try textstring(phrase or *)If in inventory, fires on try of character holding it, if in room, fires on try of anyone in room
put*containerputternonenonenumber(%chance)oprog goes on the object that is being put, not a container.
get*containergetternonenonenumber(%chance)oprog goes on the object that is being get, not a container.
merge*second objectmergernonenonenumber(%chance)
Triggers when object is merged. Return false to prevent the merge from completing.

When player does a merge, the first object is checked for merge trigger and if it has one, its prog is run. If the first script returns false then the merge is canceled and the second object is not checked for merge trigger. If the first object didn't have a trigger or the prog returns true then the second object is checked for trigger prog is run if it has one. If the second trigger returns false then the merge is canceled, otherwise if it has no merge trigger or the prog returns true the the merge will succeed.
rand none none none none number(%chance) Checks every tick
greet none ch none none number(%chance) No vis check.
See enter and exit triggers.
look* none looker none look argument string(phrase or *) Triggered on look or examine
lore* none lorer none none number(%chance)
move*nonemovernonenonenumber(%chance)Triggers when object is in the inventory or equipped by a player and the player moves. Return true allows movement, return false prevents it.
See enter and exit triggers.
enter*noneenterernonenonenumber(%chance)When player enters the object (portal).
See enter and exit triggers.
unlock*noneunlockernonenonenumber(%chance)When player unlocks an object (container only)
open*noneopenernonenonenumber(%chance)When player opens an object (container only)
sit*nonesitternonenonenumber(%chance)When player sits on an object (furniture only)
rest*noneresternonenonenumber(%chance)When player rests on an object (furniture only)
sleep*nonesleepernonenonenumber(%chance)When player sleeps on an object (furniture only)
wake*nonewakernonenonenumber(%chance)When a player wakes/stands from sitting/resting/sleeping on object (furniture only)
fightnonewearerenemynonenumber(%chance)Checked every round of a fight. Only checked for worn/wielded items.
deathnonekillervictimnonenumber(%chance)Triggers when object is in inventory or equipped by killer. Checked when victim is killed by the killer.
prehit*nonehittervictimdamagenumber(%chance)Checked on weapon before successful hit.
hitnonehittervictimnonenumber(%chance)Checks on weapon after successful hit (and after other effects such as weapon flag, stance, behead, etc). Checks on gloves when fighting unarmed.
timernonenonenonenonenumber(seconds interval)Fires at an interval of x seconds (provided as phrase)
commandnonecommandernonecommand namestring(command name)
(*)If trigger fires, command is prevented from going through unless 'return true' in the script.

triggers/oprog.1496910922.txt.gz · Last modified: 2017/06/08 01:35 by bobble