TCL-Programs Reference Manual

Room Commands

The room will always be viewed in perspective of a char. Default this is the default mob. With the switches you can view the room in the perspective of another char. The room chosen will be the room the char is in. The only way of selecting a room the char is not in is using the -vnum option. Here the chosen char will be used the view the given room. The -last switch will return the last char used for the room commando and the last room.

room ?-mob? ?-char? ?-target? ?-last? ?-second? ?-find <charid>? ?-vnum <vnum>? ?-object <objectid>? <option> ?<arg> <arg> ...?

room Command Reference

room allmob charid TCL commands

This command will find all mobs with the given char id and run the TCL command as if they are the mob that is running the mob program (making it the default mob). No PC's will be used to execute these commands.

User contributed notes: tclmobprogs room allmob
j.vanijperen@student.utwente.nl
Dec 10, 2003 20:20

Please note that “extracting” mobs inside this TCL statement will lead to error messages.

room allobjects

Returns a list of id's of all objects in the room.

User contributed notes: tclmobprogs room allobjects
j.vanijperen@student.utwente.nl
Sep 12, 2002 10:00

Finds the first object that can be identified by $ident:

foreach i [split [room allobjects]] {
  # The "split" function returns an extra empty element at the end of
the list
  if { [string length $i] == 0 } { break }

  if { [string first $ident [obj -find $i fullname]] >= 0 } {
    ! say [obj -find $i short] - [obj -last id]
    break
  }
} 

room allpc TCL-script

TCL-script will be executed on all players in room.

room charhere charid

Returns true if a char with given charid is in this room.

User contributed notes: tclmobprogs room charhere
mavetju@chello.nl
Apr 10, 2000 13:37

For example:

if {! [room charhere v:1319]} {
    ! emote looks bored.
    return
}

room chars -name type

Returns a list of id's (or names if you specify -name) of all characters in the room, type can be mob, PC or char, default is char.

User contributed notes: tclmobprogs room chars
mavetju@chello.nl
Jan 4, 2001 14:55

doesn’t exist (yet)

mavetju@chello.nl
Jan 4, 2001 14:59

Should be working like:

addtrigger 1c greet {greetall} {trig true}
proc greetall {} {
    foreach i [split [room chars]] {
        ! say hi $i
    }
}

room count -vnum vnum -group type

Returns the number of players or mobs in the room. type is mob, PC or all. Default is player. For mobs the -vnum switch can be used. If the -vnum switch is used the mob parameter will be assumed. It overrides the PC as type. -group returns the number of group members of the char that initiates the room command.

User contributed notes: tclmobprogs room count
edwin@mavetju.org
Aug 25, 2001 14:10

It doesn’t count the person who has the trigger.
So if you let a mob-trigger do a “room count -mob”, it will return 0 if there is no other mob in this room.

room damage -lethal -self min max

Does damage to everybody in the room. If there is a default char, it doesn't damage the char unless -self is given. Damage won't be lethal unless -lethal is given.

room 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. room delay sets the time in PULSE_TICK after which the rooms delay trigger is activated. If the room has a program defined for delay trigger, the program is executed when the timer expires.

room hasdelay

Returns true if this object has a roomprog pending.

room descr new description

Returns the description of the room. Or sets it if new description is supplied.

room door direction

Returns true if the exit on the direction has a door. Note: check with "room exit" first if there is an exit.

room echo text text text ...

Sends the text to everybody in the room.

room exists

returns true if the room you are trying to access actually exists

room exit direction

Returns the vnum of the exit in the direction. If there is no room, or it doesn't exist, then it returns 0.

room exit direction flag boolean oneway

Reads or alters an exit-flag. If boolean is specified the flag is set to the new value. If oneway is also given, the change only affects this side of the exit.

User contributed notes: tclmobprogs room exit
mavetju@chello.nl
Mar 20, 2000 23:42

This function isn’t implemented yet.

mavetju@chello.nl
Nov 23, 2000 00:10

It is now, example:

proc exits {} {
    ! say N: [room exit north] [room door north] [room open north]
    ! say E: [room exit east] [room door east] [room open east]
    ! say S: [room exit south] [room door south] [room open south]
    ! say W: [room exit west] [room door west] [room open west]
    ! say U: [room exit up] [room door up] [room open up]
    ! say D: [room exit down] [room door down] [room open down]
}
addtrigger a speech {exits} {trig words exit }

room extradescr list|add|mod|del keyword description

list
lists all extra-description-keywords associated with the room. 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.

room roomflag flagname new value

Reads or sets a roomflag.

room mload vnum

Load mob with given vnum into this room.

room name

Returns the name of the room.

room id

Returns the vnum of the room.

room namespace

Returns the complete namespace where the roomprog for this room instance resides.

room objhere objid

Returns true if object with given objid is in this room. In room means lying on the ground, not in inventory or equipment.

room oload vnum level

Load object with given vnum into this room.

room open direction

Returns true if the exit on the direction has a open exit. Note: check with "room exit" first if there is an exit.

room 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

room delproperty key type

Removes the property from the room.

room purge option objid/charid

The mob executing the mob program won't be purged.

Options:

all
Purge the complete room except calling mob
mob
Purge the specified mob. (first one that matches char id)
obj
Purge the specified obj. (first one)
allmob
Purges all mob with charid
allobj
Purges all objects with objid

room randomchar -name -mob -char TCL-prog

Returns a random character id. (-name option is used to return a random name.) Normally only players will be selected, this can be changed with the -mob (only mobs) or -char (mob or char) switches. returns 0 if no char has been found.

When a TCL-script has been added that script will be run, and the selected random char will be the default character. This can be used with the char command or in use with the mob -char or ! -char. When no randomchar has been selected, the script won't be executed at all.

Example:

room randomchar {
  if {[char isimmortal]} {
    ! say "Greetings, master [char]"
    ! bow [char]
  } else {
    ! tip [char]
  }
}
	

room

See the room name command.

room sector -name

Returns the sector type for the room.

room timer value

Without arguments it returns the timer setting. With arguments it sets the timer. If argument is cancel the timer will be stopped.

room timer value starts the timer at the given value. Every PULSE_MOBILE the timer will be increased. The timer can be stopped with the room timer cancel command. The timer triggers the TIMER triggers. The trigger value will contain the value of the timer.

room hastimer

Returns true if this room has a timer running.

room addtrigger name type call trigger

See roomtrigger command

room deltrigger -all -prefix name

It needs one ore more arguments. With the -all switch it deletes all triggers from this mob. 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.

room triggers

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