<?xml version="1.0" encoding="utf-8"?><waypoints><onLoad>

	changeProfileOption("ANTI_KS", false)
	changeProfileOption("PATH_TYPE", "wander")
	changeProfileOption("WANDER_RADIUS", 0)
	changeProfileOption("AUTO_TARGET", false)
	changeProfileOption("USE_SLEEP_AFTER_RESUME", true)
	
	local B_used=0;
	local B_curr=0;
	local RecipientName, ItemInfo;
	local seller = false; -- set to 'false' if u just want to accept trade (not sell items), true if u want sell items
	local TradeMoney = 199000; -- Recipient Money (cash you want earn)
	local L_Nr=1          -- First item index in bag which we want to sell
	local U_Nr=24		  -- Last item index in bag

	if seller then	
		while (true) do 
			yrest(1000)
		    RecipientName = RoMScript("GetTradeRecipientName();")
			if RecipientName == nil then
			elseif RecipientName == "" then
			else
				
				-- Check the current number of items in bag 
				if RoMScript("GetBagCount();") ~= nil then
					B_used =  RoMScript("GetBagCount();")
				else
					cprintf(cli.red, "\n B_used = nil - break the loop " );
					break;
				end
			
				-- Save recipient name as variable (required to accept trade)
				RecipientName = RoMScript("GetTradeRecipientName();")
				cprintf(cli.yellow, "\nTradeing with " .. RecipientName);
				RoMScript("AgreeTrade();")		
				yrest(500) -- Im not sure its enough, you can increse it (depend on lag ms)
			
				-- Get the bag item at index L_Nr and put into trade at index 1
				ItemInfo = RoMScript("GetBagItemInfo("..tonumber(L_Nr)..");")
				RoMScript("PickupBagItem("..tonumber(ItemInfo)..");")
				yrest(400)
				RoMScript("ClickTradeItem(1);")
				yrest(200)
			
				-- Accept trade if recipient put the required money
				while TradeMoney >= RoMScript("GetTradeTargetMoney();") do
					RoMScript("AcceptTrade('..RecipientName..');")
					yrest(200)
				end	
	
			
				-- Check if items quantity in bag (if changed item sold) > 0
				B_curr = RoMScript("GetBagCount();")
				if B_curr ~= nil then
					if B_used > B_curr then
						cprintf(cli.yellow, "\nItem sold " );
						L_Nr = L_Nr+1;
					end
				else
					cprintf(cli.red, "\n B_curr = nil - break the loop " );
					break;
				end
			
				-- If all items are sold than stop the loop 
				if L_Nr==U_Nr+1 then
					break;
				end
			end
		end
		cprintf(cli.green, "\nAll items are sold " );
	else
		while (true) do 
			yrest(200) 
			RecipientName = RoMScript("GetTradeRecipientName();")
			if RecipientName == nil then
			elseif RecipientName == "" then
			else
				RoMScript("AgreeTrade();")		
				yrest(1200) 
				while RoMScript("GetTradeTargetItemInfo(1)") ~= nil do
					RoMScript("AcceptTrade('..RecipientName..');")
					yrest(500)
					RoMScript("AcceptTrade('..RecipientName..');")
				end
			end
		end
	end
	
	stopPE()
	
</onLoad></waypoints>