[function createitem]
IF (<DEF0.<ARGV[0]>>)
LOCAL.OLDNEW=<NEW>
	IF (0<ARGV[1]>)
	LOCAL.AMOUNT=<ARGV[1]>
	ELSE
	LOCAL.AMOUNT=1
	ENDIF
	WHILE (<LOCAL.AMOUNT>) && (<LOCAL._WHILE> < 5000)
	SERV.NEWITEM=<ARGV[0]>
		IF (<SERV.ITEMDEF.<ARGV[0]>.CAN>&CAN_I_PILE)
			IF (<LOCAL.AMOUNT> > 64999)
			NEW.AMOUNT=65000
			ELSE
			NEW.AMOUNT=<LOCAL.AMOUNT>
			ENDIF
		ENDIF
	LOCAL.AMOUNT -= <NEW.AMOUNT>
		IF (0<ARGV[2]>)
		NEW.CONT=<ARGV[2]>
		ELSE
		BOUNCE <NEW>
		ENDIF
	ENDWHILE
NEW=<LOCAL.OLDNEW>
ENDIF

[EOF]