The Wiki for Tale 5 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

User:Makazi/Macro/Flax Assist

From ATITD5
< User:Makazi‎ | Macro
Revision as of 11:24, 22 January 2011 by Makazi (talk | contribs)
Jump to navigationJump to search
--
-- 
--

loadfile("luaScripts/screen_reader_common.inc")();
loadfile("luaScripts/ui_utils.inc")();

per_click_delay = 90;
image_name = "WeedAndWater.png";

function doit()
	askForWindow("This script will look for Flax bed windows and press the option shown. When you start, it will search for Weed and Water, then you can switch to Harvest. Instructions of how to switch will be shown.");

		
		-- Find buttons and click them!
while 1 do		
		if (lsShiftHeld()) then
			image_name = "Harvest.png";
		end
		if (lsAltHeld()) then
			image_name = "WeedAndWater.png";
		end		
		srReadScreen();
		xyWindowSize = srGetWindowSize();
		local buttons = findAllImages(image_name);

		if #buttons == 0 then
			statusScreen("Searching for: " .. "\n" .. image_name .. "\n" .. "Press Shift for Harvest." .. "\n" .. 

"Press Alt for Weed and Water");
			lsSleep(per_click_delay);
		else
			statusScreen("Clicking " .. #buttons .. "button(s)...");
			

			for i=1, #buttons do
				srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3, right_click);
				lsSleep(per_click_delay);
			end


		end
	end
end