Manual:DIL Manual/acc modify()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:17, 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_modify()

Procedure. Pays money into a player's account or takes it out.

acc_modify(pc : unitptr, amount : integer)

Only does something when the game runs with accounting (accounting = 1 in server.cfg; it is off by default). A positive amount is paid in: the balance (acc_balance) and the total paid in (acc_total) go up. A negative one is taken out: both go down, the total no further than 0. Amounts are in cents: 100 is one unit of money.

Every change is written to vme.log ("... inserted 100 on account ...") and to the account log, account.log in the log directory, under the name of the unit running the program.

Only a program started in a zone with access level 0 (the fourth column of vme/etc/zonelist) can use it. What counts is the zone of the program's first template, the one that was dilcopy'd or run as a command. Elsewhere the zone log gets "attempt to violate system access security (amod)" and the program stops.

Parameters

Name Type Meaning
pc unitptr The player.
amount integer Cents to pay in (positive) or take out (negative).

Notes

  • Nothing happens with accounting off, for a unit that isn't a player, or for null; in those cases there is no access check either. An amount of 0 changes nothing.
  • Nothing in the game uses it today.

Example

dilbegin give_credit(pc : unitptr, cents : integer);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   acc_modify(pc, cents);
   sendtext("Your account now holds " + itoa(pc.acc_balance) + " cents.<br/>", pc);
}
dilend

Pays an amount into a player's account and tells the player the new balance.

See also