Characters Table

Main.CharactersTable History

Hide minor edits - Show changes to markup

January 11, 2010, at 02:10 AM EST by Paramore
January 11, 2010, at 02:09 AM EST by Paramore
Changed line 277 from:

Related Pages

to:

Related Pages

January 11, 2010, at 02:07 AM EST by Paramore
Changed line 280 from:
to:
January 11, 2010, at 02:06 AM EST by Paramore
Changed lines 275-280 from:

As we get into more advanced Lua programming and store character information for later re-use (in prog timers for example), it is always the 'gid' that will be stored, never a direct pointer to the character themselves which can be become invalid if the target character quits/is killed in the meantime.

to:

As we get into more advanced Lua programming and store character information for later re-use (in prog timers for example), it is always the 'gid' that will be stored, never a direct pointer to the character themselves which can be become invalid if the target character quits/is killed in the meantime.

Related Pages

January 11, 2010, at 01:37 AM EST by Paramore
Changed lines 263-264 from:

targ = self.target if targ == nil then

to:
 targ = self.target
 if targ == nil then
Changed line 267 from:

else

to:
 else
Changed lines 273-275 from:

end

to:
 end
January 11, 2010, at 01:35 AM EST by Paramore
Changed lines 246-257 from:

if ch.race == RACE_TROLL ...

if ch.class == CLASS_MAGE ...

if ch.subclass == SUBCLASS_ARCHER ...

if ch.clan == CLAN_SHADOKIL ...

if ch.sex == SEX_FEMALE ...

if ch.position == POS_SITTING ...

to:
 if ch.race == RACE_TROLL ...
 if ch.class == CLASS_MAGE ...
 if ch.subclass == SUBCLASS_ARCHER ...
 if ch.clan == CLAN_SHADOKIL ...
 if ch.sex == SEX_FEMALE ...
 if ch.position == POS_SITTING ...
January 11, 2010, at 01:34 AM EST by Paramore
Changed line 240 from:

if ch.race == 11 then

to:
 if ch.race == 11 then
Changed lines 242-243 from:

end

to:
 end
January 11, 2010, at 01:31 AM EST by Paramore
Changed line 281 from:

As we get into more advanced Lua programming and store character information for later re-use (in prog timers for example), it is always the 'gid' that will be stored, never a direct pointer to the character themselves which can be become invalid if the target character quits/is killed in the meantime.

to:

As we get into more advanced Lua programming and store character information for later re-use (in prog timers for example), it is always the 'gid' that will be stored, never a direct pointer to the character themselves which can be become invalid if the target character quits/is killed in the meantime.

January 11, 2010, at 01:29 AM EST by Paramore
Changed lines 258-259 from:

Lua Object Return Types

to:

Lua Object Return Types

Changed lines 262-263 from:

Comparing Lua Object Return Types

to:

Comparing Lua Object Return Types

January 11, 2010, at 01:28 AM EST by Paramore
Changed lines 234-237 from:
to:
January 11, 2010, at 01:27 AM EST by Paramore
Added line 235:

\\

January 11, 2010, at 01:27 AM EST by Paramore
Deleted lines 234-235:
January 11, 2010, at 01:26 AM EST by Paramore
Changed lines 235-236 from:
to:
January 11, 2010, at 01:26 AM EST by Paramore
Changed lines 234-236 from:
to:
January 11, 2010, at 01:25 AM EST by Paramore
Added lines 237-238:
January 11, 2010, at 01:24 AM EST by Paramore
Changed lines 235-236 from:


























to:
January 11, 2010, at 01:22 AM EST by Paramore
Added line 234:

January 11, 2010, at 01:21 AM EST by Paramore
Deleted line 233:

Changed lines 236-237 from:

MUD Table Definitions

to:

MUD Table Definitions

January 11, 2010, at 01:19 AM EST by Paramore
Added lines 100-231:
Changed lines 236-323 from:

Int Current Intelligence.

Str Current Strength.

Wis Current Wisdom.

Luck Current Luck.

Level Level of character.

Totlevel Total level as it would appear in rank 1.

Name Character Name.

Class Primary class .

Subclass Character subclass.

Race Character Race.

Racename Character Racename.

Sex If you're offering, submit applications to webmaster.

Tier Current tier of character.

  • Trains Training sessions on hand, player only.

  • Practices Practices on hand, player only.

Hp Current hit points

Maxhp Max hit points

Hppct Percentage of HP remaining

Moves Current moves

Maxmoves Max moves

Movepct Percentage of moves remaining

Mana Current mana

Maxmana Max mana

Manapct Percentage of mana remaining

Questsdone Number of quests the player has completed.

Mobkills Number of mobs the player has killed.

Saves Current saves

Ingame Number of same mob in-game

Position Current position of character

Key Mob key of character, blank for a player

Following Return name of character the target is following

Groupsize Number of other people in player's group in room

Leader Return name of the character's group leader

Owner Return name of character's owner - only applies to pet

Target Returns mob's target as 'CH' type. See below.

Gtarget Same as target, but the previously remembered char does not still have to be in the same room.

Roomkey Returns key of room character is currently in.

Lastroom Room the character was last in. See the Lua howto page for example use.

Room Returns room character is in as a ROOM type variable.

Clones Returns number of same type of mob in the room, excluding self. Always 0 for players.

Order Returns order of current mob in room. Useful when you have multiple mobs of same type and only want a prog to fire once.

Keywords Mob only - returns keywords of the mob. Useful with give etc.

Gid Unique integer ID on each char - used for comparison.

to:
January 11, 2010, at 12:50 AM EST by Paramore
Changed line 27 from:

Current constitution. NOTE: All stat values include equipment and spells.

to:

Current constitution. NOTE: All stat values include equipment and spells.

January 11, 2010, at 12:49 AM EST by Paramore
Changed line 27 from:

Current constitution. --> NOTE: All stat values include equipment and spells.

to:

Current constitution. NOTE: All stat values include equipment and spells.

January 11, 2010, at 12:49 AM EST by Paramore
Changed line 27 from:

Current constitution \\ NOTE: All stat values include equipment and spells.

to:

Current constitution. --> NOTE: All stat values include equipment and spells.

January 11, 2010, at 12:49 AM EST by Paramore
Changed line 27 from:

Current constitution NOTE: All stat values include equipment and spells.

to:

Current constitution \\ NOTE: All stat values include equipment and spells.

January 11, 2010, at 12:48 AM EST by Paramore
Changed lines 1-2 from:

The table below lists character properties visible from Lua at the time of writing. If your prog needs to access character data not in this list, contact Lasher.

to:

If your prog needs to access character data not in this list, contact Lasher.

Changed line 27 from:

Current constitution

to:

Current constitution NOTE: All stat values include equipment and spells.

Added lines 64-99:
January 11, 2010, at 12:40 AM EST by Paramore
Changed line 33 from:
  • Desc
to:

Desc*

Changed line 49 from:
  • Gold
to:

Gold*

Deleted lines 65-67:


Deleted lines 89-90:

Clan Character's clan.

January 11, 2010, at 12:37 AM EST by Paramore
Added line 70:

\\\\\\\\\\\\\\\\\\\\\\\\\\

January 11, 2010, at 12:36 AM EST by Paramore
Added line 69:

January 11, 2010, at 12:36 AM EST by Paramore
Changed line 68 from:

\\

to:

January 11, 2010, at 12:35 AM EST by Paramore
January 11, 2010, at 12:35 AM EST by Paramore
Changed line 49 from:

\*Gold

to:
  • Gold
Changed line 68 from:
to:

\\

January 11, 2010, at 12:27 AM EST by Paramore
Changed line 49 from:
  • Gold
to:

\*Gold

Changed lines 68-69 from:
  • Gold Gold on hand
to:
Deleted lines 72-73:

Dex Current Dexterity.

Deleted lines 74-75:

Con Current Constitution.

Deleted lines 118-125:

Himher Him/Her/It name for current char.

Heshe He/She/It name for current char.

Hisher His/Hers/Its name for current char.

Explored Number of rooms the character has explored.

January 11, 2010, at 12:24 AM EST by Paramore
Changed line 25 from:

Tables

to:

Con

Changed line 27 from:

Table directives

to:

Current constitution

Changed line 29 from:

Tables

to:

Damtype

Changed line 31 from:

Table directives

to:

Character's primary damtype - compare to FOCUS_variables below.

Changed line 33 from:

Tables

to:
  • Desc
Changed line 35 from:

Table directives

to:

Character description - read only on players.

Changed line 37 from:

Tables

to:

Dex

Changed line 39 from:

Table directives

to:

Current dexterity

Changed line 41 from:

Tables

to:

Explored

Changed lines 43-63 from:

Table directives

to:
January 11, 2010, at 12:17 AM EST by Paramore
Changed line 9 from:

Tables

to:

Align

Changed lines 11-43 from:
to:
Changed lines 46-50 from:

Property Description

Align Current alignment

to:
January 10, 2010, at 11:48 PM EST by Paramore
Changed line 3 from:
to:
January 10, 2010, at 11:48 PM EST by Paramore
Changed line 4 from:
to:
January 10, 2010, at 11:45 PM EST by Paramore
Changed lines 5-7 from:

Navigation Links

to:
Changed line 10 from:
to:
January 10, 2010, at 11:38 PM EST by Paramore
Changed line 3 from:
to:
January 10, 2010, at 11:38 PM EST by Paramore
Changed line 7 from:
to:

Tables

January 10, 2010, at 11:34 PM EST by Paramore
Added lines 3-11:
December 26, 2008, at 04:06 PM EST by admin
Added line 123:
Added line 125:
Added line 127:
Added line 129:
Added line 131:
December 26, 2008, at 04:06 PM EST by admin
Added line 4:
Added lines 6-7:
Added line 9:
Added line 11:
Added line 13:
Added line 15:
Added line 17:
Added line 19:
Added line 21:
Added line 23:
Added line 25:
Added line 27:
Added line 29:
Added line 31:
Added line 33:
Added line 35:
Added line 37:
Added line 39:
Added line 41:
Added line 43:
Added line 45:
Added line 47:
Added line 49:
Added line 51:
Added line 53:
Added line 55:
Added line 57:
Added line 59:
Added line 61:
Added line 63:
Added line 65:
Added line 67:
Added line 69:
Added line 71:
Added line 73:
Added line 75:
Added line 77:
Added line 79:
Added line 81:
Added line 83:
Added line 85:
Added line 87:
Added line 89:
Added line 91:
Changed lines 93-96 from:

Gtarget Same as target, but the previously remembered char does not still have to be in the same room.

to:

Gtarget Same as target, but the previously remembered char does not still have to be in the same room.

Added line 98:
Added line 100:
Added line 102:
Changed lines 104-107 from:

Order Returns order of current mob in room. Useful when you have multiple mobs of same type and only want a prog to fire once.

to:

Order Returns order of current mob in room. Useful when you have multiple mobs of same type and only want a prog to fire once.

Added line 109:
Deleted lines 111-112:
December 26, 2008, at 04:04 PM EST by admin
Added lines 1-99:

The table below lists character properties visible from Lua at the time of writing. If your prog needs to access character data not in this list, contact Lasher.

Property Description Align Current alignment

  • Gold Gold on hand

Int Current Intelligence. Str Current Strength. Dex Current Dexterity. Wis Current Wisdom. Con Current Constitution. Luck Current Luck. Level Level of character. Totlevel Total level as it would appear in rank 1. Name Character Name. Class Primary class . Subclass Character subclass. Race Character Race. Racename Character Racename. Clan Character's clan. Sex If you're offering, submit applications to webmaster. Tier Current tier of character.

  • Trains Training sessions on hand, player only.
  • Practices Practices on hand, player only.

Hp Current hit points Maxhp Max hit points Hppct Percentage of HP remaining Moves Current moves Maxmoves Max moves Movepct Percentage of moves remaining Mana Current mana Maxmana Max mana Manapct Percentage of mana remaining Himher Him/Her/It name for current char. Heshe He/She/It name for current char. Hisher His/Hers/Its name for current char. Explored Number of rooms the character has explored. Questsdone Number of quests the player has completed. Mobkills Number of mobs the player has killed. Saves Current saves Ingame Number of same mob in-game Position Current position of character Key Mob key of character, blank for a player Following Return name of character the target is following Groupsize Number of other people in player's group in room Leader Return name of the character's group leader Owner Return name of character's owner - only applies to pet Target Returns mob's target as 'CH' type. See below. Gtarget Same as target, but the previously remembered char does not still have to be in the same room. Roomkey Returns key of room character is currently in. Lastroom Room the character was last in. See the Lua howto page for example use. Room Returns room character is in as a ROOM type variable. Clones Returns number of same type of mob in the room, excluding self. Always 0 for players. Order Returns order of current mob in room. Useful when you have multiple mobs of same type and only want a prog to fire once. Keywords Mob only - returns keywords of the mob. Useful with give etc. Gid Unique integer ID on each char - used for comparison.

MUD Table Definitions

When using properties such as race, class, subclass and clan, the values returned are numbers. If you happen to know that Troll is race number 11, you could write something like:

if ch.race == 11 then

   say("Hi Troll!")

end

While this works, it is not very convenient. To help with comparing values in tables, several of the game tables have their contents loaded into Lua for easier comparison. The following are all valid:

if ch.race == RACE_TROLL ... if ch.class == CLASS_MAGE ... if ch.subclass == SUBCLASS_ARCHER ... if ch.clan == CLAN_SHADOKIL ... if ch.sex == SEX_FEMALE ... if ch.position == POS_SITTING ...

Lua Object Return Types

Some of the properties on objects will return other objects on the stack rather than string or integer values. Once you have a variable of this type, all of the usual properties are available on it. For example, when 'targ = self.target' returns the mob's target, then all the properties of 'targ' are available using targ.level, targ.int, etc.

Comparing Lua Object Return Types

One other important point for builders to remember is that similar objects in Lua do not compare as equal. For example, if Razor triggers a program (ch) and the mob gets it's target (targ) then wants to see if Razor is already it's target, it cannot simply do if ch == targ. This is because the two variables are two different objects in Lua that just happen to point to the same underlying character in the MUD. Every character in the game has a unique 'gid' value and this is what should be used for comparison.

In the sample Lua code below, the mob checks if it has a target already. If it doesn't, it remembers the character triggering the prog. If it does, it wants to either inform the player that they are its target, or inform the player who the target it. The 'gid' character property is used for the comparison:

targ = self.target if targ == nil then

   say ("I don't have a target")
   remember(ch)

else

   if (targ.gid == ch.gid) then
      say ("Hi! You're my target!")
   else
      say ("My target's name is " .. targ.name)
   end

end

As we get into more advanced Lua programming and store character information for later re-use (in prog timers for example), it is always the 'gid' that will be stored, never a direct pointer to the character themselves which can be become invalid if the target character quits/is killed in the meantime.