LensC Functions
This is the list of functions that you have access to in a lensc
program. When a program needs a constant parameter, the parameters
are explained along with the functions. Constant and functions are
case-sensitive.
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
The following constants can be used anywhere in a program:
The following constants can be used anywhere in a program:
| Type |
Name |
Description |
| char |
NULLCHAR |
A placeholder for a character. |
| obj |
NULLOBJ |
A placeholder for an object. |
| bool |
TRUE |
A true value. |
| bool |
FALSE |
A false value. |
Each function is presented with its header, a brief explaination
of what it does, and any constants that may be used with it.
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function int abs
(int value) |
Returns the absolute value of a given number.
|
| function act
(string string, char ch, obj obj, char ch2, int type) |
Sends an action string out. This string does text replacements on the
following codes:
$n - first character's name
$N - second character's name
$p - object's short description
$e/E - He/She/It - for first or second character
$s/S - His/Her/Its - for first or second character
$m/M - Him/Her/Its - for first or second character
The first character must be valid. The object and second character are not
required to be valid unless a code refers to them. To indicate an unused
character or object, use the NULLOBJ or NULLCHAR constants.
|
The following constants may be used in this program.
- ACT_TO_ALL send text to everyone in the room
- ACT_TO_CHAR send text to the first character only
- ACT_TO_NOTVICT send text to everyone in the room except for the first and second characters.
- ACT_TO_ROOM send text to everyone in the room except the first character.
- ACT_TO_UNSEENNOTVICT send text to everyone in the room who can see the first character, except for the first and second characters.
- ACT_TO_UNSEENROOM send text to everyone in the room who can see the first character except the first character.
- ACT_TO_UNSEENVICT send text to the second character only, if they can see the first character.
- ACT_TO_VICT send text to the second character only.
- ACT_TO_WORLD send text to all connected players.
- ACT_TO_ZONE send text to all connected players in the zone.
|
| function add_cash
(char ch, int silver, int gold, int plat) |
This adds the specified amount of money to the character. The amounts may
be negative, but the character may never have less than zero in any coin
denomination.
|
| function bool affect_add
(char ch, string spellname, int level, int where, int location, int modifier, int bitvector, int duration) |
This attempts to add an affect to a character. The name must be an existing
spell or skillname, although "reserved" will work if it needs to. The level
is the affect level.
WHERE refers to which type of flags are being used, the TO variables.
Location is which stat to modify, one of the APPLY variables.
Modifier is the amount to modify the named stat by, which can be positive
or negative. Flags are the specific flags to set, determined by the WHERE
setting. The available flags follow, and multiple flags of the same type
can be selected using the bitwise OR operator. Duration is how long the
affect will remain with the character. It returns TRUE if successful,
FALSE if not. It can fail if the victim already has the named affect,
or if any of the parameters are invalid.
Flags: These are the assorted flags. They can have bitwise operators
performed against them.
|
The following constants may be used in this program.
- AFF2_ANIMAL_FRIENDSHIP
- AFF2_AURA_MASK
- AFF2_BLACK_ICE
- AFF2_BLINK
- AFF2_BOUND
- AFF2_DEAF
- AFF2_DELUSIONAL
- AFF2_DETECT_DISEASE
- AFF2_DISGUISED
- AFF2_DISPLACED
- AFF2_DISTRACTED
- AFF2_GRAVEBIND
- AFF2_GUARDING
- AFF2_LINGUISTIC
- AFF2_PASS_WATCH
- AFF2_PETRIFIED
- AFF2_PHANTOM
- AFF2_SCRY_SHIELD
- AFF2_SHAPECHANGED
- AFF2_SOOTHED
- AFF2_SPEED
- AFF2_WEBBED
- AFF3_ACID_FISTS
- AFF3_ATTUNED
- AFF3_BAD_LUCK
- AFF3_CLOAK_OF_COVER
- AFF3_CLOAK_OF_FEAR
- AFF3_DETECT_NEUTRAL
- AFF3_DISCOMBOBULATE
- AFF3_FIRE_FISTS
- AFF3_HEROISM
- AFF3_ICE_FISTS
- AFF3_NYIEMAS_MASQUERADE
- AFF3_POISON_FISTS
- AFF3_PROTECT_NEUTRAL
- AFF3_SHOCKING_FISTS
- AFF3_TRUE_FORM
- AFF_BERSERK
- AFF_BLIND
- AFF_BREATHE_WATER
- AFF_CALM
- AFF_CHARM
- AFF_CURSE
- AFF_DARK_VISION
- AFF_DETECT_EVIL
- AFF_DETECT_GOOD
- AFF_DETECT_HIDDEN
- AFF_DETECT_ILLUSION
- AFF_DETECT_INVIS
- AFF_DETECT_MAGIC
- AFF_DETECT_POISON
- AFF_FAERIE_FIRE
- AFF_FLYING
- AFF_HASTE
- AFF_HIDE
- AFF_INFRARED
- AFF_INVISIBLE
- AFF_PASS_DOOR
- AFF_PLAGUE
- AFF_POISON
- AFF_PROTECT_EVIL
- AFF_PROTECT_GOOD
- AFF_REGENERATION
- AFF_SANCTUARY
- AFF_SILENCED
- AFF_SLEEP
- AFF_SLOW
- AFF_SNEAK
- AFF_SWIM
- APPLY_AC Modifier to Armour
- APPLY_CHA Modifier to Charisma
- APPLY_CON Modifier to Constitution
- APPLY_DAMROLL Modifier to Damage
- APPLY_DEX Modifier to Dexterity
- APPLY_HITROLL Modifier to Hit Roll
- APPLY_INT Modifier to Intelligence
- APPLY_NONE Modifier does not apply
- APPLY_SAVES Modifier to Saving Throw
- APPLY_SAVE_MOD Modifier to Opponent's Saving Throw
- APPLY_STR Modifier to Strength
- APPLY_WILLMOD Modifier to Willpower regen
- APPLY_WIS Modifier to Wisdom
- PSI_AIR_SHIELD
- PSI_ANTI_MAGIC
- PSI_BLUR
- PSI_BLUR
- PSI_CONFUSED
- PSI_DANGER_SENSE
- PSI_DREAM
- PSI_GUIDING_FOCUS
- PSI_MIND_OVER_BODY
- PSI_NIGHTMARES
- PSI_PHOTOSYNTHESIS
- PSI_PRECOGNITION
- PSI_PSYCHIC_NETTLES
- PSI_SENSE_ANGER
- PSI_SENSE_LIFE
- PSI_SPATIAL_AWARENESS
- PSI_VIGOUR
- TO_AFFECTS Flags are AFF_
- TO_AFFECTS2 Flags are AFF2_
- TO_AFFECTS3 Flags are AFF3_
- TO_PSI Flags are PSI_
|
| function string affect_get_first
(char ch) |
This returns the name of the first affect on the character.
|
| function string affect_get_next
(char ch, string name) |
This returns the name of the next affect on the character, after the one
named.
|
| function int affect_getval
(char ch, string name, int value) |
This returns information about an affect on a character. If there is no
such affect, the return is 0.
|
The following constants may be used in this program.
- AFF_DURATION Time left, in minutes
- AFF_FLAGS Any flags applied
- AFF_LEVEL Level of affect.
- AFF_LOCATION What gets modified
- AFF_MODIFIER Amount modified by
- AFF_WHERE Where flags are applied to
|
| function bool affect_has
(char ch, string name) |
This returns TRUE if the character has the named affect, or FALSE otherwise.
|
| function bool affect_remove
(char ch, string name) |
This function removes the named affect from a character, returning TRUE if
successful, and FALSE if not. Please use can_remove_affect where appropriate
to determine is this is an affect tthat should be removed.
|
| function int area_getval
(area area, int val) |
This function returns information about an area.
|
The following constants may be used in this program.
- AREA_VAL_AGE Time since last area reset
- AREA_VAL_CONTINENT Continent where this area is located
- AREA_VAL_FLAGS Flags - see ZONE_ flags
- AREA_VAL_KILLS Number of Mobs killed in this area
- AREA_VAL_LEVEL Average Mob level
- AREA_VAL_NPLAYERS Number of players currently in the area
- AREA_VAL_VNUM_BASE Base VNUM for the area
- ZONE_ANTRIPPA
- ZONE_ANY_CONT
- ZONE_BATTLEFIELD
- ZONE_COLD
- ZONE_DENTERRA
- ZONE_DRY
- ZONE_FREEZING
- ZONE_GRIFTMIRE
- ZONE_HIDDEN
- ZONE_HOT
- ZONE_LAWLESS
- ZONE_LENSMOOR
- ZONE_NOQUEST
- ZONE_NO_CONT
- ZONE_NO_GATE
- ZONE_NO_REVENGE
- ZONE_PLAYERHOMES
- ZONE_WARM
- ZONE_WET
|
| function int atoi
(string string) |
Returns the integer that corresponds to a text string. If the string is
not a number, it returns 0.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function special call
(int vnum, int type, special caller, string argument, int ret_type) |
This function executes another lensc program, and waits for that program to
finish executing before continuing.
The caller must match the expected caller type that the called program
expects (char or obj). The argument is the string argument passed to the
second program, and the vnum is the vnum of the program to call.
The called program may specify a value to return to the calling program
with the END keyword. The returned value's type must match the RETURNTYPE
variable.
In the case that the called program fails to specify a return value, or the
called program fails unexepectedly, or that the called program returns a
value of the wrong type, a 0 will be returned, which is treated as an invalid
value for type other than int or bool.
See also: Launch
|
The following constants may be used in this program.
- LENSC_TYPE_BOOL
- LENSC_TYPE_CHAR
- LENSC_TYPE_INT
- LENSC_TYPE_OBJ
- LENSC_TYPE_STRING
|
| function bool can_remove_affect
(string name) |
Returns TRUE or FALSE based on whether the named affect can normally be
dispelled. For mobs that provide named affect removal, this should be used
to ensure that players don't get around internal limits.
|
| function obj ch_first_carrying
(char ch) |
This returns the first object in the list of character's possessions.
No checks are made for whether it is inventory or worn, visible or not.
|
| function char ch_get_mount
(char ch) |
Returns a handle to the character this character is riding. May return
an invalid handle.
|
| function char ch_get_pet
(char ch) |
Returns the pet of the character. Not necessarily a valid char.
|
| function string ch_getextra
(char ch, string keyword) |
This function returns the extra data string associated with the given
keyword. For players, or non-existant keyword matches, it returns an
invalid handle.
|
| function string ch_getstring
(char ch, int string) |
This function is used to retreive a string from a character. The following
constants are used to specify which string is desired:
|
The following constants may be used in this program.
- CHAR_STRING_DEITY The god the character follows name, 'None' or 'Outcast' are possible.
- CHAR_STRING_DESC Character's description
- CHAR_STRING_DISGUISE Character's disguise
- CHAR_STRING_LONG Character's long_desc
- CHAR_STRING_NAME Character's name/keywords
- CHAR_STRING_RACE The race the character is.
- CHAR_STRING_SHORT Character's short_desc
- CHAR_STRING_SPEC A PC's specialization, or an NPC's spec_fun
|
| function int ch_getval
(char ch, int val) |
This function is used to retreive a value from a character. The following
constants are used to specify which value is desired:
|
The following constants may be used in this program.
- CHAR_VAL_AFF The characters AFF flag. SEe AFF values under AFFECT_ADD
- CHAR_VAL_AFF2 Like CHAR_VAL_AFF
- CHAR_VAL_AFF3 Like CHAR_VAL_AFF
- CHAR_VAL_AFK is the player AFK (TRUE/FALSE)
- CHAR_VAL_AGE Character's age
- CHAR_VAL_ALIGN Character's alignment (-1000 to 1000)
- CHAR_VAL_BANK Bank account, in gold. Mobs have 0 in the bank
- CHAR_VAL_BUSY is the player busy (TRUE/FALSE)
- CHAR_VAL_CASH Total carried word, in silver
- CHAR_VAL_CHA Current Charisma
- CHAR_VAL_CON Current Constitution
- CHAR_VAL_CONTINENT Player's home continent - See CONT_ values
- CHAR_VAL_COUNT Number of this mob vnum in the game. Always 1 for players.
- CHAR_VAL_DAMROLL Character's Damroll modifier
- CHAR_VAL_DEX Current Dexterity
- CHAR_VAL_FOLLOW Character's religion alignment
- CHAR_VAL_GOLD Gold carried
- CHAR_VAL_HITROLL Character's Hitroll modifier
- CHAR_VAL_HP Current Hit Points
- CHAR_VAL_ID the player's validation ID
- CHAR_VAL_INCOG Character's Incog level
- CHAR_VAL_INT Current Intelligence
- CHAR_VAL_LEVEL Player's level
- CHAR_VAL_LINKDEAD is the player linkdead (TRUE/FALSE)
- CHAR_VAL_MANA Current Mana
- CHAR_VAL_MAX_HP Maximum Hit Points
- CHAR_VAL_MAX_MANA Maximum Mana
- CHAR_VAL_NOGAMES is the player opting out of games (TRUE/FALSE)
- CHAR_VAL_OOC is the player OOC (TRUE/FALSE)
- CHAR_VAL_PLAT Platinum carried
- CHAR_VAL_POSITION Character's current position - See POS_ values
- CHAR_VAL_QUEST Character's Quest Type
- CHAR_VAL_SAVES Character's Saving Throw Modifier
- CHAR_VAL_SAVE_MOD Character's target's Saving Throw Modifier
- CHAR_VAL_SEX Player's sex (0 - 2)
- CHAR_VAL_SILVER Silver carried
- CHAR_VAL_SIZE Player's size (0 - 5)
- CHAR_VAL_STR Current Strength
- CHAR_VAL_TIRED Current Tired (0-100)
- CHAR_VAL_VNUM Mob's VNUM, 0 for players
- CHAR_VAL_WILLPOWER Current Willpower (0-100)
- CHAR_VAL_WIS Current Wisdom
- CHAR_VAL_WIZI Character's Wizi level
- CHAR_VAL_WRITING is the player writing (TRUE/FALSE)
- CONT_ANTRIPPA
- CONT_DENTERRA
- CONT_GRIFTMIRE
- CONT_LENSMOOR
- CONT_NONE
- GROUP_QUEST_BOSS
- GROUP_QUEST_HORDE
- POS_DEAD
- POS_FIGHTING
- POS_LAYING
- POS_SITTING
- POS_SLEEPING
- POS_STANDING
- QUEST_CAPTURE
- QUEST_DELIVER
- QUEST_FIND
- QUEST_IMM_COLLECT
- QUEST_IMM_KILL
- QUEST_INFO
- QUEST_KILL
- QUEST_NONE
- QUEST_WAIT
- QUEST_WILDERNESS
|
| function int ch_getzonequest
(char ch, room room) |
This function returns the character's zonequest state for the given room.
Mob's and invalid rooms return -1.
|
| function room ch_in_room
(char ch) |
This function returns the room that the character is in.
|
| function char ch_is_fighting
(char ch) |
Returns a handle to whoever this character is fighting. The handle is
invalid if the character is not fighting.
|
| function char ch_is_following
(char ch) |
Returns a handle to whoever this character is following. The handle is
invalid if the character is not following anyone.
|
| function bool ch_is_mob
(char ch) |
Returns TRUE if the character is a mob, FALSE if the character is a player.
|
| function bool ch_is_pk
(char ch) |
Returns TRUE if the player is PK. FALSE otherwise.
|
| function bool ch_is_remort
(char ch) |
Returns TRUE if the player is a remort. FALSE otherwise.
|
| function obj ch_on_obj
(char ch) |
This returns the handle to the object the character is currently on
(furniture), or an invalid handle if not on anything.
|
| function bool ch_setstring
(char ch, int string, string text) |
This function is used to set a string on a mob. The following constants are
used to specify which string is set:
This returns TRUE if the string was successfully set, and FALSE if it was
not (including if the character was a player).
|
The following constants may be used in this program.
- CHAR_STRING_DESC Character's description
- CHAR_STRING_LONG Character's long_desc
- CHAR_STRING_NAME Character's name/keywords
- CHAR_STRING_SHORT Character's short_desc
|
| function bool ch_to_obj
(char ch, obj obj, int pos) |
This function is used to place characters on furniture, or in specific
positions. The item, which may be NULLOBJ, must be either furniture or
furncont if provided. Positions possible are:
This returns TRUE if the position was set, and FALSE if it was not (for any
reason).
|
The following constants may be used in this program.
- POS_LAYING
- POS_RESTING
- POS_SITTING
- POS_SLEEPING
- POS_STANDING
|
| function change_align
(char ch, int change) |
Alters the character's alignment by the specified amount. This amount
should be absolute - as internal code handles adjusting it for the
character's current alignment. Internal code will also force any results
of an alignment change to occur.
|
| function char create_mob
(int vnum, room room) |
This creates a new mob with the given vnum, in the specified room. The mob
runs its INIT action, if any. No message is generated by this function.
|
| function obj create_obj
(int vnum, room room) |
This creates the object with the given vnum in the room specified. No
messages are presented, so the object can be moved to a character or
container after creation. The function returns a handle to the new object.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool dam_mana
(char ch, int dam) |
Subtracts amount from player's mana. Will not go below zero mana, and
cannot use negative amounts. Returns TRUE if successful, FALSE otherwise.
|
| function bool dam_will
(char ch, int dam) |
This function lowers the character's willpower by the amount specified.
|
| function bool deduct_money
(char ch, int cost) |
This function removes the amount of money, specified in silver, from
the character. It returns TRUE if successful. If it returns FALSE, the
character did not have enough. Before using this function, you should
make sure the character has enough cash on them with the ch_get_value
(CHAR_VALUE_CASH) function.
|
| function disturb
(char ch) |
This disturbs the character, interrupting any continued actions they
may be working on.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool equip_char
(char ch, obj obj, int wear_loc) |
This takes an item in a character's inventory and equips it to a wear
location. The item must be in the character's inventory, and they may
not have anything else equipped to that location, or this function will
fail. Try checking get_obj_worn to ensure that the wear location is available
prior to calling this function. Wear locations are:
Returns TRUE if successful, FALSE otherwise.
|
The following constants may be used in this program.
- WEAR_ABOUT
- WEAR_ARMS
- WEAR_BODY
- WEAR_EARS
- WEAR_EYES
- WEAR_FEET
- WEAR_FINGER_L
- WEAR_FINGER_R
- WEAR_FLOAT
- WEAR_HANDS
- WEAR_HEAD
- WEAR_HOLD
- WEAR_LEGS
- WEAR_MEDAL
- WEAR_NECK_1
- WEAR_NECK_2
- WEAR_SECONDARY
- WEAR_SHIELD
- WEAR_WAIST
- WEAR_WIELD
- WEAR_WRIST_L
- WEAR_WRIST_R
|
| function bool exit_closed
(exit ext) |
Returns TRUE if the exit is closed, FALSE otherwise.
|
| function exit exit_exist
(room pRoom, int dir) |
This function returns the exit in the specified direction in the given room.
The return is invalid if no exit is available in that direction.
Exit directions are:
DIR_N - north
DIR_E - east
DIR_S - south
DIR_W - west
DIR_U - up
DIR_D - down
|
| function bool exit_locked
(exit ext) |
Returns TRUE if the exit is locked, FALSE otherwise.
|
| function room exit_to
(exit ext) |
This function returns the room where the exit leads to. Any valid exit
is defined to have a valid room associated with it, however, exits to
the wilderness should be used as soon as found, as wilderness rooms can
shift.
|
| function obj extract_object
(obj obj) |
This function removes an object from the game. It returns the handle to the
removed object so that it can be invalidated. If it is not invalidated, the
program will terminate abnormally as there is a broken handle.
invalidate extract_object(object);
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool fatigue
(char ch, int dam) |
This function lowers the character's tired by the amount specified.
|
| function string first_word
(string p, int first) |
This function takes a string and removes the first word (space or quote
separated). The constant determies what is returned:
|
The following constants may be used in this program.
- WORD_FIRST return the first word / quote block
- WORD_REST return everything after the first word
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function area get_area_by_vnum
(int vnum) |
This returns a handle to an area based on a vnum.
|
| function char get_char_in_room
(room room, string string) |
This function looks for a character in the specified room, which has
keywords matching name. This function can return an invalid character,
if none are found, so your program should check for that before using
that value.
|
| function char get_char_room
(char ch, string arg) |
This function looks for a character in the same room as ch, which has
keywords matching name. This function can return an invalid character,
if none are found, so your program should check for that before using
that value. It does not find characters that ch cannot see.
|
| function char get_char_world
(char ch, string arg) |
This function looks for a character anywhere in the world, which has
keywords matching name. This function can return an invalid character,
if none are found, so your program should check for that before using
that value. It does not find characters that ch cannot see.
|
| function string get_line
(char ch, string prompt) |
This puts the character in the editor and prompts them to enter a line
of text. The program suspends while waiting for input. If used on a mob,
or in the debugger, a substitute result string is used, as the editor is
unusable. There is a 2 minute timeout on responses allowed.
|
| function string get_line_timeout
(char ch, string prompt, int timeout) |
This puts the character in the editor and prompts them to enter a line
of text. The program suspends while waiting for input. If used on a mob,
or in the debugger, a substitute result string is used, as the editor is
unusable. You can specify, in seconds, how long before the input times out.
|
| function obj get_obj_carry
(char ch, string str) |
This functions finds an item in a character's inventory that matches the
name provided. It will not find items the character cannot see.
|
| function obj get_obj_in_obj
(char ch, string str, obj cont) |
This functions finds an item in a container that matches the name provided.
It will not find items the character cannot see.
|
| function obj get_obj_room
(char ch, string str) |
This function returns the item in the room that the character is in, that
the character can see, and that matches the given keyword(s). The returned
object may be invalid, indicating nothing was found.
|
| function obj get_obj_world
(char ch, string argument) |
This returns a handle to an area based on a vnum.
|
| function obj get_obj_worn
(char ch, int wear_loc) |
This functions finds an item worn in the specified position.
|
The following constants may be used in this program.
- WEAR_ABOUT
- WEAR_ARMS
- WEAR_BODY
- WEAR_EARS
- WEAR_EYES
- WEAR_FEET
- WEAR_FINGER_L
- WEAR_FINGER_R
- WEAR_FLOAT
- WEAR_HANDS
- WEAR_HEAD
- WEAR_HOLD
- WEAR_LEGS
- WEAR_MEDAL
- WEAR_NECK_1
- WEAR_NECK_2
- WEAR_SECONDARY
- WEAR_SHIELD
- WEAR_WAIST
- WEAR_WIELD
- WEAR_WRIST_L
- WEAR_WRIST_R
|
| function int get_reaction
(char ch, char victim) |
This function will return the numerical reaction (-100 to 100, where
-100 is want to kill, and 100 is love) that the ch has towards the victim.
|
| function room get_room_by_vnum
(int vnum) |
This returns the room refered to by the given vnum. It can return an
invalid room, so this must be checked.
|
| function int get_skill
(char ch, string skillname) |
This returns the character's current skill (0 to 100) rating in the
named skill.
|
| function int get_systime
() |
Returns current system timestamp.
|
| function string get_text
(char ch) |
This puts the character in the editor, and returns the edited text block.
As with get_line, this doesn't work for mobs, or for the debugger.
|
| function room get_wilderness_room
(int x, int y, int z) |
Returns the wilderness room at the specified coordinates. Use this fairly
quickly, as the Wilderness shifts based on usage, and if you get a room,
and don't use it, the room won't be invalid, but it won't be where you
expect it to be. This can return an invalid room handle if the coordinates
supplied are invalid.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function char hurt
(char ch, int dam, int dt, bool safe) |
This function deals dam hitpoints of damage to ch, of a specified type of
damage. It returns the character, so that they can be invalidated. If they're
not invalidated, and this function kills them, the program execution will
stop. The safe parameter will ensure that they are not killed.
Example: invalidate hurt(ch,50,DAM_FIRE,FALSE);
|
The following constants may be used in this program.
- DAM_ACID
- DAM_BASH
- DAM_BLIND
- DAM_CHARM
- DAM_COLD
- DAM_DISEASE
- DAM_DROWNING
- DAM_ENERGY
- DAM_FIRE
- DAM_HOLY
- DAM_LIGHT
- DAM_LIGHTNING
- DAM_MAGIC
- DAM_MENTAL
- DAM_NEGATIVE
- DAM_PIERCE
- DAM_POISON
- DAM_SLASH
- DAM_SOUND
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool interpret
(char ch, string text) |
This function makes a character perform the command listed as if they had
typed it. It returns TRUE if the action was successful, and FALSE if not.
This function always results in the lensc program suspending until the next
pulse in case a character died as a result of the action.
|
| function char is_bound
(char ch) |
Returns the handle to the character this character is bound to, or an
invalid handle if not bound.
|
| function bool is_disabled
(char ch1, char ch2) |
Checks to see if ch1 is disabled by ch2. Returns TRUE if disabled, FALSE
if not. Mob's are never disabled, and never disable anyone.
|
| function bool is_enabled
(char ch1, char ch2) |
Checks to see if ch1 is enabled by ch2. Returns TRUE if enabled, FALSE
if not. Mob's are never enabled, and never enable anyone.
|
| function int is_immune
(char ch, int dam_type, obj weapon, bool spell) |
This function tests whether a character is immune, resistant, or vulnerable
to a certain damage type. If an object is specified, immunity to weapons,
and the object's material will be checked. If spell is TRUE, immunity to
magic will also be checked.
|
The following constants may be used in this program.
- DAM_ACID
- DAM_BASH
- DAM_BLIND
- DAM_CHARM
- DAM_COLD
- DAM_DISEASE
- DAM_DROWNING
- DAM_ENERGY
- DAM_FIRE
- DAM_HOLY
- DAM_LIGHT
- DAM_LIGHTNING
- DAM_MENTAL
- DAM_NEGATIVE
- DAM_PIERCE
- DAM_POISON
- DAM_SLASH
- DAM_SOUND
|
| function bool is_name
(string str, string namelist) |
This returns TRUE if name is found in the keyword list. This is standard
keyword matching as used by the rest of the mud.
|
| function bool is_safe
(char ch, char victim, int flags) |
Checks to see if victim is safe from ch. TRUE means that ch is not allowed
to attack victim for some reason. The flags can be OR'ed together if needed,
or left 0 if none are required.
|
The following constants may be used in this program.
- SAFE_AREA Safe for area spells
- SAFE_CAN_FIGHT Safe for initial combat attack
- SAFE_SHOW Show a message why the attack is disallowed to the attacker
|
| function bool is_valid_char
(char p) |
Checks validity of a char. Returns TRUE is valid, FALSE otherwise.
|
| function bool is_valid_exit
(exit p) |
Checks validity of an exit. Returns TRUE is valid, FALSE otherwise.
|
| function bool is_valid_obj
(obj p) |
Checks validity of an obj variable. Returns TRUE is valid, FALSE otherwise.
|
| function bool is_valid_room
(room p) |
Checks validity of a room. Returns TRUE is valid, FALSE otherwise.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool launch
(int vnum, int type, special caller, string argument) |
This function executes another lensc program, and then continues execution
of the current program immediately. The caller must match the expected
caller type that the called program expects (char or obj). The argument
is the string argument passed to the second program, and the vnum is the
vnum of the program to launch.
|
The following constants may be used in this program.
- LENSC_TYPE_CHAR Char
- LENSC_TYPE_OBJ Object
|
| function int lensc_is_ch_run
(char target, int vnum) |
This function returns a count of how many times this character is running a
program with the specified vnum. This can be useful in restricting the number
of simultaneous runnings of the same program.
|
| function int lensc_is_obj_run
(obj target, int vnum) |
This function returns a count of how many times this object is running a
program with the specified vnum. This can be useful in restricting the number
of simultaneous runnings of the same program.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function string map_at
(int x, int y, int z) |
Returns a string that holds the map at the requested coordinates in the
wilderness.
|
| function int max
(int n1, int n2) |
This function returns the larger of two numbers.
|
| function int min
(int n1, int n2) |
This function returns the smaller of two numbers.
|
| function string mobchat
(char ch, char victim, string phrase) |
This returns what a mob would say to the person they are speaking to,
given a specific input.
|
| function int modify_reaction
(char ch, char victim, int amount) |
This function will modify the numerical reaction (-100 to 100) that the
ch has towards the target. It will return the resulting reaction.
|
| function bool move_char
(char ch, int dir) |
This uses the mud's internal character movement code to move a character in
a direction. It returns TRUE if succesful (the char moved) and FALSE
otherwise. All move costs, movement verbs and messages, and validity-of-move
are handled. Exit directions are:
|
The following constants may be used in this program.
- DIR_DOWN down
- DIR_EAST east
- DIR_NORTH north
- DIR_SOUTH south
- DIR_UP up
- DIR_WEST west
|
| function move_char_to_room
(char ch, room room) |
This function moves the specified character to the specified room. No
messages are created for those in the room newly entered, or left. The
character does not auto-look either, if you want them to see the new room,
you need to do an interpret(ch,"look auto"). Used on a mounted character,
this moves the mount too.
|
| function move_obj_to_char
(obj obj, char ch) |
This function moves the specified item to the specified character's inventory.
|
| function move_obj_to_obj
(obj obj, obj cont) |
This function moves the specified item to the specified container.
|
| function move_obj_to_room
(obj obj, room room) |
This function moves the specified item to the specified room.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function char obj_carried_by
(obj obj) |
Returns the character carrying the item. If the item is not in an inventory,
the returned value is invalid. Does not check nested contents of containers.
|
| function obj obj_first_content
(obj obj) |
This returns the first object located inside the calling object.
If the calling object contains nothing, it is an invalid object.
|
| function string obj_getextra
(obj obj, string keyword) |
This function returns the extra description string associated with the
given keyword. For non-existant keyword matches, it returns an invalid
handle.
|
| function string obj_getstring
(obj obj, int val) |
A function to return a string from an
item. The string returned is based on the constant input value:
|
The following constants may be used in this program.
- OBJ_STRING_LONG_DESCR The item's room description
- OBJ_STRING_NAME The item's keyword list
- OBJ_STRING_SHORT_DESCR The item's short description
- OBJ_STRING_SPEC The items's spec_proc
|
| function int obj_getval
(obj obj, int val) |
A function to return a value from an item. The value is specified by the
constant input:
|
The following constants may be used in this program.
- ITEM_ANTI_EVIL
- ITEM_ANTI_GOOD
- ITEM_ANTI_NEUTRAL
- ITEM_BLESS
- ITEM_BURN_PROOF
- ITEM_DARK
- ITEM_EVIL
- ITEM_GLOW
- ITEM_HIDDEN
- ITEM_HUM
- ITEM_IMM_TOKEN
- ITEM_INVIS
- ITEM_MAGIC
- ITEM_MELT_DROP
- ITEM_NOAUCTION
- ITEM_NOBREAK
- ITEM_NODROP
- ITEM_NOLOCATE
- ITEM_NOPURGE
- ITEM_NOREMOVE
- ITEM_NORESTRING
- ITEM_NOSAC
- ITEM_NOUNCURSE
- ITEM_NO_IDENT
- ITEM_NO_SAVE
- ITEM_ROOM_LIGHT
- ITEM_ROT_DEATH
- ITEM_ROT_USE
- ITEM_SELL_EXTRACT
- ITEM_SHINY
- ITEM_UNSEEN
- ITEM_VIS_DEATH
- ITEM_WEAR_ABOUT
- ITEM_WEAR_ARMS
- ITEM_WEAR_BODY
- ITEM_WEAR_EAR
- ITEM_WEAR_EYES
- ITEM_WEAR_FEET
- ITEM_WEAR_FEMALE
- ITEM_WEAR_FINGER
- ITEM_WEAR_FLOAT
- ITEM_WEAR_HANDS
- ITEM_WEAR_HEAD
- ITEM_WEAR_HERO_ONLY
- ITEM_WEAR_HOLD
- ITEM_WEAR_LEGS
- ITEM_WEAR_MALE
- ITEM_WEAR_MEDAL
- ITEM_WEAR_NECK
- ITEM_WEAR_SHIELD
- ITEM_WEAR_TAKE
- ITEM_WEAR_WAIST
- ITEM_WEAR_WIELD
- ITEM_WEAR_WRIST
- OBJ_VAL_CONDITION The item's current condition
- OBJ_VAL_COST The object's 'cost' field
- OBJ_VAL_COUNT The number of this item currently in game.
- OBJ_VAL_FLAGS The item's Extra flags - See ITEM_ flags
- OBJ_VAL_FULL_WEIGHT The object weight, including contents
- OBJ_VAL_KEPT Is the item kept.
- OBJ_VAL_LEVEL The item's level
- OBJ_VAL_LOWNER The ID of the player to last own this item.
- OBJ_VAL_MATERIAL The item's material
- OBJ_VAL_SIZE The object size. 0 is Tiny, 2 is Medium, 5 is Max (Giant)
- OBJ_VAL_TYPE The item type. Refer to OLC for values
- OBJ_VAL_V0 The object's 0 Value
- OBJ_VAL_V1 The object's 1 Value
- OBJ_VAL_V2 The object's 2 Value
- OBJ_VAL_V3 The object's 3 Value
- OBJ_VAL_V4 The object's 4 Value
- OBJ_VAL_VNUM The vnum of the item
- OBJ_VAL_WEAR The items Wear locations - See ITEM_WEAR flags.
- OBJ_VAL_WEIGHT The object weight, when empty
|
| function obj obj_in_obj
(obj obj) |
This returns the object that contains the calling object. If the object
is not in a container, the return value is invalid.
|
| function room obj_in_room
(obj obj) |
This returns the room that the object is in. If the object isn't in a room
(in inventory or a container) it is an invalid room.
|
| function bool obj_interpret
(obj obj, string argument, char ch) |
This forces the object to interpret the string as if in an obj action.
Returns TRUE if successful, FALSE otherwise.
The ch parameter is optional, but required by some interpreted object
commands. Supply an invalid character if not using.
|
| function obj obj_next_content
(obj obj) |
This returns the next object in whichever list the calling object is in.
For instance, if the object is in a room, this function will return the
next thing in the room. If the object is in a container, it will return
the next item in the container. This will return an invalid value if there
is nothing else in the list.
|
| function bool obj_setextra
(obj obj, string keyword, string desc, bool replace) |
This sets a descriptive keyword on an item. If replace is TRUE, it will
overwrite any current description using that keyword. If replace is FALSE,
it will not set the new data. The function returns TRUE if the extra
description is set, and FALSE if it is not.
|
| function bool obj_setstring
(obj obj, int val, string text) |
A function to set a string for an item. The string set is based on the
constant input value:
The function returns TRUE if the string is set successfully, FALSE otherwise.
|
The following constants may be used in this program.
- OBJ_STRING_LONG_DESCR The item's room description
- OBJ_STRING_NAME The item's keyword list
- OBJ_STRING_SHORT_DESCR The item's short description
|
| function bool obj_setval
(obj obj, int val, int nv) |
A function to set a value for an item. The value to set is specified by
the constant input. The new Value to set is specified as NewValue. Possible
values to set are:
|
The following constants may be used in this program.
- OBJ_VAL_CONDITION The item's current condition
- OBJ_VAL_V0 The object's 0 Value - Treasure and Trash items only
- OBJ_VAL_V1 The object's 1 Value - Treasure and Trash items only
- OBJ_VAL_V2 The object's 2 Value - Treasure and Trash items only
- OBJ_VAL_V3 The object's 3 Value - Treasure and Trash items only
- OBJ_VAL_V4 The object's 4 Value - Treasure and Trash items only
|
| function string ocean_name
(int x, int y) |
Returns the name for the body of water at the coordinate specified.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function pause
(int delay) |
This function pauses execution for the specified amount of seconds,
before executing the next command.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool quest_award
(char ch, int amount) |
This gives the player some quest points. Any award over 10 points will be
trigger a BUG message - be reasonable. It returns FALSE if it fails for
some reason, TRUE normally.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function int random
(int from, int to) |
This function returns an integer value between low and high inclusive.
|
| function int range
(int min, int num, int max) |
Returns a number in the range from low to high. If value falls between
low and high, value is returned, otherwise the upper or lower limit
specified is returned.
|
| function restore_char
(char ch) |
Performs a restore on the character.
|
| function int rev_dir
(int dir) |
This function returns the opposite direction from the input. Opposites are:
North/South East/West Up/Down
|
The following constants may be used in this program.
- DIR_DOWN
- DIR_EAST
- DIR_NORTH
- DIR_SOUTH
- DIR_UP
- DIR_WEST
|
| function char room_first_char
(room room) |
This returns the first character in the room. It is not required to be a
valid character.
|
| function obj room_first_content
(room room) |
This returns the first object in the list of objects in the room. It is
not required to be a valid object.
|
| function area room_getarea
(room room) |
This returns the area that the room is located in.
|
| function int room_getval
(room room, int val) |
This returns a value about the room. Room values accessible are:
|
The following constants may be used in this program.
- CONT_ANTRIPPA
- CONT_DENTERRA
- CONT_LENSMOOR
- CONT_NONE
- PHASE_FULL
- PHASE_NEW
- PHASE_WANING
- PHASE_WAXING
- ROOM_VAL_CONTINENT The continent where this room is, see CONT_ values
- ROOM_VAL_DAY The day of the week, from 0 to 34
- ROOM_VAL_HEAL The heal rate in the room
- ROOM_VAL_MANA The mana rate in the room
- ROOM_VAL_MONTH The month from 0 to 16
- ROOM_VAL_MOON The phase of the moon, see PHASE_ values
- ROOM_VAL_SEASON The current season, see SEASON_ values
- ROOM_VAL_SECTOR The sector type of the room
- ROOM_VAL_SUN The position of the sun. See SUN_ values. Note, the sun position changes with seasons, so there are more daylight hours during the summer.
- ROOM_VAL_TIME The time of day, from 0 to 23
- ROOM_VAL_VNUM The vnum of the room
- ROOM_VAL_WEATHER The current weather, see SKY_ values
- ROOM_VAL_X X coordinate, -1 if not a wilderness room.
- ROOM_VAL_Y Y coordinate, -1 if not a wilderness room.
- ROOM_VAL_Z Z coordinate, -1 if not a wilderness room.
- SEASON_AUTUMN
- SEASON_SPRING
- SEASON_SUMMER
- SEASON_WINTER
- SKY_CLOUDLESS
- SKY_CLOUDY
- SKY_LIGHTNING
- SKY_RAINING
- SKY_SNOW
- SUN_DARK
- SUN_LIGHT
- SUN_RISE
- SUN_SET
|
| function char room_next_char
(char ch) |
This returns the next char in the room. This is not required to be a valid
character. The current character being evaluated must be passed to this
function.
|
| function room_sendtext
(room room, string text) |
This sends the specified string to all characters in the room.
|
| function int round
(int numerator, int denomenator) |
This function divides the numerator by the denomenator, rounding fractions
1/2 or greater up.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool saving_throw
(int level, char caster, char victim, int dam_type) |
This gives a character a saving throw, returning TRUE if they successfully
save, and FALSE if they do not. The CASTER can be invalid in cases where no
one is creating the attack. LEVEL is the level of the attack. DAM_TYPE can
be one of:
DAM_BASH
DAM_PIERCE
DAM_SLASH
DAM_FIRE
DAM_COLD
DAM_LIGHTNING
DAM_ACID
DAM_POISON
DAM_NEGATIVE
DAM_HOLY
DAM_ENERGY
DAM_MENTAL
DAM_DISEASE
DAM_DROWNING
DAM_LIGHT
DAM_CHARM
DAM_SOUND
DAM_BLIND
DAM_MAGIC
DAM_SUMMON
|
| function send_channel
(string text, int chan) |
Sends the string to one of the game's automated channels:
|
The following constants may be used in this program.
- CHANNEL_GAMES
- CHANNEL_QUEST
- CHANNEL_WIZNET
|
| function send_note
(string to, string from, string subject, string text, int type) |
Posts a note to the specified board.
|
The following constants may be used in this program.
- NOTE_CHATTER Chatter Board
- NOTE_NOTE Note Board
- NOTE_WORLD World Board
|
| function sendt
(char ch, string txt) |
This sends the string of text to the character.
|
| function bool set_busy
(char ch, int delay) |
Sets a character as busy for the specified amount of time (seconds).
The function returns TRUE if the full time was spent busy, or FALSE
if the character is disturbed.
|
| function bool skill_check
(char ch, string skillname) |
This checks a character's skill, returning TRUE on successful skill use,
and FALSE otherwise. Unknown skills return FALSE always.
|
| function bool stat_check
(char ch, int st) |
This checks a character's stat, returning TRUE if it passes the check,
and FALSE otherwise.
|
The following constants may be used in this program.
- CHAR_VAL_CHA Current Charisma
- CHAR_VAL_CON Current Constitution
- CHAR_VAL_DEX Current Dexterity
- CHAR_VAL_INT Current Intelligence
- CHAR_VAL_STR Current Strnegth
- CHAR_VAL_WIS Current Wisdom
|
| function bool string_is_empty
(string p) |
Checks to see if there are any characters in a string variable. Returns TRUE
if there are not, FALSE otherwise;
|
| function int string_length
(string string) |
Returns the number of characters in a string.
|
| function string string_prefix
(string string, int count) |
Returns the string composing the first count characters in the input string.
|
| function string string_suffix
(string string, int count) |
Returns the string composing the last count characters in the input string.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool unequip_char
(char ch, obj obj) |
"This function takes an item that a character is currently wearing and
returns it to their inventory. Try checking get_obj_worn to get the object
handle for the object at the required location. Returns TRUE if successful,
FALSE otherwise."
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function wait
() |
This function suspends program execution until the next pulse.
|
| function string wordwrap
(string text, int mode) |
This function wraps a block of text, according to the wrap mode selected.
The wrapped text is returned as a new string. Wrap modes are:
|
The following constants may be used in this program.
- WRAP_CENTER
- WRAP_FULL
- WRAP_LEFT
- WRAP_RIGHT
|
| function char world_first_char
(bool pc) |
This function returns the first character in the world. If pc is TRUE,
it returns the first player, otherwise, mobs are included in the list.
This function can - but it is very unlikely - return an invalid handle.
|
| function char world_next_char
(char ch, bool pc) |
This function returns the next character in the world, based on the
character passed to this function. If pc is TRUE, it returns only PC's,
otherwise, mobs are included in the list. This function can return an
invalid handle.
|
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Top Constants Lensc
| function bool zonequest
(char ch, room room, int cstate, int nstate) |
This function sets a character's zonequest state. The zone is the zone that
the room is part of. The current state must be equal to the character's
progress on this quest, or the function returns FALSE. If successful, it
returns TRUE and sets the character's quest state to the newstate value.
If the newstate is -1, the function rewards the character for completing
the quest.
|
|