Here i will try to document some subroutines usefull on writing code for items
and NPCs. The code has many comments, so when in doubt Read The Code.

Writing such code also needs a knowledge of the data structures. Again, Read 
The Code, especially MudaServer.pl where data structures are defined and the
data load routines in Ms_Cons_Subs.pm. 

Existing item and NPC code should also be helpfull.

&logPrint(<message>): Prints <message> in server's STDOUT. This should not be 
	used for debugging. Use standard print commands for that.

&clientTell(<cmqid>, <username>, <cpid>, <message>): Sends message to the user 
	with client process id <pid>, named <username> and using the message
	queue <cmqid>. You should be carefull to use this sub only when you are
	sure that recipient is a real user and not an NPC. Use &userTell (see
	below) if not sure about the type of recipient. &clientTell is the 
	main way to send a message to a client.

&userTell(<cmqid>, <username>, <cpid>, <cuid>, <message>): Sends message to the
	user with user id <cuid>. If user is a real user, works like 
	&clientTell. If user is an NPC, calls __INFO.

&npcTell(<c_pid>, <uid>, <npcCmd>{, <args>}): "Tells" something to an NPC. This 
	is actually a way to call the code of programmable NPCs. c_pid is the 
	process id of the user that initiated the command. It may not be 
	specified, in which case the value -1 should be used. uid is NPC's uid.
	npcCmd is the subcommand that should be called in NPC's code. These 
	commands are standard and every NPC should be able to handle them, even
	by just returning. These commands are: 
	__INFO: General info (stuff happening in the room). 
		<args> contains text.
	__LOOKEDAT: Somebody looked to the NPC, or examine an item on it.
		<args> is not used.
	__ATTACK: Somebody attacked the NPC.
		<args> is not used.
	__GIVEN: Somebody gave something to the NPC.
		<args> contains the item id (unique).
		Special case: When <args> looks like 'COINS<num>', somebody
		gave coins to NPC. No item and item id here.
	__TOLD: Somebody said something (through TELL or WHISPER) to the NPC.
		<args> contains the actual message.
	__AMB: Somebody used an ambience command on the NPC.
		<args> contains the actual action, capitalized.
	
	Returns undef for failure, 0 if NPC did nothing, 1 if NPC did something.

&tellAllUsers(<msg>): Sends message to all logged in users (used by SHOUT). 

&clientPrintLong(<cmqid>, <username>, <pid>, <line>): like &clientTell, but
	formats <line> in a justified paragraph. Used to print long room 
	descriptions in LOOK command.

&informRoom(<roomNum>, <excludeUid1>, <msg>{, <excludeUid2}): Sends <msg> to all
	users (players and NPCs) in room #<roomNum>, except users with 
	<excludeUid1> and <excludeUid2>. <excludeUid2> is optional, 
	<excludeUid1> will be ignored when <0.  Programmable NPCs will be called
	with __INFO subcommand (see &npcTell).  Item code of room's items is 
	also called, with __INFORM subcommand.

&movePlayer(<uid>, <newRoomNum>): Move player (user or NPC) with <uid> from its
	current room to <newRoomNum>. No informational messages here, so this 
	can be used in any case. Also, no validity checks, so be carefull. 

&intPid2Details(<pid>): Returns an array consisting of username, uid, cmqid, 
	roomNum and gender of the player with <pid>. Cannot be used on NPCs, 
	because pid is always negative and not unique.

&intUid2Details(<uid>): Returns an array consisting of username, pid, cmqid, 
	roomNum and gender of the player with <uid>. This can be used on NPCs, 
	as uids are unique.

&intCreateItemFromProto(<pid|roomNum>, <piid>, <isUser>): Creates a new item
	using prototype with id <piid>. If <isUser>, <pid> is user's pid and 
	item is created in user's inventory. If not <isUser>, <pid> is roomNum 
	and item is created in this room. Don't use this from NPCs with 
	<isUser>. Create first in room and then put item in NPCs inventory if 
	needed.

&intDestroyItem(<itemId>): Destroys an item. The item is completely removed, no
	matter if it is in a room or on a player. No informational messages are
	sent.

&intCmpUid2name(<uid>, <string>): Compares <string> to <uid> username. Returns
	1 on match, 0 otherwise. Matching is full (case insensitive) for 
	players, but partial on NPCs.

&randomWalk(<roomNum>, <uid>, <username>): Randomly moves NPC with <uid> and 
	<username>. <roomNum> is NPC's current room. If walk_list is defined 
	in NPC's prototype, will only move in these rooms. If walk_list is 
	defined and NPC is found somewhere else, it's magically teleported in 
	a valid room. Returns final position of NPC.

&intTell(<pid|uid>, <subcmd>, <target>, <message>, <npc>): The subroutine used
	by whisper and tell commands. Can be used in NPC code. Use <npc>=1 and 
	<uid> as first argument when calling from NPC code. <subcmd> can be 
	either 'WHISPER' or 'TELL'. <target> is a username. <message> is the 
	message to be sent. If <target> is not present, will fail. Returns 1 
	for success and 0 for failure.

&intCreateMoney(<roomNum>, <amount>): Create a special "coins" item in that 
	room, with value <amount>. The description of the item is set to 
	"<amount> gold coins". When picked up by a user, the item 
	self-destructs and the amount is added in user's coins field.
