;'Regulus Scroll buying' userdialog script

ScrollCost = 25000
ScrollID = 207

If #RESULT = 1
	If GetUserSilver(#USERID) < ScrollCost
		SendMessageToUser(#USERID,"You don't have enough silver!",#MSG_CRITICAL)
	Else
		SetUserSilver(#USERID,GetUserSilver(#USERID)-ScrollCost)
		SendMessageToUser(#USERID,"You now have "+GetUserSilver(#USERID)+" silver.",#MSG_TELL)
		SendMessageToUser(#USERID,"Regulus says, 'A pleasure doing business with you, "+GetUserName(#USERID)+".'",#MSG_SAY)
		If IsInvFull(#USERID) = 0
			GiveItem(#USERID,ScrollID)
		Else
			SendMessageToUser(#USERID,"Your inventory is full! The scroll is on the ground.",#MSG_CRITICAL)
			SpawnItem(#MAPID,ScrollID,#XPOS,#YPOS)
		EndIf
	EndIf
EndIf

Continue = 1