Help

JS-CHAR

For immortals Also: JAVASCRIPT-CHAR

The Char object represents mobiles and player characters.

Class Methods:

count()           Counts mobiles.  See JS-ELEMENT-COUNT.
invoke()          This method is used to invoke new mobiles.
                  See JS-CHAR-INVOKE for more information.

Properties:

fighting          Who this char is fighting, or null.
numAttackers      The number of characters attacking this character.
following         Who this char is following or null if not following.
master            Who this char is controlled by or null if not
                  currently being controlled.
controller        Who is this char's controller? (see JS-CONTROLLER)
mount             This character's mount, or null if not mounted.
inRoom            Room object that this character is in (see JS-ROOM).
inRoomNumber      The room number that this character is in.
inZone            Zone object that this character is in (see JS-ZONE).
inWorld           World object that this character is in (see JS-WORLD).
vnum              The virtual number of this char (returns -1 for players).
db                The database object for this char (see JS-DB)
homeNumber        The room number of this character's home.
lag               The wait in pulses for the current char.  (For example,
                  after landing a stun your wait is increased.)
idle              How many mud hours this character has been idle.
keyName           The key name of this character.
name              The key name and nicknames of this character.
shortDesc         The short description of this character.
mediumDesc        The medium description of this character.
longDesc          The long description of this character.
title             The title of this character (PCs only).
age               Returns the age in years of the player.
race              Race object for the race of this character (see JS-RACE).
drunk             The character's drunk condition.
hunger            The character's hunger condition.
thirst            The character's thirst condition.
sanity            The character's sanity condition.
attackType        The attack type of this mobile (see ATTACKTYPES).
speak             The language this char is speaking (see POSITION-TYPES).
position          The position of this char (see POSITION-TYPES).
posture           The posture of this char (see POSTURE).
placement         The placement of this char (see PLACEMENT).
gold              The amount of gold this character has on-hand.
bankGold          The amount of gold in this character's bank account.
exp               The amount of experience this character has total.
pool              The amount of experience in this character's pool.
worthExp          The amount of experience this mobile is worth according to
                  the experience point formula.  The difficulty multiplier
                  has not been applied.
worthGold         The amount of gold this mobile is worth according to the
                  gold formula.  Difficulty and gold multipliers have not been
                  applied.
numAttacks        The number of attacks an NPC has.
bareNumDie        The number of barehand attack die for NPC barehand damage.
bareSizeDie       The size of the barehand attack die for NPC barehand damage.
alignment         The alignment of this char as a number (-1000 to 1000)
sex               Can be 'male', 'female', or 'neuter'.
inGroup           Returns the group object for the group this character is in
                  or null if the character is groupless (see JS-GROUP).
clan              Returns the name of the clan this character is a member of.
inClan            Returns the clan object for the clan this character is a
                  member of or null if this character isn't in a clan
                  (see JS-CLAN).
maxLevel          Returns the maximum level of this character.
maxPowerLevel     Returns the maximum power level of this character.
hit               The current hit points of this character.
maxHit            The maximum hit points of this character.
wimpHit           The wimp hit points of this character.
mana              The current mana points of this character.
maxMana           The maximum mana points of this character.
vitality          The current vitality points of this character.
maxVitality       The maximum vitality points of this character.
hitroll           The character's hitroll.
damroll           The character's damroll.
dualHitroll       The character's dual-wielding hitroll.
dualDamroll       The character's dual-wielding damroll.
bowHitroll        The character's hitroll with bows.
bowDamroll        The character's damroll with bows.
str               The strength of this character.
dex               The dexterity of this character.
iq                The intelligence of this character.
wis               The wisdom of this character.
con               The constitution of this character.
cha               The charisma of this character.
height            The height of this character.
weight            The weight of this character.
killPoints        The total kill points for this character.  Addings points
                  to this will automatically update the clan associated with
                  this character.
killPool          The total kill pool for this character.
tournamentPoints  The total tournament points for this character.  Adding points
                  to this will automatically update the clan associated with
                  this character.
tournamentPool    The total tournament pool for this character.
questPoints       The total quest points for this character.
questPool         The total quest pool for this character.
buildPoints       The total build points for this character.

Methods:

cast()              Casts a spell.  See JS-ELEMENT-CAST.
damage()            Does damage.  See JS-ELEMENT-DAMAGE.
go( d )             Teleports the character to the specified destination which can be
                    either a room, object, or mobile or a room number.  Pass
                    in the string 'fadeout' if you would like fadeout messages to
                    be displayed and 'nolook' if you do not want the character to
                    automatically enter a look command upon entering the room.
                    Example:  "actor.go( 1002, 'fadeout', 'nolook' )"
attack( t )         Causes this character to enage the other character in combat.
                    (This method uses initcombat, so special skills like backstab
                    and so on will be utilized by mobiles if they have it.)
rescue()            Rescues target from attackers.  See JS-CHAR-RESCUE.
mirror( t )         Become a mirror image of t.  See JS-CHAR-MIRROR.
purge()             Purges this character without printing any messages or
                    dropping any corpses.
slay()              Kills this character and displays a death cry.  If the
                    character is a player, no experience is lost.  By default
                    no corpse is dropped.  You can cause a corpse to be dropped
                    by passing in the optional "corpse" option.  For example:
                    actor.slay( 'corpse' )
restore()           Restores this character as if by the immortal restore command.
editor()            Invokes the editor on a property.
                    See JS-CHAR-EDITOR.
canSee( t )         Returns true if this character can see the target character
                    or object.
canTeleport( t )    Returns true if this character can teleport/travel/etc. from
                    where they currently are.  If the optional destination is
                    supplied then method will also verify that they the target
                    room can be teleported to.  The character will get a
                    message explaining why they cannot teleport.
isControlledByPC()  Returns true if this mobile is either a PC or controlled
                    directly or indirectly by one (i.e. charm, and so on)
isPetOf( c )        Returns true if this character is a pet of character c.
namePet( p, n )     Names the given pet p with the name n.
curPetLevels()      Returns the number of power levels of pets that this
                    character currently has under their control.  See CHARISMA.
maxPetLevels()      Returns the max number of power levels of pets that this
                    character can have under their control.
canHavePet( v )     Returns true if the caster is able to have v as a pet
                    based on their charisma and pet masteries.  See CHARISMA.
isInWarClan()       Returns true if this character is in a war clan.
isAtWar()           Returns true if this character is in a clan that is at war.
isAtWarWith( c )    Returns true if this character is in a clan that is at war
                    with clan c or character c's clan.
isAlliedWith( c )   Returns true if this character is in a clan that is allied
                    with clan c or character c's clan.
isSameClanWith( t ) Returns true if this character is in the same clan that
                    character t is.
isGroupedWith( t )  Returns true if this character is grouped with the target t.
isAllyOrNice( c )   Returns true if this character is allied with or nice to the
                    given character or clan c.
randomGroupie()     Returns a random group member that is in the same room
                    with this character or null if there isn't another groupie.
swarm()             The swarm method is used to swarm mobiles after the character.
                    See JS-CHAR-SWARM for more information.
act( string )       Causes the character to enter the command.  If you specify
                    more than one argument they will be appended together with
                    spaces in between them.  ex: "act( 'give', subject, actor );"
social()            See JS-SOCIALS for more information.
isActive()          Returns true if the character is active
                    (returns false if they quit, rented, or
                    are dead)
isAura()            Returns false
isMobile()          Returns true
isObj()             Returns false
isRoom()            Returns false
like()              See JS-LIKE.
reroll()            Rerolls a character's ability scores
hasClass( cls )     Returns true if the character has the specified class.  This
                    method supports cardinalities -- see JS-CARDINALITY.
classLevel( cls )   Returns the level of the character in the specified class.
                    (Returns 0 if the character does not have that class.)
jobLevel( job )     Returns the job level of the character in the specified job.
                    (0 = doesn't have the job, 1 = aspirer, ..., 7 = arch)
hasFlag( f )        Returns true if the character has the specified character flag
                    (see ACTFLAGS, AFFFLAGS, BUILD-FLAGS).
                    This method supports cardinalities -- see JS-CARDINALITY.
setFlag( f, v )     Sets the object flag "f" to the value "v" which should evaluate
                    to true or false.
isPC()              Returns true if the character is a player character.
isNPC()             Returns true if the character is a non-player character.
isSpawn()           Returns true if the character is spawned mobile.
isMounted()         Returns true if the character is mounted.
isMortal()          Returns true if the character is a mortal.
isAvatar()          Returns true if the character is an avatar.
isImmortal()        Returns true if the character is an immortal.
isOutlaw()          Returns true if char is a killer, thief, or has a warrant.
isKiller()          Returns true if the character committed an unpunished pkill.
isThief()           Returns true if the character committed an unpunished theft.
isWarrant()         Returns true if the character has a warrant out on them.
isGood()            Returns true if the character is of good alignment.
isNeutral()         Returns true if the character is of neutral alignment.
isEvil()            Returns true if the character is of evil alignment.
isUndead()          Returns true if the character is undead.
isNegativeEnergy()  Returns true if char is made up of negative energy.
isColdBlooded()     Returns true if the character is cold-blooded.
hasHeatShroud()     Returns true if the character is cold-blooded or has heat shroud.
isGrounded()        Returns true if the character is not floating or flying.
isFloating()        Returns true if the character is floating.
isFlying()          Returns true if the character is flying.
isSilenced()        Returns true if the character is silenced from either
                    a silence spell or if they are in a soundproof room.
isWaterbreathing()  Returns true if the character is waterbreathing.
equippedAt( l )     Returns whatever the character is equipping at the
                    specified location or null if nothing is being equipped.
                    See EQUIPMENT-LOCATIONS.  Ex: actor.equippedAt( 'head' );
isDualWielding()    Returns true if the character is dual wielding.
proficiencyIn( s )  Returns this character's proficiency in the proficiency s.
factionWith( f )    Returns the character's standing with the given faction
addFaction( f, s )  Adds the specified standing to the given faction, you
                    can also add multiple factions, for example:
                    actor.addFaction( 'endor', 10, 'agsded', -10 );
                    If you add multiple factions at once with one call
                    to "addFaction()" then a player's "brief faction"
                    setting will work properly.
hasAura( n )        Returns true if the character has the aura on themself
                    or any of their equipped items.
                    This method supports cardinalities -- see JS-CARDINALITY.
hasAuraOnSelf( n )  Returns true if the character has this aura on themself.
                    This method supports cardinalities -- see JS-CARDINALITY.
hasAuraOnItem( n )  Returns true if the character has this aura on any
                    of their equipped items.  This method supports cardinalities
                    -- see JS-CARDINALITY.
addAura()           See JS-ELEMENT.
removeAura()        See JS-ELEMENT.
addAuraCat()        See JS-ELEMENT.
removeAuraCat()     See JS-ELEMENT.
resistFor( r )      Returns the given resistance (see RESISTANCE)  You
                    can also use the 'average' option to get the average resist.
addResist( r, a )   Adds the amount a to the given resistance r.
gainExp( xp )       Adds the specified XP to the character.  You can also
                    specify the 'nocap' option to grant uncapped xp.  You can also
                    specify the 'description' option to provide a description of
                    why the exp is being granted.
                    Ex:  "actor.gain( exp, 'nocap', 'desc', 'armonte quest' );"
                    ("armonte quest" is the description.)
has()               Returns true if the character has the object.  This method
                    supports cardinalities -- see JS-CARDINALITY.
hasEq()             Returns true if the character has the object equipped.
                    This method supports cardinalities -- see JS-CARDINALITY.
hasVis()            Returns true if the character has the object visible.  (Items
                    in a container are not visible.)  This method supports
                    cardinalities -- see JS-CARDINALITY.
find( vnum )        Like has() except this method returns the object if present.
findEq( vnum )      Like hasEq() except this method returns the object if present.
findVis( vnum )     Like hasVis() except this method returns the object if present.
findPlayer( n )     Finds a player by the specified name on the mud and returns
                    the character object or null if the player could not be found.
                    The player must be visible to the current player in order to
                    be found.
msg( string )       Sends the specified message to the character.  See
                    JS-MSG for more information.
say( string )       Causes the character to say the string.  See
                    JS-MSG for more information.
talk( t, s )        Causes the character to say the string "s" to the
                    character "t".  See JS-MSG for more information.
shout( s )          Causes the character to shout the message.  Most of the time
                    the shout will just be heard in the room.  Occassionally the
                    shout will be heard in the zone, and rarely will it be heard
                    mud-wide.  This method provides an easy way to have your mobs
                    occassionally be heard far and wide without causing a lot of
                    spam.  See JS-MSG for more information.
randomAttacker()    This returns one of the chars attacking this char in this
                    room randomly or null if there are no attackers in this room.
visitAttackers( f ) Applies the passed in function to all of the chars attacking
                    this char.  See JS-VISIT for more information.
visitGroup( f )     Applies the passed in function to all of the chars in this
                    chars group who are the same room with this char.  See
                    JS-VISIT for more information.
visitNotGroup( f )  Applies the passed in function to all chars in self's
                    room who are not in self's group.  If self is a player
                    with the nice flag on then other players will be skipped
                    as well even if they are not grouped.  See JS-VISIT
                    for more information.
visitPets( f )      Applies the passed in function to all of the pets for
                    this character.  Pets will be visited even if they are
                    in a different room than their master.  See JS-VISIT.
visitEq( f )        Applies the passed in function or array to all of the
                    equipped equipment on this char.  See JS-VISIT for
                    more information.
visitVisInv( f )    Applies the passed in function or array to all of the
                    inventory on this char which is not equipped or in a
                    contained.  See JS-VISIT for more information.
savingFor( type )   Returns the character's saving throw for the specified
                    type (see SAVING-THROWS).  You can also specify
                    "average" to retrieve the average saving throw.
makesSave( t, m )   Makes a saving throw roll and returns true if the
                    character successfully saved against the type "t"
                    (see SAVING-THROWS) with the optional modifier
                    "m" (if no modifier is provided, a modifier of 0 is used).
                    Example:  if ( !actor.makesSave( 'ethos', -5 ) ) ...
acAt( area )        Returns the character's AC at the specified area.
                    Area can be 'average', 'head', 'body', 'larm' (left
                    arm), 'rarm' (right arm), 'lleg' (left leg), or
                    'rleg' (right leg).
acBonus()           This returns the current AC bonus due to dexterity,
                    posture, and so on.
stoppingAt( area )  Returns the character's stopping at the specified area.
                    The values for area are the same as for 'acAt()'.
toString()          Returns the key name of the character.
valueOf()           Returns the key name of the character.

Last edited by Frosty in May 2004.