--
-- 
--

dofile("screen_reader_common.inc");
dofile("ui_utils.inc");

function doit()
	askForWindow("This will randomly click your acro buttons (moves), but only when the \"Acro\" timer is not present. Hover ATITD window and Press Shift to continue.");
	
	local num_clicks = 0;
	
	while 1 do
		lsSleep(250);
		srReadScreen();
		
		acro = findAllImages("Acro.png");
		
		if #acro == 2 then
			statusScreen("Acro timer visible");
		else
			if #acro == 0 then
				statusScreen("No acro windows");
			else
				buttons = findAllImages("AcroButton1.png");
				buttons2 = findAllImages("AcroButton2.png");
				for i=1, #buttons2 do
					buttons[#buttons+1] = buttons2[i];
				end
				if #buttons==0 then
					statusScreen("No moves visible");
				else
					index = math.random(#buttons);
					lsSleep(2000);
					srClickMouseNoMove(buttons[index][0]+10, buttons[index][1]+5);
					statusScreen("click " .. index);
					lsSleep(1000);
				end
			end
		end
	end
end

