Manual:DIL Manual/cost

From DikuMUD Wiki
Jump to navigation Jump to search

cost

Field (integer, read/write; units: objects).

obj.cost : integer

What the object is worth, in the money's base unit (an iron piece is IRON_MULT, 10; a gold piece GOLD_MULT; vme.h). It is the cost line of the object in the zone file, given there as coins, e.g. cost 2 GOLD_PIECE. moneystring() turns it into text.

For a pile of coins (ITEM_MONEY) it is the number of coins in the pile instead: the commands that split and merge money in baseget.zon use it that way.

Notes

  • Objects only. On a character, a room or null it fails.
  • Stored unsigned: don't assign a negative number.

Example

dilbegin string price_of(item : unitptr);
code
{
   if (item.type != UNIT_ST_OBJ)
      return ("");
   return (moneystring(item.cost, TRUE));
}
dilend

The price of an item as text.

See also