Char Commands
Commands that work on mobs characters and player characters. The default character is the character that caused the trigger.
char ?-mob? ?-char? ?-target? ?-last? ?-second? ?-find <charid>? ?-set <slot>? ?-get <slot>? <option> ?<arg> <arg> ...?
Switches:
-mob | Execute command on the mob that is running the mobprog (default) |
-target | The remembered mob. (Doesn’t work if it is a char) |
-last | Command will be done on the mob that did a command last time |
-second | Use secondary char if available. |
-find <charid> | Execute the command on the mob with the given <charid> |
-set <slot> | Store the resulting char/mob in a memory slot. (0<=slot<=4) Slots are reset when the trigger ends |
-get <slot> | Recall a char/mob from a memory slot. |
-char | Not used |
char Command Reference
- act
- acts
- alignment
- cansee
- clan
- class/race
- condition
- damage
- die
- echo
- effects
- equipment
- exists
- experience
- fighting
- group
- hasdelay
- hasjob
- id
- inventory
- ischarmed
- isimmortal
- level
- location
- money
- name
- objhere
- off/vuln/res/imm
- oload
- ool
- points
- position
- property
- questpoints
- selectobj
- sex
- statistics
- stats
- timeskilled
- wimpy
char act to format arg1 arg2 minposition
See mob act.
char acts flag newvalue
Without the flag-parameter, it will return the list of act flags for the character. With the flag-parameter, it will toggle that flag. If newvalue is also given, instead of toggling, the flag is set to newvalue. Gives different results for mob or player.
char isact act
Is the act flag set? Uses different flags for mob or player.
This code will see if a player uses pueblo, if he does, then he plays a sound.
addtrigger see lookat { sound } { trig true } proc sound {} { if {[ char isact pueblo ]} then {playsound} } proc playsound {} { char echo </xch_mudtext><img xch_sound=play xch_volume=100 src=“http://www.../evil_laf.wav"><xch_mudtext> }
char isgood
Returns true if character is good
char isevil
Returns true if character is evil
char isneutral
Returns true if character is neutral
char align -text
Returns the alignment of the char. When the -text option is given it returns "good", "evil" or "neutral" depending on the chars alignment.
char align new_alignment
Sets the new alignment of char. 'new_alignment' must be between -1000 and 1000.
char cansee charid
Can this char see charid
char canseeobj objid
Can this char see objid
char clan -name
Returns the clan number (or name)
char rank
Returns the rank of the character as a number.
char race
Returns the race of the character as string.
char class
Returns the class of the character as string.
char thirst new thirst
Returns or sets the thirst value of a player. 0 is very thirsty, 48 is drowned :-)
char adrenaline new adrenaline
Returns or sets the adrenaline value of a player. 0 is relaxed, 48 is very shaking.
char hunger new hunger
Returns or sets the hunger value of a player. 0 is very hungry, 48 is full.
char drunk new drunk
Returns or sets the drunk value of a player. 0 is sober, 48 is totally of this world.
char damage -lethal min max
Does damage to the character
The char damage command will do lethal damage, or a random amount of damage between the min/max values given.
char die charid
Instantly kills the char. charid should be the killer. If no killer is given, the death will be treated as a deathtrap death. This means the corpse will end up in the morgue. Please let the death char know he died as this command doesn't output anything to the victim.
char echo text text ...
Sends the text directly to this char.
char echoaround text text ...
Send text to everybody in room except for the char itself.
char iseff affect
Is the char affected by affect
char aff
Returns a list of all effects on the char.
char addeff where type level duration location mod vector arg1
Adds an effect to the char. Please consult with a coder because you can get realy strange results if you use incorrect parameters.
char remeff effect
Removes the effect from the char. Keep in mind that this is only the flag, the spell is still on the char.
char removespell spell
Removes the spell from a char.
char listeff
Returns a list of lists with the effects on the char. The second level list consists of the following fields:
- where
- Where does the effect go? (obj affect immunities resistance ...)
- type
- Skill/spell this effect belongs to or reserved if is added manually
- level
- Level of the effect
- duration
- Number of ticks an effect will be active
- location
- What field does this effect modify
- modifier
- Delta of the modification
- vector
- What does this effect give you. (see 'flags for' in set affect)
char iswearing objid
Returns true if the character is wearing the object with given objectid.
char wears option Wearlocation Wearlocation ...
Returns a list of objects that the character is wearing. Options:
- vnum
- Returns a list of vnums
- name
- Returns a list of names
- id
- Returns a list of id's
char remove -all objid
Normally the remove command removes the object with the given object id from the character. When the -all switch is given the object with that objectid will be removed and the same command will be repeated again until no objects are found. If no arguments are given the command does nothing. If only the -all switch is given, all objects are removed.
mob equip -silent -replace object
Moves an object from the inventory to its equipment location. It will replace the current obj only if -replace is given.
mob unequip -silent location
removes an object from the equipment location and puts it in the inventory.
char exists
Returns true if the char exists. This is the only command that will not result in an error and the script aborting if there is no char found. Useful for testing if a trigger has a -second char.
char exp exp
Returns, if no exp is defined, the number of experience points of the player. If it is defined, it will increase the number of experience points of the player with it. Because this might ruin the game, the command is logged.
char tnl
Returns the amount of experience-points needed to gain the next level.
char expforalevel
Returns the amount of experience-points needed for a level.
char fighting -id|-vnum|-name
Returns the id (or vnum or name) of whoever the char is fighting. If the char is not fighting 0 (or in case of -name an empty string) is returned. If the char is fighting a PC and -vnum is specified 0 is returned.
char follows -name
The id of the char who this person is following. Returns 0 if char isn't following someone. With the -name switch you can get the name of the player or the first name of the mob the character is following, or an empty string if he/she isn't following anybody.
char group -recursiveTCL commands
char followers -recursiveTCL commands
The TCL commands will be executed for all chars that are in the same group and in the same room. The commands will be executed as if those chars triggered the mobprog. (The default char will be set to to each group member) The followers form of this command will select that follow the same leader, they do not have to be grouped.
Example:
char group {
char goto 3001
}
If -recursive is given followers of followers are also included.
If no error has occured during execution, the command returns the number of chars it found. (TIP: a non-existing script has a very hard time failing)
char hasdelay
Does this char have a mobprog pending? (see mob delay)
char hasjob job_name
Returns a list of jobs assigned to the char. Or, if job_name is given, tests if the char has been assigned the job.
char id
Returns the unique identifier for this char.
char vnum
Returns the vnum of the mob or 0 for a player.
char iscarrying objid
Returns true if player is carrying object with objid.
char carries -id|-name|-vnum vnum
Returns a list of objects a character is carrying. Options:
- vnum
- Returns a list of vnums
- name
- Returns a list of names
- id
- Default: Returns a list of id's
proc spinnen {} { set inv [char carries -id 32033] if {[llength $inv] > 0} then { room echo The spinningwheel starts to rumble. char echo You throw some [color yellow]straw[color] on the spinningwheel, not knowing what to do with it otherwise. obj -find [ lindex $inv 0] extract char echoaround [char name] throws some [color yellow]straw[color] on the spinningwheel, not knowing what to do with it otherwise. room oload 32037 } else { room echo The spinningwheel starts to rumble. room echo And stops after a little while. } } objtrigger 1 speech {spinnen} { trig words rumpelstiltskin } (from FairyWorld)
-id is NOT default
char ischarmed
Returns true if character is charmed
char isimmortal
Returns true if character is immortal
char isnpc
Returns true if character is a mob
char ispc
Returns true if character is a player
char level
Returns the level of the char.
char room
Returns the vnum of the room the char stands in.
char goto location
Char is transfered to the specified location. Returns previous location (room vnum)
char money -gold -silver -total -amountismax -deduct|-add amount amount
Without options, or with -total it will return the total value of money a character has, in silver-pieces. With -gold or -silver, it returns amount of gold or silver coins the character has.
if none of -gold -silver -total are given , the amount of money the char has is set or increased|decreased depending on -add|-deduct. A single amount is interpreted as 'total', two amounts as respectively gold and silver.
An attempt to deduct more money than the char has will result in an error unless -amountismax is specified.
char
Returns the first name of the mob or the name of the PC
char name
Returns the first name of the mob or the name of the PC
char fullname
Returns the full name of the mob or the name of the PC
char short
Returns the short name for mobs or name for PC's.
char nametitle
Returns the name and the title, properly concatenated.
char title
Returns only the title.
char objhere object name
Return the the object-id of the object with the given object name. If no object is found 0 is returned. Numbers can be includes in the object name. So "char objhere 3.s" will return the third object starting with an "s".
char isoff off
Is the off flag set. Uses different flags for mob or player.
char off
Returns a list of off flags. Gives different result for mob or players.
char isimm imm
Returns a boolean if immunity flag is set.
char imm
Returns a list of immunities.
char isres res
Returns a boolean if the char is resistant to the given value.
char res
Returns a list of resistant flags.
char isvuln vuln
Returns true if the char is vulnerable to the given flag.
char vuln
Returns a list of vulnerability flags.
char oload vnum level wear|take|wearnoshow
This command will load object with vnum vnum into the chars inventory. If "wear" is specified, the char will wear the object. The "take" option is default. "wearnoshow" will equip the object but not show to other people.
char ool_penalty
Returns a number according to these rules:
- less than 0
- char has a clean slate
- equal to 0
- char is on probation
- larger than 0
- char has been bad (value == days left until entering probation)
char hp new_value
Returns (or sets) the current hitpoints. Please note: decreasing should be done with [char damage]
char maxhp new_value
Returns (or sets) the maximum amount of hitpoints.
char hpcnt -text value
Returns percentage of hitpoints left. With -text it returns a description of the chars condition. With value, value is assumed to be the current amount of hitpoints.
char move new_value
Returns (or sets) current movement points.
char maxmove new_value
Returns (or sets) the maximum amount of movement points.
char mana new_value
Returns (or sets) current mana points.
char maxmana new_value
Returns (or sets) the maximum amount of mana points.
char position -text
Returns the position of the char. Using -text it returns a text:
- 0
- dead
- 1
- mort
- 2
- incap
- 3
- stun
- 4
- sleep
- 5
- rest
- 6
- sit
- 7
- fight
- 8
- stand
char isactive
Returns true if character isn't sleeping (or dieing)
char 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
char delproperty key type
Removes the property from the char.
char questpoints qps
Returns, if no qps is defined, the number of questpoints points of the player. If it is defined, it will increase the number of questpoints points of the player with it. Because this might ruin the game, the command is logged.
char selectobj -roomfirst -charfirst -room -char -equipment -inventory text
Searches for an obj described by text from the chars point-of-view and returns true if it found one. [obj -last] can be used to refer to the found obj.
You must specify where to search by either specifying -roomfirst, -charfirst, or a combination of -room , -char, -equipment, and -inventory. Order is important!
-room searches the room.
-char searches the char.
-equipment searches the equipment the char is using.
-inventory searches the inventory of the char.
-roomfirst is equal to -room -inventory -equipment
-charfirst is equal to -inventory -equipment -room
char sex
Returns "male", "female" or "it" depending on the chars sex.
char he
Returns he/she or it depending on sex.
char him
Returns him/her or it depending on sex.
char his
Returns his/hers or its depending on sex.
char beenhere room vnum
Returns true if the character has already been in this room. Can be used for giving first-time information to players about shops, warnings and so on.
char killedmob vnum
Returns true if the character has killed the mob with that vnum
char dex
Returns the current dex of the player.
char str
Returns the current strength of the player.
char int
Returns the current intelligence of the player.
char wis
Returns the current wisdom of the player.
char con
Returns the current constitution of the player.
char timeskilled
Returns the amount of times the player (or mob) is killed.
char wimpy new wimpy
Returns or sets the whimpy value of a player.