<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>

--=== User Options ===--
	
	-- When_Finished = "charlist"
	When_Finished = "charlist"
		-- "end" to end script, "relog" to log next character and "waypointfilename" to load that waypointfile.

	CharList = {
	{account=31,chars={1}},
	{account=26,chars={1}},
	{account=37,chars={1}},
	{account=38,chars={1}},
	{account=32,chars={2}},
	}
		-- Character list to use when using the "charlist" option above. Requires my "userfunction_LoginNextChar" userfunction.
		-- Find it here. http://www.solarstrike.net/phpBB3/viewtopic.php?p=10350
		--		eg.
		--		CharList = {
		--			{account=4,chars={}},
		--			{account=8,chars={1}},
		--			{account=7,chars={1,2,5}},
		--		}

	--====================--



changeProfileOption("MAX_TARGET_DIST", 10);

	function checkRelog()
		
		if When_Finished == "relog" then
			sendMacro("}LoginNextToon=true;a={")
			sendMacro("Logout();");
			waitForLoadingScreen();
			loadPaths("cot_tele");
		elseif When_Finished == "charlist" then
			SetCharList(CharList)
			LoginNextChar()
			loadPaths("daylieStart");
		elseif When_Finished == "end" then
			error("Ending script",2)
		else
			if not string.find(When_Finished,".", 1, true) then
				When_Finished = When_Finished .. ".xml"
			end
			local filename = getExecutionPath() .. "/waypoints/" .. When_Finished
			local file, err = io.open(filename, "r");
			if file then
				file:close();
				loadPaths(When_Finished)
			else
				error("'When_Finished' option is invalid",0)
			end
		end
	end

function getTreasureChest()
	i=nil;
	shellsBefore=inventory:getItemCount(240181);
	repeat
		if i==nil then i=1 end
		player:update();
		local tChest = player:findNearestNameOrId(113137);
		if tChest~=nil then
			printf("Chest found.");
		else
			printf("Chest not found. This was "..i.." of "..n.." tries.");
			keyboardHold(key.VK_SPACE);	yrest(999);	keyboardRelease(key.VK_SPACE);
			i=i+1;
		end
		shellsAfter=inventory:getItemCount(240181);
	until ((tChest~=nil) or (i>=10)  or (shellsAfter>shellsBefore)) 
	
	repeat
		player:target_Object(113137,3000,nil,true)
		player:update()
	until not player.Casting
	printf("Chest opens. continuing.\n");
	changeProfileOption("MAX_TARGET_DIST", _combat);
end
_combat = settings.profile.options.COMBAT_DISTANCE

</onload>
	<!-- #  1 --><waypoint x="1904" z="2230" y="308">
	__WPL:setForcedWaypointType("RUN")
	fly()	</waypoint>
	<!-- #  2 --><waypoint x="2043" z="2234" y="380">	</waypoint>
	<!-- #  3 --><waypoint x="2259" z="2264" y="389">	</waypoint>
	<!-- #  4 --><waypoint x="2159" z="2185" y="461">	</waypoint>
	<!-- #  5 --><waypoint x="2283" z="2055" y="556">	</waypoint>
	<!-- #  5 --><waypoint x="2533" z="2228" y="352">	</waypoint>
	<!-- #  6 --><waypoint x="2926" z="2332" y="212">	</waypoint>
	<!-- #  7 --><waypoint x="3204" z="2394" y="162">	</waypoint>
	<!-- #  8 --><waypoint x="3561" z="2583" y="99">	</waypoint>
	<!-- #  9 --><waypoint x="3543" z="2675" y="85">
	</waypoint>
	<!-- # 11 --><waypoint x="3548" z="2703" y="85">	</waypoint>
	<!-- # 12 --><waypoint x="3582" z="2733" y="85">teleportToWP("wall1")	</waypoint>
	<!-- # 13 --><waypoint x="3589" z="2750" y="90" tag="wall1">teleportToWP("wall2")	</waypoint>
	<!-- # 14 --><waypoint x="3571" z="2780" y="85" tag="wall2">
	flyoff()
	yrest(500);
	keyboardPress(settings.hotkeys.JUMP.key);
	yrest(500);</waypoint>
	<!-- # 16 --><waypoint x="3558" z="2867" y="85" ></waypoint>
	<!-- # 17 --><waypoint x="3514" z="2957" y="85" >	</waypoint>
	<!-- # 18 --><waypoint x="3463" z="3158" y="85">	</waypoint>
	<!-- # 19 --><waypoint x="3541" z="3162" y="93">	</waypoint>
	<!-- # 20 --><waypoint x="3611" z="3087" y="112">	</waypoint>
	<!-- # 21 --><waypoint x="3642" z="2981" y="139">	</waypoint>
	<!-- # 22 --><waypoint x="3646" z="2871" y="176">	</waypoint>
	<!-- # 23 --><waypoint x="3604" z="2767" y="206">	</waypoint>
	<!-- # 24 --><waypoint x="3528" z="2662" y="248">		
	--waterElementStart
	waterElement = GetIdName(102101);
	evelyn = GetIdName(102102);
	changeProfileOption("TARGET_LEVELDIF_BELOW", 40);
	changeOptionFriendMob("mob", waterElement, "Add") 
	changeOptionFriendMob("mob", evelyn, "Add") 
	changeProfileOption("MAX_TARGET_DIST", _combat);
	changeProfileOption("LOOT_ALL", false);
	changeProfileOption("LOOT", false);
	__WPL:setForcedWaypointType("NORMAL")
	</waypoint>
	<!-- # 26 --><waypoint x="3217" z="2581" y="248">	</waypoint>
	<!-- # 27 --><waypoint x="3118" z="2666" y="249">	</waypoint>
	<!-- # 28 --><waypoint x="3015" z="2735" y="248">
	changeProfileOption("MAX_TARGET_DIST", 50);
	getTreasureChest();
	</waypoint>
	<!-- # 30 --><waypoint x="2992" z="2821" y="248">
	--windElementStart
	windElement = GetIdName(102098);
	changeOptionFriendMob("mob", windElement, "Add") 
	</waypoint>
	<!-- # 32 --><waypoint x="2966" z="3106" y="248">	</waypoint>
	<!-- # 33 --><waypoint x="3011" z="3190" y="248">	</waypoint>
	<!-- # 34 --><waypoint x="3125" z="3269" y="248">
	changeProfileOption("MAX_TARGET_DIST", 50);
	getTreasureChest();
	</waypoint>
	<!-- # 36 --><waypoint x="3185" z="3287" y="248">
	--fireElementStart
	fireElement = GetIdName(102099);
	changeOptionFriendMob("mob", fireElement, "Add") 
	</waypoint>
	<!-- # 38 --><waypoint x="3349" z="3342" y="248">	</waypoint>
	<!-- # 39 --><waypoint x="3491" z="3302" y="248">	</waypoint>
	<!-- # 40 --><waypoint x="3655" z="3144" y="248">
	changeProfileOption("MAX_TARGET_DIST", 50);
	getTreasureChest();
	</waypoint>
	<!-- # 42 --><waypoint x="3697" z="3082" y="248">--
	--earthElementStart
	earthElement = GetIdName(102100);
	changeOptionFriendMob("mob", earthElement, "Add") 
	</waypoint>
	<!-- # 44 --><waypoint x="3754" z="2873" y="248">	</waypoint>
	<!-- # 45 --><waypoint x="3702" z="2735" y="248">	</waypoint>
	<!-- # 46 --><waypoint x="3558" z="2603" y="248">
	changeProfileOption("MAX_TARGET_DIST", 50);
	getTreasureChest();
	</waypoint>
	<!-- # 48 --><waypoint x="3472" z="2584" y="248">		
	--checkForLastElement
	</waypoint>
	<!-- # 50 --><waypoint x="3259" z="2554" y="248">	</waypoint>
	<!-- # 51 --><waypoint x="3274" z="2628" y="252">	</waypoint>
	<!-- # 52 --><waypoint x="3287" z="2701" y="85">	</waypoint>
	<!-- # 53 --><waypoint x="3312" z="2829" y="85">	</waypoint>
	<!-- # 54 --><waypoint x="3325" z="2950" y="85">
	if player:target_NPC({102200,113245}) then
		sendMacro("ChoiceOption(1);");
		yrest(1111);
		sendMacro("ChoiceOption(1);");
	end
	RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");--this line is copied from botromka's script :)
	waitForLoadingScreen();
	inventory:useItem(203487);
	inventory:useItem(203487);
	inventory:useItem(203487);
	item = inventory:findItem("Master's Simple Repair Hammer")
	if item then
       item:moveTo("itemshop")
	end
	checkRelog();
	</waypoint>
</waypoints>