Manual:DIL Manual/acc balance

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 22:59, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

acc_balance

Field (integer, read-only; units: PC).

pc.acc_balance : integer

The credit left on the player's account, in coin units (cents: 100 is one unit of money), when the game runs with accounting (accounting = 1 in server.cfg). Any fraction of a coin unit is cut off.

Notes

  • With accounting off (the default) it is always 0.
  • Players only. On an NPC, an object, a room or null the field fails.
  • It can't be assigned (vmc: "Illegal lvalue"). Change the account with acc_modify(), which only works from a zone with access level 0.

Example

dilbegin show_account(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   sendtext("Balance: " + itoa(pc.acc_balance / 100) + " (" +
            itoa(pc.acc_balance) + " cents), paid in so far: " +
            itoa(pc.acc_total) + " cents.<br/>", pc);
}
dilend

Shows a player the account's balance and total.

See also