Object Actions

These are similar to mob actions, but, as you might expect, objects can't exactly use commands. Therefore, everything an object script contains is an object command, and doesn't need to be prefixed with object.

With one exception (TRIGGER) - the target of the action is the person doing to command that triggered the action. Some objactions don't have an actor, and are unable to use actor-based commands.

Tech notes: Object actions are more risky than mobactions, as, objects don't normally do anything. There is no pre-defined flow control with them. For this reason:

  • There is no delay setting in object actions.
  • There is no re-entrance possible (i.e. if you wear a hat, and that triggers you to have to wear a scarf, any actions related to wearing the scarf wont' happen)
  • Some actions are deemed 'risky' - those that move or destroy items or characters. These will short-circuit any remaining actions. (if you're going to echo something and extract the object, you better do the echo first.)
  • Object's don't have states. With over 20,000 in the game at a time, I am not sure there is any merit in giving them states.

Object Triggers

  • WEAR - triggered when item is worn
  • REMOVE - triggered when item is removed
  • GET - triggered when item is picked up
  • DROP - triggered when item is dropped
  • PUT IN - triggered when item is put in a container
  • CONTAINER - triggered when something is added or removed from a container/drink container
    • Phrase - "to" - Something added to the container
    • Phrase - "from" - Something removed from the container
    • Phrase - "empty" - The container is emptied.
    • Phrase - "fountain" - Someone fills from the fountain.
    • Phrase - "fill" - The container is filled.
    • Phrase - "pourout" - The container is poured out.
    • Phrase - "pourin" - Something is poured into the container.
  • LOOK - triggered when the object is looked at
  • GIVE - triggered when the object is given to someone
    • Phrase - The person who received the item's name
  • RECEIVE - triggered when the object is given to someone - in this case, the receiver is the 'target' of the action
    • Phrase - The person who gave the item's name
  • CONSUME - the item is eaten
  • FIGHT - triggered when a weapon hits in combat.
  • SPELL - triggered when item is a target of a spell
    • Phrase - The name of the spell
  • INIT - triggered when the item is first loaded into the game. Limited to area resets, and, not for P resets.
  • ZONE RESET - triggered for every item on a room in a zone when that zone resets
  • TRIGGER - triggered from the mobaction "objtrigger item character"
  • USED - triggered based on item type. Currently:
    • Furniture - triggered when sat/stood/etc upon
      • Phrase - the position taken (standing, sitting, etc)
    • Portals, Containers, Furniture Containers - Triggered when manipulated.
      • Phrase - lock, unlock, open, close, pick
    • Gems - Triggered when tapped.
      • Phrase - tapped
  • UPDATE - triggered once a minute by the spec_obj_update function. The 'actor' is treated as whoever is holding the item, the room is used if the item is in a room, not held.
  • VERB - triggered in response to a spec_verb execution.
  • SPECIFIC - The phrase must be matched exactly, not partially

Object Conditions

Like with mob conditions, these are grouped. If no items in a group are selected, the actions assume that group is irrelevant and treat it as if all are selected. The groupings are separated with a space below.

  • EVIL - only when the actor is evil
  • GOOD - only when the actor is good
  • NEUTRAL - only when the actor is neutral
  • MALE - only if the actor is male
  • FEMALE - only if the actor is female
  • NEUTER - only if the actor is neuter
  • DAY - only during the day
  • NIGHT - only at night
  • WORN - only if the item is worn
  • CARRIED - only if the item is carried by someone (even worn)
  • INVENTORY - only if the item is carried by someone, and not worn
  • IN ROOM - only if the item is on the ground
  • PC - Must be set to trigger for players
  • NPC - Must be set to trigger for mobs
  • IMM - Must be set to trigger for imms
  • CRIMINAL - Must be set to trigger for criminals
  • NEWBIE - works only for level 5 and under
  • HERO - works only for level 91
  • RUNNING - Works only if the object is running a LensC program. Strongly suggested for actions that signal programs
  • NOT RUNNING - Works only if the object is not running a LensC program. Strongly suggested for actions that run programs.

Phrase

This is just like with a mob action. Not all triggers use this.

Chance

This is just like with a mob action, a percent chance

Action

This is just like with a mob action. The set of possible commands is listed below. Any line ending with a / will be continued on the next line; in this way, commands longer than the line-wrapper allows can be entered.

LML tags can be used withing the body of an action, but, there are definate problems with this. First, the first and last lines of the action have to be <LML> and </LML>. Secondly, LML auto-wraps the resulting text. As object action processing uses line breaks to designate different commands, you will have to work very hard to make sure that the wrapped line breaks fall where needed. Finally, tags only work in actions where there is a character triggering the action. Update, Init, Zone Reset, and other non-actor actions won't process LML tags.

Actions

allecho text

The text is sent to the everyone in the room, including the actor. A $p is replaced with the item name.

charecho text

The text is sent to the character. A $p is replaced with the item name.

consume room/char all/item

An item found on the character, or in the room, is extracted. Can be used with 'all' to get all a characters possessions, or everything in the room.

deduct amount

Removes (amount) of silver from the actor, up to the amount they have.

extract

Removes the object from the game.

freeze seconds

Freezes (input lags) the actor for n seconds, defaulting to 3.

IF - detailed at bottom.

interpret command

Forces the actor to use a command.

loadmob vnum

Loads mob with vnum to the room the item is in.

loadobj vnum

Loads an item with vnum. If there is an actor, and the item can be held, the actor gets it, otherwise it goes to the room.

peace

Stops all fighting in the room.

pop

Teleports the item to a random room in the zone it is currently in. Items won't pop out of containers, but will pop from within people's inventories.

restore / restore room

Restores the actor/ restores everyone in the room.

roomecho text

Sends text to the room. $p is replaced with the items name. $n is the actor's name, $e (he/she), $s(his/her), $m (him/her) also work. If there is an actor, they won't receive this message, they need to be sent a charecho too.

sendtext text

Sends the specified text to the actor, with no code replacement or capitalization.

set timer minutes

Sets the item's timer. An item is extracted when the timer hits 0.

set spec spec_fun

Sets the item's spec_fun.

slay

Instantly slays the actor.

trans vnum (unseen) (all)

Trans to a specified vnum. If unseen is specified, they don't see that they've moved. If all is specified, all people in the room are moved.

trigger message

Sends a mobact trigger to the room, with the actor as the target, and the message as the phrase.

zonequest prior state new state

Sets the actor's zonequest state, like the mobaction.

wear

Forces the actor to wear the item.

drop (always)

Forces the actor to drop the item. Always means the item is dropped even if normally nodrop.

remove

Forces the actor to remove the item.

run vnum argument

The object runs the specified lensc program.

signal vnum argument

The argument is sent to the running program with the specified vnum.

cast 'spell name' any extra parameters

An object can't really cast a spell. So, the actor actually is treated as the caster. For spells with a target that is a mob/player, the caster is the target too. For spells with an item target, the object is the target. Standard checks for magic resistance, are checked, but, it isn't the object actually casting it per se.

IF

If is extremely similiar to mobact if for mobactions, with the following differences.

  • You have an object, not a mob. Object's don't receive text, this can be a lot harder to debug.
  • Object's don't have eyes.

The best way to get data about the 'actor' (if there is one) is to use the [N] expression, which is set up to be the actor. @$.name is less likely to give you what you want. Likewise, [p] for the item is your best bet to get the info you need on the object.

So, if the sword only turns to a snake for bob, your action would be:

	if ([N].name == "bob") loadmob 14001
	if ([N].name == "bob") roomecho $p turns into a snake.
	if ([N].name == "bob") charecho $p turns into a snake.
	if ([N].name == "bob") extract
Yes, you have to put the IF on each line, you can't nest object triggers, so there is no way to get a whole block.

OLIF

OLIF is lile LIF in mob actions, with a couple of differences. The syntax is:

	olif [debug] (<lensc expression>) <obj action> [else <obj action>]
obj actions are the same commands found on this page.

The following variables are set up for you:

  • self - The object, type OBJ
  • oifch - The character holding the item. Might not be a valid handle.

Commands related (these should all be self explanatory):

  • olc add oaction
  • olc edit oaction
  • olc remove oaction
  • olc view oaction
  • stat oaction vnum