Limit Functions for Mocha


Limits for an existing entity

The MUD keeps track of the number of objects and mobiles of any given type in the game, stored in rent, and in existence (the sum of the previous two numbers). It also tries to figure out how many of any given item are allowed to exist, but such numbers should not be used as anything more than a hint. The following functions allow Mocha to access these values:

integer ent.num_in_game;
Returns the number of entities in the game with the same virtual number as the entity ent. Always returns the value 1 for rooms.

integer obj.num_in_rent;
Returns the number of objects stored in rent with the same virtual number as the object obj.

integer num_existing (entity ent);
Returns the number of entities in the game with the same virtual number as the entity ent. Always returns the value 1 for rooms.

integer num_allowed (entity ent);
Returns a hint about the allowed maximum number of entities with the same virtual number as the entity ent. Always returns the value 1 for rooms. The value anything is returned for unlimited entities.


Limits using virtual numbers

If a handler wants to check a value before actually creating an object, it should use one of the following functions:

integer num_objects_in_game (integer vnum);
Returns the number of objects with the virtual number vnum currently in the game.

integer num_objects_in_rent (integer vnum);
Returns the number of objects with the virtual number vnum currently stored away in rent.

integer num_objects_existing (integer vnum);
Returns the number of objects with the virtual number vnum currently in existence (the sum of such objects in the game and in rent).

integer num_objects_allowed (integer vnum);
Returns a hint at the limit on the number of objects with the virtual number vnum in existence. The value anything indicates that the object is unlimited.

integer num_mobiles_in_game (integer vnum);
Returns the number of mobiles with the virtual number vnum currently in the game.

integer num_mobiles_existing (integer vnum);
Returns the number of mobiles with the virtual number vnum currently in existence.

integer num_mobiles_allowed (integer vnum);
Returns a hint at the limit on the number of mobiles with the virtual number vnum in existence. The value anything indicates that the mobile is unlimited.


Return to Mocha Object Functions Page

Return to Mocha's Main Page