User Tools

Site Tools


triggers:oprog

ObjProgs

Obj progs are attached in oedit with addoprog command.

Obj progs are always lua scripts.

Script ArgumentTypeNote
obj2OBJsee table
ch1CHsee table
ch2CHsee table
text1stringsee 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).

trigtypeobj2ch1ch2text1triggerPhrase typeDescription
give*nonegiverreceivernonenonenumber(%chance)
drop*nonedroppernonenonenonenumber(%chance)
eat*noneeaternonenonenonenumber(%chance)
drink*nonedrinkernonenonenonenumber(%chance)
quaff*noneeaternonenonenonenumber(%chance)
sacrifice*nonesaccernonenonenonenumber(%chance)
wear*nonewearernonenonenonenumber(%chance)
remove*noneremovernonenonenonenumber(%chance)
spell*nonecasternonenonespell namestring(spell name or *)Triggers when the object itself is target of spell
speechnonespeakernonenonefull speech textstring(keyword or *)If in inventory, fires on speech of character holding it, if in room, fires on speech of anyone in room
trynonetryernonenonefull 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*containerputternonenonenonenumber(%chance)oprog goes on the object that is being put, not a container.
get*containergetternonenonenonenumber(%chance)oprog goes on the object that is being get, not a container.
merge*second objectmergernonenonenonenumber(%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 none number(%chance) Checks every tick
greet none ch none none none number(%chance) No vis check.
See enter and exit triggers.
look* none looker none none look argument string(phrase or *) Triggered on look or examine
lore* none lorer none none none number(%chance)
move*nonemovernonenonenonenumber(%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*noneenterernonenonenonenumber(%chance)When player enters the object (portal).
See enter and exit triggers.
unlock*noneunlockernonenonenonenumber(%chance)When player unlocks an object (container only)
open*noneopenernonenonenonenumber(%chance)When player opens an object (container only)
sit*nonesitternonenonenonenumber(%chance)When player sits on an object (furniture only)
rest*noneresternonenonenonenumber(%chance)When player rests on an object (furniture only)
sleep*nonesleepernonenonenonenumber(%chance)When player sleeps on an object (furniture only)
wake*nonewakernonenonenonenumber(%chance)When a player wakes/stands from sitting/resting/sleeping on object (furniture only)
fightnonewearerenemynonenonenumber(%chance)Checked every round of a fight. Only checked for worn/wielded items.
deathnonekillervictimnonenonenumber(%chance)Triggers when object is in inventory or equipped by killer. Checked when victim is killed by the killer.
prehit*nonehittervictimnonedamagenumber(%chance)Checked on weapon before successful hit.
hitnonehittervictimnonenonenumber(%chance)Checks on weapon after successful hit (and after other effects such as weapon flag, stance, behead, etc). Checks on gloves when fighting unarmed.
timernonenonenonenonenonenumber(seconds interval)Fires at an interval of x seconds (provided as phrase)
commandnonecommandernonecommand argumentscommand namestring(command name)
(*)If trigger fires, command is prevented from going through unless 'return true' in the script.


triggers/oprog.txt · Last modified: 2019/03/24 05:13 by vodur