Difference between revisions of "Manual:Zone Manual/The Objects Section"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
 
== The objects section ==
 
== The objects section ==
  
−
The previous chapters would be enough for you to create an entire
+
With rooms and NPCs alone you could build a world of naked people fighting with their bare hands. Objects fill it with everything else: weapons and armour for the NPCs, food and drink, keys, chests, boats and the junk lying about in the rooms.
−
game of nudists with no technology and no items of any kind.  This of
+
 
−
corse would be a very boring game of naked people fighting with no
+
Objects go in the <code>%objects</code> section of a zone file. Like rooms and NPCs, each object is a symbolic name, then its fields in any order, then <code>end</code>:
−
weapons. don't worry the VME has a solution to this you can build
+
 
−
objects to dress up the NPCs and to fill the rooms with cluttered
+
<pre>
−
junk.
+
%objects
 +
 
 +
big_rock
 +
names {"big rock", "rock"}
 +
title "a big rock"
 +
descr "A big rock is lying in the road."
 +
manipulate {MANIPULATE_TAKE}
 +
weight 40
 +
end
 +
</pre>
 +
 
 +
This page lists the fields an object can have and what each one does in the game. [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]] shows the macros that set up weapons, armour, containers, drinks and the other kinds of objects; [[Manual:Zone Manual/The Objects Section/Building your first object|Building your first object]] walks through a complete object.
 +
 
 +
=== Object fields ===
  
−
In order to get started building objects you should first be aware
 
−
of the object fields you can use.  The (Link to objfields) shows a full listing
 
−
of all the object fields and their types as defined in (Link to ch-03).
 
 
{| class="wikitable"
 
{| class="wikitable"
−
|+Object fields and types
+
!Field
 +
!Value
 +
!Default
 +
!What it is
 +
|-
 +
|<code>names</code>
 +
|string list
 +
|none
 +
|The words players use to act on the object.
 +
|-
 +
|<code>title</code>
 +
|string
 +
|none
 +
|The short name: "a big rock".
 +
|-
 +
|<code>descr</code>
 +
|string
 +
|none
 +
|What players see when the object lies in a room.
 +
|-
 +
|<code>inside_descr</code>
 +
|string
 +
|none
 +
|What players see when they are inside the object (a coffin, a boat).
 +
|-
 +
|<code>extra</code>
 +
|string list, string
 +
|none
 +
|Descriptions to look at, special messages, and data for DIL.
 +
|-
 +
|<code>type</code>
 +
|<code>ITEM_*</code>
 +
|<code>ITEM_OTHER</code>
 +
|The kind of object. Usually set by a macro.
 +
|-
 +
|<code>manipulate</code>
 +
|<code>MANIPULATE_*</code> flags
 +
|none
 +
|Whether it can be taken, entered, worn (and where), wielded or held.
 +
|-
 +
|<code>flags</code>
 +
|<code>UNIT_FL_*</code> flags
 +
|none
 +
|Unit flags: invisible, buried, magic, not saved...
 +
|-
 +
|<code>romflags</code>
 +
|<code>OBJ_*</code> flags
 +
|none
 +
|Object flags.
 +
|-
 +
|<code>weight</code>
 +
|number
 +
|1
 +
|Weight in pounds, 0 to 32767.
 +
|-
 +
|<code>height</code>
 +
|number
 +
|180
 +
|Size in centimetres; decides who it fits.
 
|-
 
|-
−
!Field
+
|<code>capacity</code>
−
!Type
+
|number
−
!Field
+
|0
−
!Type
+
|How many pounds it can hold, -1 to 32767 (-1 is endless).
 
|-
 
|-
−
|symbolic name
+
|<code>value[0]</code> .. <code>value[4]</code>
−
|Symbol
+
|number
−
|affect
+
|0
−
|affect function
+
|Five numbers whose meaning depends on the type. Usually set by a macro.
 
|-
 
|-
−
|names
+
|<code>cost</code>
−
|Stringlist
+
|money
−
|dilbegin or dilcopy
+
|0
−
|function pointer
+
|What it is worth in a shop.
 
|-
 
|-
−
|title
+
|<code>rent</code>
−
|String
+
|money
−
|key
+
|0
−
|String
+
|What it costs per day to keep it while logged off.
 
|-
 
|-
−
|descr
+
|<code>open</code>
−
|String
+
|<code>EX_*</code> flags
−
|open
+
|none
−
|Integer
+
|Whether it opens, closes and locks. May be followed by <code>difficulty</code> n.
 
|-
 
|-
−
|inside_descr
+
|<code>key</code>
−
|String
+
|symbolic name
−
|manipulate
+
|none
−
|Integer
+
|The object that locks and unlocks it.
 
|-
 
|-
−
|extra
+
|<code>bright</code>
−
|Structure
+
| -6 to 6
−
|spell
+
|0
−
|Integer
+
|How much light it gives off.
 
|-
 
|-
−
|minv
+
|<code>light</code>
−
|Integer
+
| -6 to 6
−
|value
+
|0
−
|Integer
+
|Light inside the object.
 
|-
 
|-
−
|alignment
+
|<code>minv</code>
−
|Integer
+
|number
−
|cost
+
|0
−
|Integer
+
|Administrator invisibility level.
 
|-
 
|-
−
|flags
+
|<code>alignment</code>
−
|Integer
+
| -1000 to 1000
−
|rent
+
|0
−
|Integer
+
|Stored, but nothing in the game reads an object's alignment.
 
|-
 
|-
−
|weight
+
|<code>spell</code>
−
|Integer
+
|0 to 255
−
|type
+
|0
−
|Integer
+
|Magic resistance.
 
|-
 
|-
−
|capacity
+
|<code>dilcopy</code>, <code>dilbegin</code>
−
|Integer
+
|DIL
−
|end tag
+
|none
−
|Symbol
+
|Scripts that run on the object.
 
|-
 
|-
−
|light
+
|<code>affect</code>
−
|Integer
+
|affect block
−
|
+
|none
−
|
+
|Bonuses and curses. Use the macros, never write it yourself.
 
|}
 
|}
−
Many of the same fields you found in rooms and NPCs, as you can see from
 
−
(Link to objfields), can also be found in objects.  The fields do
 
−
not always have exactly the same use when coding rooms, NPCs, and
 
−
objects but they are normally set in the same manor.  It is very
 
−
important that you read and understand the differences of each field as
 
−
they pertains to rooms, objects, and or NPCs.
 
−
=== Description of object fields ===
 
  
 +
Fields can come in any order. <code>manipulate</code>, <code>flags</code>, <code>romflags</code> and <code>open</code> add up when you give them more than once; every other field keeps the last value it was given. A macro such as <code>WEAPON_DEF</code> sets <code>type</code>, <code>value[]</code> and other fields, so put the macro first and change things after it.
 +
 +
Flags are written in braces and separated by commas: <code>manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}</code>. A single flag needs no braces. Numbers may be sums such as <code>2*12+1</code>.
 +
 +
All the constants on this page come from <code>vme/include/vme.h</code> and <code>values.h</code>; start your zone with <code>#include &lt;macros.h&gt;</code>, which includes them.
 +
 +
=== Description of the object fields ===
  
 
;symbolic name
 
;symbolic name
−
: The rules of the symbols has been explained in
+
:The name the object is known by in the zone, such as <code>dragon_head</code>. Administrators use it to <code>load</code> and <code>wstat</code> the object, and other fields (<code>key</code>) and the resets refer to it. Use a name that matches the title so it is easy to find. The rules for symbols are in [[Manual:Zone Manual/Unit Building Blocks|Unit Building Blocks]]: letters, digits and <code>_</code>, at most 15 characters, unique among the rooms, objects and NPCs of the zone.
−
(Link to ch-03), if you didn't read them yet you may want to review.
+
 
−
The important thing to realize with the object symbol is it is always
 
−
good practice to give the object a symbol that resembles the title and
 
−
description so administrators and builders can use the
 
−
'''load''' and the '''wstat''' to easily
 
−
locate, examine, and load the object in question.
 
 
;title
 
;title
−
: The object title is what is shown if the object is being picked up, dropped, given to someone, when you do the inventory command, , or being used in combat.
+
:What the game shows when the object is picked up, dropped, given, listed in an inventory or used in a fight. Start it in lower case with an article, and don't end it with punctuation: vmc warns about a title that ends in something other than a letter, and about one that starts with a capitalised word such as "The".
−
there should be no punctuation in the object title
 
−
because of how it is used in the VME server.  If you add punctuation or
 
−
forget to capitalize something that the VMC thinks you should it will
 
−
give you a warning when you compile. The following are good examples of
 
−
an object title.
 
−
<nowiki>
 
−
title "a big rock"
 
−
title "the flame tongue"
 
−
title "a lap top"
 
−
title "a garbage bag"
 
−
title "an oval hover car"</nowiki>
 
−
; descr
 
−
*
 
−
The description field is what the player sees when walking into the room
 
−
or when looking with no arguments.  It is good practice to make this no
 
−
longer than one line not counting the 'descr' tag.
 
  
−
Some examples of the object description field would be as
+
<pre>
−
follows:
+
title "a big rock"
−
<nowiki>
+
title "the flame tongue"
−
descr
+
title "an oval hover car"
−
"a green bloody sword is laying here."
+
</pre>
  
−
descr
+
;descr
−
"A massive wooden round table sits here."
+
:What players see when the object lies in the room they are in, or when they look around. One line is usually enough.
 +
 
 +
<pre>
 +
descr "A green bloody sword is lying here."
 +
descr "A massive round wooden table stands here."
 +
</pre>
  
−
descr
 
−
"a funny looking hammer is laying here."</nowiki>
 
 
;names
 
;names
−
: The object names are as important as the NPC names.  They are what you act on when picking the object up, dropping it, throwing it, just about anything you do to objects use these name fields.  On drink containers you add the liquid name at the end, so people can drink the liquid. You always need to make sure you put every possible name that the player may use to examine or take your item.  The rule of thumb is if it is in the title or description it should be in the names list. conversely if it is not in the title or description it shouldn't be in the names list because the players will not use it if they don't know about it.
+
:The words players type to pick the object up, drop it, look at it and so on. Every word a player might use from the title and the description should be in the list, and nothing that isn't. Put longer names first: vmc refuses a list where a name starts with an earlier one ("rock" before "big rock"). A name can't end in <code>'s</code> or start with <code>self</code>.
  
−
The following is some examples of good 'names' fields with respect to
+
<pre>
−
        their 'title' and 'descr'.
+
title "an old twisted staff"
−
<nowiki>
+
descr "An old twisted staff has been thrown away here."
−
title "a big rock"
+
names {"old twisted staff", "twisted staff", "old staff", "staff"}
−
descr "a big rock is here blocking the road."
+
</pre>
−
names {"big rock","rock"}
+
 
 +
:On a drink container the last name must be the liquid, as in <code>{"waterskin", "skin", "water"}</code>: when the container is drunk empty, the game removes the last name.
  
−
title "an old twisted staff"
 
−
descr "An old twisted staff has been discarded here."
 
−
names{"old twisted staff","twisted staff","old staff","staff"}</nowiki>
 
−
The idea of course is to make any combination that a player may
 
−
type to try and act upon your object.  You would not want to describe and
 
−
title your object with an entirely different theme than you created its
 
−
names with because a player would not know what it is called.
 
 
;inside_descr
 
;inside_descr
−
: The inside description is what a player sees if it is inside the object.  This is used for things like Coffins or boxes or boats that a player can climb inside. The inside description is defined the same way the normal description is but you can make it as many lines as you want like you would with a room description.
+
:What players see when they are inside the object, for objects that can be entered (a coffin, a boat). It can be several lines long, like a room description.
−
<nowiki>
+
 
−
                                      inside_descr
+
<pre>
−
"You are inside a black coffin with a red velvet padding - scary!"
+
inside_descr
 +
"You are inside a black coffin with red velvet padding. Scary!"
 +
</pre>
  
−
                                      inside_descr
 
−
"You are inside the pink time machine.  a small control panel is on the
 
−
floor and seems to be operated by stepping on it."</nowiki>
 
 
;extra
 
;extra
−
: The extra's on the object like the NPC, can be used to do many things. It can be used to store information for DIL programs or it can be used to show a part of the object like the room extras show a part of the room.  They can even be used to create new acts when a person picks the item up,
+
:Extra descriptions. An extra with an empty name list is what players see when they look at the object:
−
drops, or enters it.There is also a special extra that is the object's description when
+
 
−
you look at it with the look &lt;object&gt; command.
+
<pre>
 +
extra {}
 +
"The ice cube is about 40 meters on each side. It seems to be melting
 +
slightly, but waiting for it to finish would be like waiting for the
 +
ice age to end."
 +
</pre>
  
−
Lets go over the object description extra first.  If you use an extra
+
:An extra with names describes a part of the object, for <code>look at crack</code>:
−
with no names list it will become the object's description when you look at
 
−
any of the names on it.
 
−
<nowiki>
 
−
extra {}
 
−
"Its just a rock nothing special about it."
 
  
−
extra {}
+
<pre>
−
"The ice cube is about 40 meters perfectly cubed.  It seems to be
+
extra {"crack"}
−
melting slightly but waiting for it to finish would be sort of like
+
"There is a big crack in the side of the ice cube."
−
waiting for the ice age to end."</nowiki>
+
</pre>
−
You can also use extras to show parts of the object.
+
 
−
<nowiki>
+
:Extras whose name starts with <code>$</code> are not for players to look at. Some of them replace the game's standard messages when something is done to the object. In them <code>$1n</code> is the character who does it and <code>$2n</code> the object; the codes are explained under [[Manual:DIL Manual/act()|act()]].
−
extra {"crack"}
 
−
"There is a big crack in the side of the ice cube. Maybe if you mess
 
−
with the crack you will be able to open it or something."
 
  
−
extra {"bed post","post"}
 
−
"Its a big gold bed post don't you wish you could get this sucker off it
 
−
would make you a rich adventurer indeed."</nowiki>
 
−
You can also use the extras to give more detailed and vivid
 
−
descriptions when the object is acted upon.
 
 
{| class="wikitable"
 
{| class="wikitable"
−
|+Object special action extras
+
|+Message extras
−
|-
 
 
!Extra
 
!Extra
−
!Description
+
!Replaces the message...
 
|-
 
|-
−
|$wear_s
+
|<code>$get_s</code> / <code>$get_o</code>
−
|A message shown to activator when wearing (+wield/grab/hold) an
+
|to the character / to the others in the room, when it is picked up from the floor
−
item.
 
 
|-
 
|-
−
|$wear_o
+
|<code>$drop_s</code> / <code>$drop_o</code>
−
|A message shown to others when wearing an item.
+
|when it is dropped
 
|-
 
|-
−
|$rem_s
+
|<code>$wear_s</code> / <code>$wear_o</code>
−
|A message shown to activator when removing worn stuff.
+
|when it is worn, wielded or held
 
|-
 
|-
−
|$rem_o
+
|<code>$rem_s</code> / <code>$rem_o</code>
−
|A message shown to others when removing an item.
+
|when it is removed
 
|-
 
|-
−
|$get_s
+
|<code>$enter_s</code> / <code>$enter_o</code>
−
|A message shown to activator when getting an item.
+
|when someone enters it
 
|-
 
|-
−
|$get_o
+
|<code>$exit_s</code> / <code>$exit_o</code>
−
|A message shown to others when getting an item.
+
|when someone leaves it
 +
|}
 +
 
 +
<pre>
 +
extra {"$get_s"}
 +
"You pick up $2n. It is very cold and starts to melt in your hands."
 +
 
 +
extra {"$get_o"}
 +
"$1n picks up $2n. A drop of water hits the ground."
 +
</pre>
 +
 
 +
:Other <code>$</code> extras hold data: <code>$identify</code> is shown by the identify spell, the <code>MATERIAL_*</code> macros write <code>$material</code>, the drink macros write <code>$drink_color</code> and friends, and DIL programs keep their own. The extra must start with <code>$</code>: <code>extra {"drop_o"}</code> is just a description of a part called "drop_o".
 +
 
 +
;type
 +
:The kind of object, one of the <code>ITEM_*</code> constants. Only one type can be set. The macros on [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]] set it for you, together with the values that type needs.
 +
 
 +
{| class="wikitable"
 +
|+Item types
 +
!Type
 +
!Used by the game
 
|-
 
|-
−
|$drop_s
+
|<code>ITEM_WEAPON</code>
−
|A message shown to activator when dropping an item.
+
|A weapon to wield. <code>WEAPON_DEF</code>.
 
|-
 
|-
−
|$drop_o
+
|<code>ITEM_ARMOR</code>
−
|A message shown to other when dropping an object.
+
|Armour. <code>ARMOUR_DEF</code> and the <code>ARMOUR_*</code> macros.
 
|-
 
|-
−
|$enter_s
+
|<code>ITEM_SHIELD</code>
−
|A message shown to activator when entering an item.
+
|A shield. <code>SHIELD_DEF</code>.
 
|-
 
|-
−
|$enter_o
+
|<code>ITEM_WORN</code>
−
|A message shown to other when entering an item.
+
|Clothes and jewellery that give no protection.
 
|-
 
|-
−
|$exit_s
+
|<code>ITEM_CONTAINER</code>
−
|A message shown to activator when leaving an item.
+
|Things to put things in. <code>CONTAINER_DEF</code>.
 
|-
 
|-
−
|$exit_o
+
|<code>ITEM_DRINKCON</code>
−
|A message shown to other when leaving an item.
+
|A drink container for <code>drink</code> and <code>pour</code>. <code>LIQ_DEF</code> and the liquid macros.
−
|}
 
−
In the following example of an ice cube, 1n is the activator and
 
−
$2n is the unit in question.
 
−
<nowiki>
 
−
extra {"$get_s"}
 
−
"You pick up the $2N, it is very cold and begins to melt in your hands."
 
−
 
 
−
extra {"$get_o"}
 
−
"$1n picks up the $2N, you notice that a drop of water hits the ground as
 
−
it begins to melt in $1s hand."</nowiki>
 
−
Finally you can use extras to store information for DIL programs.
 
−
We will not cover this because it is a topic covered in-depth in
 
−
the DIL documentation.
 
−
;manipulate
 
−
: This field is what defines the things that can be done to the object.  For example a piece of armour should be able to be taken and worn, while a fountain should be able to be entered but not taken unless its some magical portable fountain.  There are two sets of manipulate flags even though you can use them together.  We separate them because the first two are flags that tell you if you can take or enter something while the rest of the manipulate flags are for worn positions.
 
−
 
 
−
First the two flags for taking and entering are:
 
−
{| class="wikitable"
 
−
|+Take and enter flags
 
 
|-
 
|-
−
!Manipulate
+
|<code>ITEM_FOOD</code>
−
!Description
+
|Food for <code>eat</code>. <code>FOOD_DEF</code>.
 
|-
 
|-
−
|MANIPULATE_TAKE
+
|<code>ITEM_LIGHT</code>
−
|Set this flag if the unit can be taken
+
|A torch or lantern for <code>light</code> and <code>extinguish</code>. <code>LIGHT_DEF</code>.
−
(picked up/moved about).
 
 
|-
 
|-
−
|MANIPULATE_ENTER
+
|<code>ITEM_MONEY</code>
−
|Set this flag if it is possible to
+
|Coins. <code>MONEY</code>.
−
enter a unit, ie set it in a coffin if you want players to be able to
 
−
enter the coffin.
 
−
|}
 
−
These flags are
 
−
set to indicate on what body positions a particular object can be
 
−
worn:
 
−
* MANIPULATE_WEAR_FINGER
 
−
* MANIPULATE_WEAR_NECK
 
−
* MANIPULATE_WEAR_BODY
 
−
* MANIPULATE_WEAR_HEAD
 
−
* MANIPULATE_WEAR_LEGS
 
−
* MANIPULATE_WEAR_FEET
 
−
* MANIPULATE_WEAR_HANDS
 
−
* MANIPULATE_WEAR_ARMS
 
−
* MANIPULATE_WEAR_SHIELD
 
−
* MANIPULATE_WEAR_ABOUT
 
−
* MANIPULATE_WEAR_WAIST
 
−
* MANIPULATE_WEAR_WRIST
 
−
* MANIPULATE_WIELD
 
−
* MANIPULATE_HOLD
 
−
* MANIPULATE_WEAR_EAR
 
−
* MANIPULATE_WEAR_BACK
 
−
* MANIPULATE_WEAR_CHEST
 
−
*  MANIPULATE_WEAR_ANKLE
 
−
Currently you can only set one of the worn positions flags on an
 
−
item at a time.  You can set both enter and take on an item with a
 
−
position or just one or the other. Some legal examples of combinations
 
−
are as follows:
 
−
<nowiki>
 
−
//An earring
 
−
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_EAR}
 
−
 
 
−
//A backpack
 
−
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER, MANIPULATE_WEAR_BACK}
 
−
 
 
−
//strange true but its legal an earring pack
 
−
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER, MANIPULATE_WEAR_EAR}</nowiki>
 
−
;flags
 
−
: This field on an object is used to set special attributes in order to make the object able to be buried or not or no-teleportable and many others. The object flag list uses the UNIT_FL_* variables that both the NPCs and the rooms also use, therefore while you can set some flags on an object it may not have any affect unless you as a builder or administrator adds the functionality.  You can also add extras on an object that can be used as a special flag which you will learn as you learn to use DIL.  The following is a full list of all unit flags and how they affect objects, if they do.
 
−
{| class="wikitable"
 
−
|+Object unit flag affects
 
 
|-
 
|-
−
!Flag
+
|<code>ITEM_POTION</code>
−
!Description
+
|A potion for <code>quaff</code>. <code>POTION_DEF</code>.
 
|-
 
|-
−
|UNIT_FL_PRIVATE
+
|<code>ITEM_SCROLL</code>
−
|Currently has no affect on a NPC.
+
|A scroll for <code>recite</code>. <code>SCROLL_DEF</code>.
 
|-
 
|-
−
|UNIT_FL_INVISIBLE
+
|<code>ITEM_WAND</code>, <code>ITEM_STAFF</code>
−
|Makes unit invisible
+
|Held and used with <code>use</code>. <code>WAND_DEF</code>, <code>STAFF_DEF</code>.
 
|-
 
|-
−
|UNIT_FL_NO_BURY
+
|<code>ITEM_FIREWEAPON</code>
−
|Makes it so you can create objects that
+
|A bow, crossbow or sling for <code>shoot</code>. <code>RANGED_DEF</code>.
−
can not be buried for example a weapon that for some reason shouldn't be
 
−
buried.
 
 
|-
 
|-
−
|UNIT_FL_BURIED
+
|<code>ITEM_TRAP</code>
−
|Makes
+
|A trap for the trap skill. <code>TRAP_DEF</code>.
−
unit buried when loaded
 
 
|-
 
|-
−
|UNIT_FL_NO_TELEPORT
+
|<code>ITEM_NOTE</code>
−
|Makes it so you can not teleport into this object.  This flag only
+
|Paper to write on, and to post on boards or send as mail.
−
works on containers.
 
 
|-
 
|-
−
|UNIT_FL_NO_MOB
+
|<code>ITEM_BOARD</code>
−
|Currently has no affect on an object.
+
|A bulletin board (see <code>vme/zone/boards.zon</code>).
 
|-
 
|-
−
|UNIT_FL_NO_WEATHER
+
|<code>ITEM_BOAT</code>
−
|Currently has no affect on a NPC.
+
|Something to enter and <code>sail</code> over water.
 
|-
 
|-
−
|UNIT_FL_INDOORS
+
|<code>ITEM_KEY</code>
−
|Currently has no affect on an object.
+
|A key. A lock only checks the key's symbolic name, so the type is just for shops and players.
 
|-
 
|-
−
|UNIT_FL_TRANS
+
|<code>ITEM_TREASURE</code>
−
|Makes unit transparent If the Unit is
+
|Gems and other valuables, worth only their price.
−
transparent you will be able to see any NPCs that it is carrying.
 
−
For example if a canoe was carrying a familiar you would see that as you
 
−
walked into the room.  If this flag is not set and you are in a canoe you
 
−
will not see outside the canoe and no one will see in.
 
 
|-
 
|-
−
|UNIT_FL_NO_SAVE
+
|<code>ITEM_TRASH</code>
−
|Makes it so a PC can't save with
+
|Junk. Broken weapons and armour become trash.
−
unit
 
 
|-
 
|-
−
|UNIT_FL_SACRED
+
|<code>ITEM_OTHER</code>
−
|Currently has no affect on an object.
+
|Anything else. The default.
 
|-
 
|-
−
|UNIT_FL_MAGIC
+
|<code>ITEM_MISSILE</code>, <code>ITEM_PEN</code>, <code>ITEM_SPELL</code>, <code>ITEM_BOOK</code>, <code>ITEM_SKIN</code>
−
|This flag is used by spells to tell if the object is magic.
+
|Defined, but no command treats them specially. Arrows are <code>ITEM_WEAPON</code> (<code>MISSILE_DEF</code>).
 
|}
 
|}
−
If you wanted to make an object that a player can carry around but can
+
 
−
not save you would set the manipulate and flags as follows.
+
:You can give your own DIL commands their own meaning for a type, but the built-in commands only know the ones above.
−
<nowiki>
+
 
−
manipulate {MANIPULATE_TAKE}
+
;manipulate
−
flags {UNIT_FL_NO_SAVE}</nowiki>
+
:What can be done with the object. <code>MANIPULATE_TAKE</code> lets it be picked up: without it the object can't be taken at all, which is right for a fountain or a statue. <code>MANIPULATE_ENTER</code> lets players put things into it, and enter it if it is big enough (a coffin, a boat). The rest say where it is used:
−
;type
+
 
−
: This field is what you use to set the objects type.  The type field is used when spells are cast or commands are executed on the object. You can add your own item types but they will not change the actions of base code commands.  The following is the list of item types and what they mean when you set them.  Some are not supported with the current code but you can add support for them if you like by making DIL commands, which is covered in another manual.
 
 
{| class="wikitable"
 
{| class="wikitable"
−
|+Item types
+
!Flag
 +
!Position
 +
!Flag
 +
!Position
 
|-
 
|-
−
!Type
+
|<code>MANIPULATE_WIELD</code>
−
!Description
+
|wielded as a weapon
 +
|<code>MANIPULATE_HOLD</code>
 +
|held in the hand
 
|-
 
|-
−
|ITEM_LIGHT
+
|<code>MANIPULATE_WEAR_HEAD</code>
−
|Items of this type can be lighted and extinguished.
+
|head
 +
|<code>MANIPULATE_WEAR_NECK</code>
 +
|neck (two)
 
|-
 
|-
−
|ITEM_SCROLL
+
|<code>MANIPULATE_WEAR_BODY</code>
−
|Items of this type can be read as a magical scroll.
+
|body
 +
|<code>MANIPULATE_WEAR_CHEST</code>
 +
|across the chest (a baldric)
 
|-
 
|-
−
|ITEM_WAND
+
|<code>MANIPULATE_WEAR_ABOUT</code>
−
|Items of this type can be used with the '''use'''
+
|about the body (a cloak)
−
command.
+
|<code>MANIPULATE_WEAR_BACK</code>
 +
|back
 
|-
 
|-
−
|ITEM_STAFF
+
|<code>MANIPULATE_WEAR_ARMS</code>
−
|Items of this type can be used with the '''tap'''
+
|arms
−
command as a magical staff
+
|<code>MANIPULATE_WEAR_WRIST</code>
 +
|wrist (two)
 
|-
 
|-
−
|ITEM_WEAPON
+
|<code>MANIPULATE_WEAR_HANDS</code>
−
|Items of this type are used as weapons.
+
|hands
 +
|<code>MANIPULATE_WEAR_FINGER</code>
 +
|finger (two)
 
|-
 
|-
−
|ITEM_FIREWEAPON
+
|<code>MANIPULATE_WEAR_WAIST</code>
−
|Currently not supported but could be used to classify a special type
+
|waist
−
of weapon.
+
|<code>MANIPULATE_WEAR_LEGS</code>
 +
|legs
 
|-
 
|-
−
|ITEM_MISSILE
+
|<code>MANIPULATE_WEAR_FEET</code>
−
|Currently not supported but could be used to classify a special type
+
|feet
−
of weapon.
+
|<code>MANIPULATE_WEAR_ANKLE</code>
 +
|ankle (two)
 
|-
 
|-
−
|ITEM_TREASURE
+
|<code>MANIPULATE_WEAR_EAR</code>
−
|Items of this type are of some great value to sell but nothing else
+
|ear (two)
−
like a Gem or a block of gold.
+
|<code>MANIPULATE_WEAR_SHIELD</code>
 +
|shield arm
 +
|}
 +
 
 +
:Give an object one wear position; if it has several, <code>wear</code> uses only one of them. Combine it with <code>MANIPULATE_TAKE</code>, and with <code>MANIPULATE_ENTER</code> for a backpack:
 +
 
 +
<pre>
 +
// an earring
 +
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_EAR}
 +
 
 +
// a backpack
 +
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER, MANIPULATE_WEAR_BACK}
 +
</pre>
 +
 
 +
:Whether an item fits depends on its <code>height</code> compared with the wearer's: body armour must be 60% to 140% of the wearer's height, everything else 50% to 150%. Held objects that aren't weapons always fit.
 +
 
 +
;flags
 +
:Unit flags, the same <code>UNIT_FL_*</code> flags rooms and NPCs use. Only <code>UNIT_FL_*</code> constants belong here. vmc only sees numbers, so an object flag written here sets a different unit flag without a word: <code>flags {OBJ_NO_DUAL}</code> makes the object load buried.
 +
 
 +
{| class="wikitable"
 +
|+Unit flags on objects
 +
!Flag
 +
!On an object
 
|-
 
|-
−
|ITEM_ARMOR
+
|<code>UNIT_FL_INVISIBLE</code>
−
|Items of this type can be worn or used as armour.
+
|Only characters who detect invisible can see it.
 
|-
 
|-
−
|ITEM_POTION
+
|<code>UNIT_FL_BURIED</code>
−
|Items of this type can be used with the '''quaff''' as
+
|It loads buried in the ground, hidden until someone digs it up.
−
a position.
 
 
|-
 
|-
−
|ITEM_WORN
+
|<code>UNIT_FL_MAGIC</code>
−
|Items of this type can be worn but not normally used for armour it
+
|It shows a magic aura to characters who detect magic, and can't be resized. The magic macros set it.
−
is more for clothing.
 
 
|-
 
|-
−
|ITEM_OTHER
+
|<code>UNIT_FL_NOSAVE</code>
−
|This item type is for items that don't fit any other type. Now
+
|It isn't saved with a player's inventory. Use it for quest items and keys that must not leave the game.
−
that you can make your own commands with the VME 2.0 you should just make
 
−
your own item type instead of using this value.
 
 
|-
 
|-
−
|ITEM_TRASH
+
|<code>UNIT_FL_TRANS</code>
−
|Items of this type are usually junk or broken equipment.
+
|Transparent: characters inside it (a boat, a cart) see out and are seen.
 
|-
 
|-
−
|ITEM_TRAP
+
|<code>UNIT_FL_NO_TELEPORT</code>
−
|Not currently supported but could be used to make a trap command by
+
|Nobody can teleport into or out of it.
−
creating a trap item
 
 
|-
 
|-
−
|ITEM_CONTAINER
+
|<code>UNIT_FL_SACRED</code>
−
|Items that can be used as containers.
+
|Characters inside it regain hit points, mana and endurance twice as fast.
 
|-
 
|-
−
|ITEM_NOTE
+
|<code>UNIT_FL_NO_WEATHER</code>
−
|Items of this type can be used to write on like paper or
+
|Characters inside it get no weather messages.
−
slates.
 
 
|-
 
|-
−
|ITEM_DRINKCON
+
|<code>UNIT_FL_PRIVATE</code>
−
|Items of this type can carry liquids.
+
|At most two characters can <code>goto</code> into it.
 
|-
 
|-
−
|ITEM_KEY
+
|<code>UNIT_FL_NO_MOB</code>, <code>UNIT_FL_INDOORS</code>, <code>UNIT_FL_NO_BURY</code>
−
|Items of this type can be used as a key.
+
|Room flags; they do nothing on an object.
 +
|}
 +
 
 +
<pre>
 +
manipulate {MANIPULATE_TAKE}
 +
flags {UNIT_FL_NOSAVE}
 +
</pre>
 +
 
 +
;romflags
 +
:Object flags (<code>OBJ_*</code>).
 +
 
 +
{| class="wikitable"
 +
!Flag
 +
!Effect
 
|-
 
|-
−
|ITEM_FOOD
+
|<code>OBJ_NO_DUAL</code>
−
|Items of this type can be eaten
+
|A weapon that can't be held as the second weapon when fighting with two.
 
|-
 
|-
−
|ITEM_MONEY
+
|<code>OBJ_TWO_HANDS</code>
−
|Items of this type can be spent as currency
+
|Read by a few skills that need a free hand. Whether a weapon needs both hands comes from its weapon type, not from this flag.
 
|-
 
|-
−
|ITEM_PEN
+
|<code>OBJ_NO_UNEQUIP</code>
−
|No longer supported but could be used to force people to have a
+
|Meant to make an item impossible to remove, but the <code>remove</code> command doesn't check it. Use <code>CURSED_OBJECT</code> instead.
−
writing instrument before writing a message.
 
 
|-
 
|-
−
|ITEM_BOAT
+
|<code>OBJ_NOCOVER</code>
−
|Items of this type can be used as a water craft
+
|Not used.
 +
|}
 +
 
 +
;weight
 +
:The weight in pounds, 0 to 32767. A character can carry only so much, and a container only its <code>capacity</code>.
 +
 
 +
;height
 +
:The object's size in centimetres. It decides who can wear or wield it (see <code>manipulate</code>). When a reset equips an NPC with the object, the object is resized to fit that NPC.
 +
 
 +
;capacity
 +
:How many pounds of things a container can hold, or how much liquid a drink container holds; -1 means endless (a fountain). Only objects with <code>MANIPULATE_ENTER</code> can have things put into them.
 +
 
 +
;cost
 +
:What the object is worth in a shop. Write the number of coins, then the coin, separated by commas:
 +
 
 +
<pre>
 +
cost 5 GOLD_PIECE
 +
cost 2 SILVER_PIECE, 4 COPPER_PIECE
 +
</pre>
 +
 
 +
:The coins are <code>IRON_PIECE</code>, <code>COPPER_PIECE</code>, <code>SILVER_PIECE</code>, <code>GOLD_PIECE</code> and <code>PLATINUM_PIECE</code>; each is worth eight of the one before. A bare number (<code>cost 25600</code>) and <code>cost 5*GOLD_PIECE</code> are syntax errors, and <code>money</code> is an NPC field, not an object field. An object without a cost is worth nothing.
 +
 
 +
;rent
 +
:What the object costs per real day while its owner is logged off, written like <code>cost</code>. The server charges a percentage of it set by <code>rent</code> in <code>server.cfg</code>; the default configuration has 0, no rent at all.
 +
 
 +
;open
 +
:Lets the object be opened, closed and locked, like a door:
 +
 
 +
{| class="wikitable"
 +
!Flag
 +
!Effect
 
|-
 
|-
−
|ITEM_SPELL
+
|<code>EX_OPEN_CLOSE</code>
−
|Not currently supported but it could be used to make a page in a spell book
+
|It can be opened and closed.
 
|-
 
|-
−
|ITEM_BOOK
+
|<code>EX_CLOSED</code>
−
|Not currently supported but could be used to make
+
|It is closed when it loads.
−
regular and spell books.
 
 
|-
 
|-
−
|ITEM_SHIELD
+
|<code>EX_LOCKED</code>
−
|Items of this type can be used as a shield.
+
|It is locked when it loads.
 
|-
 
|-
−
|ITEM_SKIN
+
|<code>EX_PICKPROOF</code>
−
|Not currently supported in the release but could be used to make the
+
|The lock can't be picked.
−
skin command and create skins of animals
 
 
|-
 
|-
−
|ITEM_BOARD
+
|<code>EX_INSIDE_OPEN</code>
−
|Items of this type are used for public communications in the form
+
|It can be opened and locked from inside (a coffin).
−
of boards that can be read from and written to.
 
 
|}
 
|}
−
Unlike flags and manipulate fields only one item type can be set
 
−
on an object at a time.  The format for the 'type' field is simply the
 
−
keyword followed by the value as follows:
 
−
<nowiki>
 
−
type ITEM_BOARD</nowiki>
 
−
;weight
 
−
: The weight is the weight of the object in pounds.  In the future we may adjust this to allow you to make things lighter for example you could set it in ounces or grams.  Right now however all we have is pounds so we have some pretty heavy feathers out there.
 
  
−
To use this you just enter the 'weight' keyword and then the
+
:<code>difficulty</code> after the flags sets how hard the lock is to pick, 0 to 250. A lock needs a <code>key</code> field: without one, <code>lock</code>, <code>unlock</code> and <code>pick</code> all say there is no keyhole.
−
value.
+
 
−
<nowiki>
+
<pre>
−
/80 lbs.
+
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} difficulty 40
−
weight 80</nowiki>
+
key brass_key
−
;capacity
+
</pre>
−
: This field sets the size of a container object.  If the object does not have the manipulate enter flag set then this field doesn't have to be set.  The capacity is currently by pounds since the weight of objects is set in pounds.  In the future we may take into account size and weight but right now it goes only by weight.  The following line of code would set an item to carry 600 pounds of stuff.
+
 
−
<nowiki>
 
−
capacity 600</nowiki>
 
 
;key
 
;key
−
: The key field sets the key name of the key that will open the item. This field should be set to the symbolic name of the key that opens the item it is on.  If the item is in the same zone as the key then you do not need to put the zone extension on the key name. The following are the three possible examples of using the key field.
+
:The symbolic name of the object that locks and unlocks this one. Write <code>key brass_key</code> for a key in the same zone and <code>key brass_key@otherzone</code> for one in another zone. The player must carry an object with that symbolic name; its type doesn't matter. vmc doesn't check that the key exists.
−
<nowiki>
 
−
//if object and key are in same zone.
 
−
key brasskey
 
  
−
//if key and object are in same zone
+
;bright, light
−
key brasskey@zonename
+
:<code>bright</code> is how much light the object gives off: lying in a room it lights the room, and worn or held it lights the room its wearer is in. <code>bright 2</code> makes a light that never goes out and can't be put out. A torch made with <code>LIGHT_DEF</code> has no <code>bright</code> until someone lights it. <code>light</code> is the light inside the object, for objects players can enter. Both are -6 to 6.
  
−
//if key and object are not in same zone
 
−
key brasskey@otherzonename</nowiki>
 
−
Notice you can put the zone name on it if the key is in the same
 
−
zone but if the key is not in the same zone you must put the zone name
 
−
on it.
 
−
;cost
 
−
: This is the field you set to add a cost to your object.  If you leave this field out it will default to no cost and will not be able to be sold at stores.  The system for setting cost on an item is the same as setting money on a NPC.  As with a NPC we could set it using a single number but it would not be easy to understand.  For example 5 gold pieces would be something like:
 
−
<nowiki>
 
−
money 25600</nowiki>
 
−
I am no more sure this will make five gold pieces than I was when
 
−
I used this same example with the money field in NPC.  The problem is I
 
−
just did the math in my head so its not very accurate.  It is much
 
−
easier to use the defined money types to set exactly what you want as
 
−
follows:
 
−
<nowiki>
 
−
IRON_PIECE
 
−
COPPER_PIECE
 
−
SILVER_PIECE
 
−
GOLD_PIECE
 
−
PLATINUM_PIECE</nowiki>
 
−
Now if we wanted to make an object costing five gold it would be as
 
−
simple as this:
 
−
<nowiki>
 
−
money 5*GOLD_PIECE</nowiki>
 
−
the define method also gains you the ability to tell the VME what
 
−
amount of each coin you want on the NPC.  If you set it using a single
 
−
integer the compiler would pick how many of each coin.  This of course
 
−
is not what is desired in fact you want to be able to set your cost
 
−
however you like.  So setting more than one coin is as simple as adding
 
−
a comma between the first and second coin.
 
−
<nowiki>
 
−
money 5*GOLD_PIECE, 20*IRON_PIECE</nowiki>
 
−
;rent
 
−
: This field tells how much it costs you to keep an item while your offline.  The rent is not always taken if the VME server is set up to not take any rent then it will not matter if you set this or not.  Also the VME can be set up to take a percentage of this field so it may not take the exact amount you et.  If the VME server is set up to take 100%
 
−
of the rent then what you set will be taken.  To set this field you do
 
−
the same as you do with the cost field.
 
−
<nowiki>
 
−
money 5*GOLD_PIECE, 20*IRON_PIECE</nowiki>
 
 
;minv
 
;minv
−
: This field is the administrator invisible level of the object it is set on.  This means that if you set the 'minv' to two hundred it will make it so the object can not be seen by anyone below the administrator level of two hundred.  This is good for hiding objects that you need for administrators but you don't want players to see.
+
:The administrator invisibility level: only administrators of at least this level can see the object. Use it for objects that run DIL programs and should not be seen by players.
−
In order for the 'minv' to be removed an
+
 
−
administrator or a DIL function must change it.
+
<pre>
−
<nowiki>
+
minv 239
−
minv 239</nowiki>
+
</pre>
 +
 
 
;alignment
 
;alignment
−
: The object alignment is not currently used.  It is an integer value that can be set on an object to be used with any DIL functions.
+
:A number from -1000 to 1000. No command uses an object's alignment, but DIL programs can read it.
−
In the future it will be what determines if a good or evil person can
 
−
wield an item.  The value is set by placing the 'alignment' keyword
 
−
first followed by the alignment desired from -1000 to +1000.
 
−
<nowiki>
 
−
alignment -250</nowiki>
 
−
;open
 
−
: The open field is used if you want to give your object the ability to be opened, closed, and or locked.  If you add the open flags you need to also add a key field which has already been explained.
 
−
The following are all
 
−
the possible open flags and what they are used for.
 
  
−
;EX_OPEN_CLOSE
+
;spell
−
: Set this if you can open and close this object.
+
:The object's magic resistance, 0 to 255: how well it resists spells cast on it. For potions, scrolls, wands and staffs, <code>value[0]</code> (the spell power) is used instead.
−
;EX_CLOSED
 
−
: Set this if you want the object to be closed when loaded.
 
−
;EX_LOCKED
 
−
: Set this if you want the object to be locked when loaded.
 
−
<blockquote style="background-color: #E8E8E8; font-style: italic; ">
 
−
An interesting aspect is that if you do not specify a key, you can
 
−
    only unlock this door with the 'pick' skill, 'unlock' spell or from
 
−
    DIL with UnSet();
 
−
</blockquote>
 
−
;EX_PICK_PROOF
 
−
: Using this flag renders the 'pick' skill and 'unlock' spell un useable on the lock of this object.
 
−
;EX_INSIDE_OPEN
 
−
: Usable on container objects only, this enables the mobile to 'open' and
 
−
    'lock' from the inside.
 
  
−
The simplest use of this field is to make an object that opens
 
−
and closes.  A coffin for example would have its flags set as
 
−
follows:
 
−
<nowiki>
 
−
open {EX_OPEN_CLOSE}</nowiki>
 
−
If you wanted to set an object that is locked and closed and
 
−
having a brass key that can open it, when it is loaded.  It would look as follows.
 
−
<nowiki>
 
−
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
 
−
key brass_key</nowiki>
 
−
You would have to define the key in the object section as well and
 
−
the symbolic name for that key would be 'brass_key'
 
−
;spell
 
−
: The spell field is the power of the objects defense against spells.  You can set it from zero which is just not setting the field all the way to 200% which means a person who has 100% in a spell will fail almost all the time.  To set this field it would look as follows:
 
−
<nowiki>
 
−
//Spell resistance at 150%
 
−
spell 150</nowiki>
 
 
;value
 
;value
−
: The object values are used for just about any special item from armour to drink containers. They should not be set directly unless you have a reason to do so, like a special DIL command that checks a value on an item. You also have to be carefull not to over write what a value is already used for example value one is already used on weapons and armours for craftsman ship that will be explained later in
+
:Five numbers, <code>value[0]</code> to <code>value[4]</code>, whose meaning depends on the type: for a weapon they are the weapon type, craftsmanship, magic bonus and slaying race. Let the macros set them unless a DIL program of your own needs a value. [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]] lists what each type keeps in them.
−
(Link to objmacros).
+
 
 +
<pre>
 +
value[0] 5
 +
value[4] 12
 +
</pre>
  
−
If you find you need to set the values there are a total of five
 
−
of them and they can be set to any integer value as follows:
 
−
<nowiki>
 
−
  value[0]  5
 
−
  value[1] 16
 
−
  value[2] -2
 
−
  value[3] -10
 
−
  value[4] 12</nowiki>
 
 
;affect
 
;affect
−
: The affect field should not be set directly, instead you should use the macros defined in (Link to objmacros).
+
:Bonuses and penalties the object gives its wearer, and curses. Don't write <code>affect</code> blocks yourself: vmc checks them and refuses anything the game doesn't know. Use the transfer macros and <code>CURSED_OBJECT</code> on [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]].
−
;dilbegin or dilcopy
 
−
: As has been mentioned in previous sections the DIL functions are what give VME servers the edge over all other muds.
 
−
We will only give some examples here and leave it up to the DIL manual to teach
 
−
you how to create your own functions that will make your rooms, NPC, and
 
−
objects more than special.
 
−
 
 
−
There are several object functions that come standard with the VME
 
−
2.0.  The following is a list of those functions.
 
−
* Guild restrict
 
−
* Anti-guild restrict
 
−
* Quest restrict
 
−
* Quests restrict
 
−
* Alignment restrict
 
−
* Level restrict
 
−
* Virtual level restrict
 
−
* Race restrict
 
−
* Ability restrict
 
−
* Skill restrict
 
−
* Spell restrict
 
−
* Weapon restrict
 
−
* Gender restrict
 
−
* Player restrict
 
−
* boards
 
−
* tuborg/dilbegin
 
−
These are the only object functions currently documented in the VME
 
−
2.0 release but if you go through the zones that are released with the
 
−
VME you are sure to find many more.  Hopefully with the descriptions in
 
−
(Link to objdilfunc).  You will be able to use the functions
 
−
listed here and figure out ones that are not.
 
−
 
 
−
Since these are just DIL's written by builders for the
 
−
Valhalla mud all you have to do is use the dilcopy keyword in the
 
−
NPC with the function name you want to use and the arguments that
 
−
function requires.  The following is what you would find in the
 
−
''function.zon'' for tuborgs.
 
−
<nowiki>
 
−
dilbegin tuborg(s:string);
 
−
external
 
−
sub_drink_info@commands(d:unitptr);
 
−
var
 
−
  u : unitptr;
 
−
code
 
−
{
 
−
  :start:
 
−
  wait(SFB_CMD, ( (command("drink")) or
 
−
                (command("sip")) or
 
−
  (command("taste")) ) );
 
−
u := activator;
 
−
secure (u,start);
 
−
if (findunit (activator,argument,FIND_UNIT_INVEN|FIND_UNIT_SURRO,null)!=self)
 
−
goto start;
 
−
if ( command("sip") or command("taste") )
 
−
{
 
−
  block;
 
−
  act("$1n tastes $2n enjoying every drop.", A_HIDEINV, u, self, null,
 
−
        TO_ROOM);
 
−
    act("The taste of the $2N is nothing less than divine.", A_HIDEINV, u, self,
 
−
    null, TO_CHAR);
 
−
  goto start;
 
−
  }
 
  
−
if ( u.thirst >20 )
+
;dilcopy, dilbegin
−
{
+
:DIL programs on the object. <code>dilcopy</code> runs a template from another zone with arguments; <code>vme/zone/function.zon</code> has many made for objects, such as restrictions on who can use an item:
−
  block;
 
−
act("Your not thirsty.", A_HIDEINV, u, null, null, TO_CHAR);
 
−
    goto start;
 
−
}
 
−
block;
 
−
  act ("You drink $2n and it makes you feel more energetic!", A_HIDEINV, u, self,
 
−
      null, TO_CHAR);
 
−
  act ("$1n drinks $2n and looks more energetic!", A_HIDEINV, u, self,
 
−
      null, TO_ROOM);
 
  
−
u.thirst := u.thirst + 10;
+
<pre>
−
u.full := u.full + 10;
+
dilcopy level_restrict@function(10, 0, 25, "");
−
if (u.thirst > 24)
+
</pre>
−
{
 
−
  u.thirst := 24;
 
−
}
 
  
−
if (u.full > 24)
+
:[[Manual:Zone Manual/The Objects Section/DIL functions for objects|DIL functions for objects]] describes them, and [[Manual:Zone Manual/The Objects Section/More complex objects|More complex objects]] puts some to work. vmc doesn't check a template's name or arguments; read the template's <code>dilbegin</code> line in its zone before you use it. How to write DIL of your own is in the [[Manual:DIL Manual|DIL manual]].
−
{
 
−
  u.full := 24;
 
−
}
 
−
u.endurance := u.endurance+50;
 
−
if (u.endurance > u.max_endurance)
 
−
{
 
−
  u.endurance := u.max_endurance;
 
−
}
 
−
sub_drink_info@commands(self);
 
−
quit;
 
−
}
 
−
dilend</nowiki>
 
−
If this DIL function scares you don't worry you don't have to
 
−
understand it or adjust it you only have to use it.  In fact this is a
 
−
really easy DIL to use. The argument on the tuborg function is not used
 
−
yet so all you have to do is pass in a blank string or any string for
 
−
that matter.  So if you wanted to make a tuborg in the game you would
 
−
just add this to your drink container.
 
−
<nowiki>
 
−
dilcopy tuborg@function ("");</nowiki>
 
−
All of the above listed DIL object functions are described in
 
−
(Link to objdilfunc).
 
−
Then we put some to work so you can see how
 
−
to use them in (Link to objcomplex)
 
  
−
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/The_NPC_Section/Suggested_NPC_exercises|Previous: Suggested NPC exercises]]</div>
+
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone Manual/The NPC Section/Suggested NPC exercises|Previous: Suggested NPC exercises]]</div>
−
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/The_Objects_Section/Object_macros|Next: Object macros]]</div>
+
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone Manual/The Objects Section/Object macros|Next: Object macros]]</div>

Latest revision as of 06:18, 15 November 2026

The objects section

With rooms and NPCs alone you could build a world of naked people fighting with their bare hands. Objects fill it with everything else: weapons and armour for the NPCs, food and drink, keys, chests, boats and the junk lying about in the rooms.

Objects go in the %objects section of a zone file. Like rooms and NPCs, each object is a symbolic name, then its fields in any order, then end:

%objects

big_rock
names {"big rock", "rock"}
title "a big rock"
descr "A big rock is lying in the road."
manipulate {MANIPULATE_TAKE}
weight 40
end

This page lists the fields an object can have and what each one does in the game. Object macros shows the macros that set up weapons, armour, containers, drinks and the other kinds of objects; Building your first object walks through a complete object.

Object fields

Field Value Default What it is
names string list none The words players use to act on the object.
title string none The short name: "a big rock".
descr string none What players see when the object lies in a room.
inside_descr string none What players see when they are inside the object (a coffin, a boat).
extra string list, string none Descriptions to look at, special messages, and data for DIL.
type ITEM_* ITEM_OTHER The kind of object. Usually set by a macro.
manipulate MANIPULATE_* flags none Whether it can be taken, entered, worn (and where), wielded or held.
flags UNIT_FL_* flags none Unit flags: invisible, buried, magic, not saved...
romflags OBJ_* flags none Object flags.
weight number 1 Weight in pounds, 0 to 32767.
height number 180 Size in centimetres; decides who it fits.
capacity number 0 How many pounds it can hold, -1 to 32767 (-1 is endless).
value[0] .. value[4] number 0 Five numbers whose meaning depends on the type. Usually set by a macro.
cost money 0 What it is worth in a shop.
rent money 0 What it costs per day to keep it while logged off.
open EX_* flags none Whether it opens, closes and locks. May be followed by difficulty n.
key symbolic name none The object that locks and unlocks it.
bright -6 to 6 0 How much light it gives off.
light -6 to 6 0 Light inside the object.
minv number 0 Administrator invisibility level.
alignment -1000 to 1000 0 Stored, but nothing in the game reads an object's alignment.
spell 0 to 255 0 Magic resistance.
dilcopy, dilbegin DIL none Scripts that run on the object.
affect affect block none Bonuses and curses. Use the macros, never write it yourself.

Fields can come in any order. manipulate, flags, romflags and open add up when you give them more than once; every other field keeps the last value it was given. A macro such as WEAPON_DEF sets type, value[] and other fields, so put the macro first and change things after it.

Flags are written in braces and separated by commas: manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}. A single flag needs no braces. Numbers may be sums such as 2*12+1.

All the constants on this page come from vme/include/vme.h and values.h; start your zone with #include <macros.h>, which includes them.

Description of the object fields

symbolic name
The name the object is known by in the zone, such as dragon_head. Administrators use it to load and wstat the object, and other fields (key) and the resets refer to it. Use a name that matches the title so it is easy to find. The rules for symbols are in Unit Building Blocks: letters, digits and _, at most 15 characters, unique among the rooms, objects and NPCs of the zone.
title
What the game shows when the object is picked up, dropped, given, listed in an inventory or used in a fight. Start it in lower case with an article, and don't end it with punctuation: vmc warns about a title that ends in something other than a letter, and about one that starts with a capitalised word such as "The".
title "a big rock"
title "the flame tongue"
title "an oval hover car"
descr
What players see when the object lies in the room they are in, or when they look around. One line is usually enough.
descr "A green bloody sword is lying here."
descr "A massive round wooden table stands here."
names
The words players type to pick the object up, drop it, look at it and so on. Every word a player might use from the title and the description should be in the list, and nothing that isn't. Put longer names first: vmc refuses a list where a name starts with an earlier one ("rock" before "big rock"). A name can't end in 's or start with self.
title "an old twisted staff"
descr "An old twisted staff has been thrown away here."
names {"old twisted staff", "twisted staff", "old staff", "staff"}
On a drink container the last name must be the liquid, as in {"waterskin", "skin", "water"}: when the container is drunk empty, the game removes the last name.
inside_descr
What players see when they are inside the object, for objects that can be entered (a coffin, a boat). It can be several lines long, like a room description.
inside_descr
"You are inside a black coffin with red velvet padding. Scary!"
extra
Extra descriptions. An extra with an empty name list is what players see when they look at the object:
extra {}
"The ice cube is about 40 meters on each side. It seems to be melting
slightly, but waiting for it to finish would be like waiting for the
ice age to end."
An extra with names describes a part of the object, for look at crack:
extra {"crack"}
"There is a big crack in the side of the ice cube."
Extras whose name starts with $ are not for players to look at. Some of them replace the game's standard messages when something is done to the object. In them $1n is the character who does it and $2n the object; the codes are explained under act().
Message extras
Extra Replaces the message...
$get_s / $get_o to the character / to the others in the room, when it is picked up from the floor
$drop_s / $drop_o when it is dropped
$wear_s / $wear_o when it is worn, wielded or held
$rem_s / $rem_o when it is removed
$enter_s / $enter_o when someone enters it
$exit_s / $exit_o when someone leaves it
extra {"$get_s"}
"You pick up $2n. It is very cold and starts to melt in your hands."

extra {"$get_o"}
"$1n picks up $2n. A drop of water hits the ground."
Other $ extras hold data: $identify is shown by the identify spell, the MATERIAL_* macros write $material, the drink macros write $drink_color and friends, and DIL programs keep their own. The extra must start with $: extra {"drop_o"} is just a description of a part called "drop_o".
type
The kind of object, one of the ITEM_* constants. Only one type can be set. The macros on Object macros set it for you, together with the values that type needs.
Item types
Type Used by the game
ITEM_WEAPON A weapon to wield. WEAPON_DEF.
ITEM_ARMOR Armour. ARMOUR_DEF and the ARMOUR_* macros.
ITEM_SHIELD A shield. SHIELD_DEF.
ITEM_WORN Clothes and jewellery that give no protection.
ITEM_CONTAINER Things to put things in. CONTAINER_DEF.
ITEM_DRINKCON A drink container for drink and pour. LIQ_DEF and the liquid macros.
ITEM_FOOD Food for eat. FOOD_DEF.
ITEM_LIGHT A torch or lantern for light and extinguish. LIGHT_DEF.
ITEM_MONEY Coins. MONEY.
ITEM_POTION A potion for quaff. POTION_DEF.
ITEM_SCROLL A scroll for recite. SCROLL_DEF.
ITEM_WAND, ITEM_STAFF Held and used with use. WAND_DEF, STAFF_DEF.
ITEM_FIREWEAPON A bow, crossbow or sling for shoot. RANGED_DEF.
ITEM_TRAP A trap for the trap skill. TRAP_DEF.
ITEM_NOTE Paper to write on, and to post on boards or send as mail.
ITEM_BOARD A bulletin board (see vme/zone/boards.zon).
ITEM_BOAT Something to enter and sail over water.
ITEM_KEY A key. A lock only checks the key's symbolic name, so the type is just for shops and players.
ITEM_TREASURE Gems and other valuables, worth only their price.
ITEM_TRASH Junk. Broken weapons and armour become trash.
ITEM_OTHER Anything else. The default.
ITEM_MISSILE, ITEM_PEN, ITEM_SPELL, ITEM_BOOK, ITEM_SKIN Defined, but no command treats them specially. Arrows are ITEM_WEAPON (MISSILE_DEF).
You can give your own DIL commands their own meaning for a type, but the built-in commands only know the ones above.
manipulate
What can be done with the object. MANIPULATE_TAKE lets it be picked up: without it the object can't be taken at all, which is right for a fountain or a statue. MANIPULATE_ENTER lets players put things into it, and enter it if it is big enough (a coffin, a boat). The rest say where it is used:
Flag Position Flag Position
MANIPULATE_WIELD wielded as a weapon MANIPULATE_HOLD held in the hand
MANIPULATE_WEAR_HEAD head MANIPULATE_WEAR_NECK neck (two)
MANIPULATE_WEAR_BODY body MANIPULATE_WEAR_CHEST across the chest (a baldric)
MANIPULATE_WEAR_ABOUT about the body (a cloak) MANIPULATE_WEAR_BACK back
MANIPULATE_WEAR_ARMS arms MANIPULATE_WEAR_WRIST wrist (two)
MANIPULATE_WEAR_HANDS hands MANIPULATE_WEAR_FINGER finger (two)
MANIPULATE_WEAR_WAIST waist MANIPULATE_WEAR_LEGS legs
MANIPULATE_WEAR_FEET feet MANIPULATE_WEAR_ANKLE ankle (two)
MANIPULATE_WEAR_EAR ear (two) MANIPULATE_WEAR_SHIELD shield arm
Give an object one wear position; if it has several, wear uses only one of them. Combine it with MANIPULATE_TAKE, and with MANIPULATE_ENTER for a backpack:
// an earring
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_EAR}

// a backpack
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER, MANIPULATE_WEAR_BACK}
Whether an item fits depends on its height compared with the wearer's: body armour must be 60% to 140% of the wearer's height, everything else 50% to 150%. Held objects that aren't weapons always fit.
flags
Unit flags, the same UNIT_FL_* flags rooms and NPCs use. Only UNIT_FL_* constants belong here. vmc only sees numbers, so an object flag written here sets a different unit flag without a word: flags {OBJ_NO_DUAL} makes the object load buried.
Unit flags on objects
Flag On an object
UNIT_FL_INVISIBLE Only characters who detect invisible can see it.
UNIT_FL_BURIED It loads buried in the ground, hidden until someone digs it up.
UNIT_FL_MAGIC It shows a magic aura to characters who detect magic, and can't be resized. The magic macros set it.
UNIT_FL_NOSAVE It isn't saved with a player's inventory. Use it for quest items and keys that must not leave the game.
UNIT_FL_TRANS Transparent: characters inside it (a boat, a cart) see out and are seen.
UNIT_FL_NO_TELEPORT Nobody can teleport into or out of it.
UNIT_FL_SACRED Characters inside it regain hit points, mana and endurance twice as fast.
UNIT_FL_NO_WEATHER Characters inside it get no weather messages.
UNIT_FL_PRIVATE At most two characters can goto into it.
UNIT_FL_NO_MOB, UNIT_FL_INDOORS, UNIT_FL_NO_BURY Room flags; they do nothing on an object.
manipulate {MANIPULATE_TAKE}
flags {UNIT_FL_NOSAVE}
romflags
Object flags (OBJ_*).
Flag Effect
OBJ_NO_DUAL A weapon that can't be held as the second weapon when fighting with two.
OBJ_TWO_HANDS Read by a few skills that need a free hand. Whether a weapon needs both hands comes from its weapon type, not from this flag.
OBJ_NO_UNEQUIP Meant to make an item impossible to remove, but the remove command doesn't check it. Use CURSED_OBJECT instead.
OBJ_NOCOVER Not used.
weight
The weight in pounds, 0 to 32767. A character can carry only so much, and a container only its capacity.
height
The object's size in centimetres. It decides who can wear or wield it (see manipulate). When a reset equips an NPC with the object, the object is resized to fit that NPC.
capacity
How many pounds of things a container can hold, or how much liquid a drink container holds; -1 means endless (a fountain). Only objects with MANIPULATE_ENTER can have things put into them.
cost
What the object is worth in a shop. Write the number of coins, then the coin, separated by commas:
cost 5 GOLD_PIECE
cost 2 SILVER_PIECE, 4 COPPER_PIECE
The coins are IRON_PIECE, COPPER_PIECE, SILVER_PIECE, GOLD_PIECE and PLATINUM_PIECE; each is worth eight of the one before. A bare number (cost 25600) and cost 5*GOLD_PIECE are syntax errors, and money is an NPC field, not an object field. An object without a cost is worth nothing.
rent
What the object costs per real day while its owner is logged off, written like cost. The server charges a percentage of it set by rent in server.cfg; the default configuration has 0, no rent at all.
open
Lets the object be opened, closed and locked, like a door:
Flag Effect
EX_OPEN_CLOSE It can be opened and closed.
EX_CLOSED It is closed when it loads.
EX_LOCKED It is locked when it loads.
EX_PICKPROOF The lock can't be picked.
EX_INSIDE_OPEN It can be opened and locked from inside (a coffin).
difficulty after the flags sets how hard the lock is to pick, 0 to 250. A lock needs a key field: without one, lock, unlock and pick all say there is no keyhole.
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} difficulty 40
key brass_key
key
The symbolic name of the object that locks and unlocks this one. Write key brass_key for a key in the same zone and key brass_key@otherzone for one in another zone. The player must carry an object with that symbolic name; its type doesn't matter. vmc doesn't check that the key exists.
bright, light
bright is how much light the object gives off: lying in a room it lights the room, and worn or held it lights the room its wearer is in. bright 2 makes a light that never goes out and can't be put out. A torch made with LIGHT_DEF has no bright until someone lights it. light is the light inside the object, for objects players can enter. Both are -6 to 6.
minv
The administrator invisibility level: only administrators of at least this level can see the object. Use it for objects that run DIL programs and should not be seen by players.
minv 239
alignment
A number from -1000 to 1000. No command uses an object's alignment, but DIL programs can read it.
spell
The object's magic resistance, 0 to 255: how well it resists spells cast on it. For potions, scrolls, wands and staffs, value[0] (the spell power) is used instead.
value
Five numbers, value[0] to value[4], whose meaning depends on the type: for a weapon they are the weapon type, craftsmanship, magic bonus and slaying race. Let the macros set them unless a DIL program of your own needs a value. Object macros lists what each type keeps in them.
value[0] 5
value[4] 12
affect
Bonuses and penalties the object gives its wearer, and curses. Don't write affect blocks yourself: vmc checks them and refuses anything the game doesn't know. Use the transfer macros and CURSED_OBJECT on Object macros.
dilcopy, dilbegin
DIL programs on the object. dilcopy runs a template from another zone with arguments; vme/zone/function.zon has many made for objects, such as restrictions on who can use an item:
dilcopy level_restrict@function(10, 0, 25, "");
DIL functions for objects describes them, and More complex objects puts some to work. vmc doesn't check a template's name or arguments; read the template's dilbegin line in its zone before you use it. How to write DIL of your own is in the DIL manual.
Previous: Suggested NPC exercises
Next: Object macros