TCL-Programs Reference Manual

Object Commands

This command can be used to get information about an object. Default the commands will work on the object that was used in the trigger.

obj ?-find <objid>? ?-last? ?-obj? ?-second? ?-set <slot>? ?-get <slot>? <option> ?<arg> <arg> ...?

Switches:

-find <objid>Search for the object with this object id.
-objUnused
-secondSecondary object of the trigger
-lastLast object referenced.
-set <slot>Store the resulting obj in a memory slot. (0<=slot<=4) Slots are reset when the trigger ends
-get <slot>Recall an obj from a memory slot.

obj Command Reference

obj listaff permanent temporary

Returns a list of lists with the affects on the obj. If permanent and/or temporary is given only those affects are returned. default is to return both. The second level list consists of the following fields:

where
Where does the affect go? (obj affect immunities resistance ...)
type
Skill/spell this affect belongs to or reserved if is added manually
level
Level of the affect
duration
Number of ticks an affect will be active
location
What field does this affect modify
modifier
Delta of the modification
vector
What does this affect give you. (see 'flags for' in set affect)

obj carried_by

Returns the char-id of the person/mob who is carrying this object or 0 if is isn't carried by anybody.

User contributed notes: tclmobprogs obj carried_by
verlag@fataldimensions.org
Jul 16, 2006 10:21

If you use this for echoes, make sure that the object is carried_by before you refer to it:
proc jiggle {} {
 if {[obj carried_by]} {
  switch [random 1 2] {
  1 {char -find [obj carried_by] echoaround “An enlarged brain says ‘[color yellow]Eat me![color]‘“}
  2 {char -find [obj carried_by] echoaround “[color random]Jiggle Jiggle[color]“}
  }
 }
}

objtrigger 1 random {jiggle} {trig chance 2}

obj condition new condition

If new condition is defined, it will set the condition of the object to this value, otherwise it will return the condition of this object.

obj contained_in

Returns the obj-id of the container which is holding this object or false if it isn't in a container.

obj contains

This command returns a list of objects-id's of the objects in this container.

User contributed notes: tclmobprogs obj contains
mavetju@chello.nl
Dec 4, 2000 11:55

To use this parameter:

proc test {} {
    set inhoud [obj contains]
    for {set i 0} {$i<[llength $inhoud]} {incr i} {
    set objid [ lindex $inhoud $i]
        ! say $i $objid [ obj -find $objid name ]
    }
}

objtrigger 1 lookat {test} {trig true}

obj cost new_cost

Returns the cost of an obj in silver. If new_cost is given it first changes the cost to new_cost.

obj delay number

Without arguments it returns the current delay timer. By specifying "cancel" as number the delay is canceled. With arguments it sets the delay timer. obj delay sets the time in PULSE_TICK after which the objects delay trigger is activated. If the object has a program defined for delay trigger, the program is executed when the timer expires.

obj hasdelay

Returns true if this object has a objprog pending.

obj addeff where type level duration location mod vector arg1

Adds an effect to the obj. Please consult with a coder because you can get realy strange results if you use incorrect parameters.

obj exists

Returns true if the obj exists. This is the only command that will not result in an error and the script aborting if there is no obj found. Useful for testing if a trigger has a -second obj.

obj extra flagname new value

Reads (or writes is new value is supplied) an 'extra' flag of an object. Returns the value of the flag at the end of the command as an integer. (0 for false, otherwise true) Keep in mind that some flags are read-only.

flagname
name of flag (see below)

anti-class anti-evil anti-good anti-neutral anti-race bless burn_proof class-only dark evil freeze_proof glow had_timer hum inventory invis lock magic melt_drop no_drop no_identify no_locate no_purge no_sell no_show no_steal non_metal noremove nouncurse race-only reflecting rot_death sell_extract vis_death

new value
boolean

obj extract

Removes this object from the game. When executing object commands will generate error messages most of the time.

obj extradescr list|add|mod|del keyword description

list
lists all extra-description-keywords associated with the obj. Keywords belonging to the database obj are ignored. The keyword description are not needed.
add|mod
Add's or changes a description. mod will add a keyword if it doesn't exist yet and add will modify an already existing keyword. (yes, add==mod) Both parameters are mandatory.
del
Removes an extra-description. Only the keyword parameter is needed.

obj flag flagset flagname new value

[Missing] use obj extra or obj wear

Reads (or writes is new value is supplied) a flag of an object. Returns the value of the flag at the end of the command as an integer. (0 for false, otherwise true) Keep in mind that some flags are read-only.

flagset
extra | wear
flagname
name of flag (see below)
extra
anti-class anti-evil anti-good anti-neutral anti-race bless burn_proof class-only dark evil freeze_proof glow had_timer hum inventory invis lock magic melt_drop no_drop no_identify no_locate no_purge no_sell no_show no_steal non_metal noremove nouncurse race-only reflecting rot_death sell_extract vis_death
wear
take finger neck body head legs feet hands arms shield about waist wrist wield hold no_sac wear_float
new value
boolean

obj forget

Forgets the remembered char.

obj fullname new names

If new names is defined, it will set the names of the object to this value, otherwise it will return the complete name of this object.

Please note that once you've changed this name you can't access it anymore by the old name, so please use the object-identifier for accessing it!

obj hastarget

Does this object have a target?

obj id

Returns the unique id of this object

obj level new level

Without parameters, it returns the level of an object. With parameters, it sets the level of an object.

obj long new long name

If new long name is defined, it will set the long description of the object to this value, otherwise it will return the long description of this object.

obj material new_material

Returns the material an obj is made of. If new_material is given it first changes the material to new_material.

obj name

Returns the first name of this object.

obj namespace -db

Returns the complete namespace where the objprog for this obj instance resides. if -db is given, the namespace for the objs database object is given instead.

obj

obj hasowner

Returns true (1) if the obj is owned, false (0) in all other cases.

obj owner new_owner

If new_owner is given it changes the owner of the obj to new_owner. Otherwise returns the owner of an obj or 0 if it has no owner.

obj property key type value

If value is defined, it will set the property to the character, otherwise it will return the value of the property matching the specified key/type.

Type can be:

int
Integer
char
Character
long
Long int
bool
Boolean
string
String

obj delproperty key type

Removes the property from the obj.

obj putin container

Puts an object into a container. This works only if the container is a real container.

User contributed notes: tclmobprogs obj putin
mavetju@chello.nl
Jun 15, 2000 13:55

“obj putin” has been added on June 15th 2000.

obj remember charid

This command returns the remembered target. When giving an charid it remembers this character.

This command enables the object to remember a player for future reference in a objprog. The player can subsequently be referred as char -target in programs activated by the mobile. obj forget clears the target. Most commonly this command is used in delayed programs, where the object has to remember the player who triggered the original event.

User contributed notes: tclmobprogs obj remember
galah_1@yahoo.com
Oct 1, 2001 13:32

Just a quick one - it is:

obj remember

(not OBJect remember :)

obj short new short name

If new short name is defined, it will set the short description of the object to this value, otherwise it will return the short description of this object.

obj targethere

Returns true if the target of the object is in the room of the object.

User contributed notes: tclmobprogs obj targethere
mavetju@chello.nl
Oct 30, 2000 23:58

An example of the obj remember, target, forget commands:

proc bomb {} {
   if {[obj targethere]} {
       ! -find p:[obj remember] say boom
   } else {
       ! -find pg:[obj remember] say I ran away
   }
   obj forget
}
proc remember {} {
   ! -char say tick... tick... tick...
   obj remember [char id]
   obj delay 1
}

objtrigger 1 delay {bomb} {trig true}
objtrigger 2 drop {remember} {trig true}

If you drop the bomb, it will start a timer and after one tick you will either hear it explode or realize that you ran away from it. Don’t use ! -target, right now it segfaults.

obj decaytimer new timer

DEPRICATED: obj timer new timer

Returns, if no new timer is defined, the timer value of an object. If it is defined, it will set the timer of the object.

obj transfer mob id

obj transfer room vnum

Transfer an object to a location. If it is in inventory then it will be removed from the inventory.

obj transfer-content mob id

obj transfer-content room vnum

Transfer the contents of an object to a location.

obj addtrigger name type call trigger

See objtrigger command

obj deltrigger -all -prefix name

It needs one ore more arguments. With the -all switch it deletes all triggers from this obj. You can also give the name of the trigger to delete. With the -prefix switch you can delete all triggers that are starting with a certain prefix.

obj triggers

Returns a list of triggernames for use with the trigger command.

obj type

Returns the type of this object.

obj value number new_value

This command returns the object-specific value, as used in the definition of the object. If new_value is given the value is changed first. The returned values are always integers.

User contributed notes: tclmobprogs obj value
mavetju@chello.nl
Nov 19, 2000 00:38

for example for a drink-container:

[v0] Liquid Total: [256]   -> 256
[v1] Liquid Left:  [256]   -> 256
[v2] Liquid:       [water] -> 13
[v3] Poisoned:     No      -> 0

obj vnum

Returns the vnum of this object

obj weapon flagname new value

Reads (or writes if new value is supplied) a 'weapon' flag of an object. Returns the value of the flag at the end of the command as an integer. (0 for false, otherwise true) Keep in mind that some flags are read-only.

flagname
name of flag (see below)

take finger neck body head legs feet hands arms shield about waist wrist wield hold no_sac wear_float

new value
boolean
If no flagname is given, a list of active weapon flags is returned.

obj wear flagname new value

Reads (or writes if new value is supplied) a 'wear' flag of an object. Returns the value of the flag at the end of the command as an integer. (0 for false, otherwise true) Keep in mind that some flags are read-only.

flagname
name of flag (see below)

take finger neck body head legs feet hands arms shield about waist wrist wield hold no_sac wear_float

new value
boolean
If no flagname is given, a list of active wear flags that represent an actual wear location is returned. (ie flags like 'take' are never in this list)

obj weight new_weight

Returns the weight of an obj. If new_weight is given it first changes the weight to new_weight.