The Wiki for Tale 7 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.

Difference between revisions of "User:OneBanana/Test Page 1"

From ATITD7
Jump to navigationJump to search
(Blanked the page)
Line 1: Line 1:
 +
<pre>
 +
-- BaBam V1.0 Written by OneBanana
 +
--
 +
-- Grab a sledgehammer and load yourself up with medium stones
 +
-- Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L) and pin open the Drop menu
 +
-- Default to MAX for how many should be turned OFF.
 +
-- Right click opens a menu as pinned should be turned OFF
 +
-- The script will set your starting position, do not move from that point untill the it has stopped.
 +
-- Before you begin collecting the stone fragments drop your sledgehammer otherwise you will not be able to 'hotclick' to collect them.
 +
-- This also marks the spot to return to after you have collected the stone fragments if you wish to continue smashing.
 +
-- Personally i find it best to leave the gravel on the ground and collect it all at once after all of the smashing is done.
 +
-- It also saves you from becoming 'pinned' if you are overloaded with it and stone fragemnts while collecting.
 +
--
  
 +
 +
dofile("screen_reader_common.inc");
 +
dofile("ui_utils.inc");
 +
 +
loadfile("screen_reader_common.inc")();
 +
loadfile("ui_utils.inc")();
 +
 +
per_click_delay = 200;
 +
waitDelay = 100;
 +
 +
up = nil;
 +
right_click = nil;
 +
 +
button_names = {
 +
"Smash Medium Stone",
 +
"Smash Cracked Stone",
 +
"Smash Broken Stone",
 +
"Smash Split Stone",
 +
"Drop Medium Stone",
 +
"Drop Cracked Stone",
 +
"Drop Broken Stone",
 +
"Drop Split Stone",
 +
};
 +
 +
 +
 +
function promptDelays()
 +
y = y + 40;
 +
        lsPrint(5, y, 0, 0.8, 0.8, 0xffffffff, "Passes:");
 +
        is_done, num_loops = lsEditBox("num_loops", 170, y, 0, 50, 30, 1.0, 1.0, 0x000000ff, 10);
 +
        num_loops = tonumber(num_loops);
 +
        if not num_loops then
 +
        is_done = false;
 +
        lsPrint(10, y+22, 10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
 +
        num_loops = 10;
 +
end
 +
end
 +
 +
function waitForChange()
 +
local c=0;
 +
while srReadPixel(setWaitSpot_x, setWaitSpot_y) == setWaitSpot_px do
 +
lsSleep(1);
 +
c = c+1;
 +
if (lsShiftHeld() and lsControlHeld()) then
 +
error 'broke out of loop from Shift+Ctrl';
 +
end
 +
end
 +
end
 +
 +
function clickAll(image_name, up)
 +
-- Find buttons and click them!
 +
srReadScreen();
 +
local buttons = findAllImages(image_name);
 +
 +
if #buttons == 0 then
 +
return nil;
 +
else
 +
if up then
 +
for i=#buttons, 1, -1  do
 +
srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3);
 +
lsSleep(per_click_delay);
 +
end
 +
else
 +
for i=1, #buttons  do
 +
srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3);
 +
lsSleep(per_click_delay);
 +
end
 +
end
 +
lsSleep(50);
 +
return 1;
 +
end
 +
end
 +
 +
function clickAllRight(image_name)
 +
-- Find windows and click them!
 +
srReadScreen();
 +
xyWindowSize = srGetWindowSize();
 +
local buttons = findAllImages(image_name);
 +
if #buttons == 0 then
 +
statusScreen("Could not find any pinned up windows...");
 +
lsSleep(1500);
 +
else
 +
statusScreen("Clicking " .. #buttons .. "windows(s)...");
 +
if up then
 +
for i=#buttons, 1, -1  do
 +
srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3, true);
 +
lsSleep(per_click_delay);
 +
end
 +
else
 +
for i=1, #buttons  do
 +
srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3, true);
 +
lsSleep(per_click_delay);
 +
end
 +
end
 +
statusScreen("Done clicking (" .. #buttons .. " windows).");
 +
lsSleep(100);
 +
end
 +
end
 +
 +
 +
function refocus()
 +
statusScreen("Refocusing...");
 +
for i=2, #window_locs do
 +
setWaitSpot(window_locs[i][0], window_locs[i][1]);
 +
srClickMouseNoMove(window_locs[i][0] + 321, window_locs[i][1] + 74);
 +
waitForChange();
 +
end
 +
end
 +
 +
 +
function Unpin()
 +
askForWindow("Put ATITD window in focus first and Press Shift key to unpin/close all pinned windows.");
 +
srReadScreen();
 +
window_locs = findAllImages("DropUnpin.png");
 +
clickAllRight("DropUnpin.png", 1);
 +
lsSleep(200);
 +
end
 +
 +
 +
function SmashMediumStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Medium Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropMediumStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
 +
 +
srClickMouseNoMove(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);
 +
lsSleep(1000);
 +
 +
end
 +
 +
srReadScreen();
 +
buttons = findOneImage("DropSmashThis.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(500);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
 +
function SmashCrackedStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Cracked Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropCrackedStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
 +
 +
srClickMouseNoMove(xyWindowSize[0]/2 + 30, xyWindowSize[1]/2 + -145);
 +
lsSleep(1000);
 +
 +
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropSmashThis.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(500);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function SmashBrokenStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Broken Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropBrokenStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
 +
srClickMouse(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);
 +
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropSmashThis.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(500);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function SmashSplitStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Split Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropSplitStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
 +
srClickMouse(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);
 +
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropSmashThis.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(500);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function DropMediumStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Medium Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropMediumStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function DropCrackedStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Cracked Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropCrackedStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function DropBrokenStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Broken Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropBrokenStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function DropSplitStone()
 +
num_loops = promptNumber("How many passes ?", 1);
 +
askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Split Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
for i=1, num_loops do
 +
srReadScreen();
 +
srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
 +
buttons = findOneImage("DropSplitStone.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
count = count + 1;
 +
end
 +
end
 +
end
 +
 +
 +
function DropSledgehammer()
 +
local num_rounds;
 +
askForWindow("Drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
 +
local count = 0;
 +
while true do
 +
statusScreen("Hammer Dropped");
 +
srReadScreen();
 +
buttons = findOneImage("DropSledgehammer.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
end
 +
srReadScreen();
 +
buttons = findOneImage("DropOk.png");
 +
if #buttons > 0 then
 +
srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
 +
lsSleep(per_click_delay);
 +
return;
 +
end
 +
end
 +
end
 +
 +
 +
function doit()
 +
while 1 do
 +
-- Ask for which button
 +
local image_name = nil;
 +
local is_done = nil;
 +
while not is_done do
 +
local y = 40;
 +
local x = nil;
 +
local bsize = nil;
 +
for i=1, #button_names do
 +
if button_names[i] == "Smash Medium Stone" then
 +
x = 30;
 +
y = 10;
 +
-- bsize = 130;
 +
elseif button_names[i] == "Smash Cracked Stone" then
 +
x = 30;
 +
y = 40;
 +
-- bsize = 130;
 +
elseif button_names[i] == "Smash Broken Stone" then
 +
x = 30;
 +
y = 70;
 +
elseif button_names[i] == "Smash Split Stone" then
 +
x = 30;
 +
y = 100;
 +
elseif button_names[i] == "Drop Medium Stone" then
 +
x = 30;
 +
y = 130;
 +
bsize = 130;
 +
elseif button_names[i] == "Drop Cracked Stone" then
 +
x = 30;
 +
y = 160;
 +
bsize = 130;
 +
elseif button_names[i] == "Drop Broken Stone" then
 +
x = 30;
 +
y = 190;
 +
elseif button_names[i] == "Drop Split Stone" then
 +
x = 30;
 +
y = 220;
 +
end
 +
 +
 +
if lsButtonText(10, y, 0, 280, 0xFDD017ff, button_names[i]) then
 +
image_name = button_names[i];
 +
is_done = 1;
 +
end
 +
 +
end
 +
 +
if lsButtonText(lsScreenX - 290, lsScreenY - 90, z, 280, 0xFFA500ff, "Drop Sledgehammer") then
 +
DropSledgehammer();
 +
is_done = 1;
 +
end
 +
 +
 +
if lsButtonText(lsScreenX - 290, lsScreenY - 60, z, 280, 0xFFA500ff, "Unpin Windows") then
 +
Unpin();
 +
is_done = 1;
 +
end
 +
 +
 +
if lsButtonText(lsScreenX - 290, lsScreenY - 30, z, 280, 0xFF0000ff, "End script") then
 +
error "Clicked End Script button";
 +
end
 +
 +
lsDoFrame();
 +
lsSleep(10);
 +
end
 +
 +
if image_name == "Smash Medium Stone" then
 +
SmashMediumStone();
 +
elseif image_name == "Smash Cracked Stone" then
 +
SmashCrackedStone();
 +
elseif image_name == "Smash Broken Stone" then
 +
SmashBrokenStone();
 +
elseif image_name == "Smash Split Stone" then
 +
SmashSplitStone();
 +
elseif image_name == "Drop Medium Stone" then
 +
DropMediumStone();
 +
elseif image_name == "Drop Cracked Stone" then
 +
DropCrackedStone();
 +
elseif image_name == "Drop Broken Stone" then
 +
DropBrokenStone();
 +
elseif image_name == "Drop Split Stone" then
 +
DropSplitStone();
 +
elseif image_name == "Drop Sledgehammer" then
 +
DropSledgehammer();
 +
elseif image_name == "Un-Pin Windows" then
 +
Unpin();
 +
 +
 +
end
 +
end
 +
end
 +
 +
</pre>

Revision as of 16:00, 14 February 2016

-- BaBam V1.0 Written by OneBanana
-- 
-- Grab a sledgehammer and load yourself up with medium stones
-- Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L) and pin open the Drop menu
-- Default to MAX for how many should be turned OFF.
-- Right click opens a menu as pinned should be turned OFF
-- The script will set your starting position, do not move from that point untill the it has stopped.
-- Before you begin collecting the stone fragments drop your sledgehammer otherwise you will not be able to 'hotclick' to collect them.
-- This also marks the spot to return to after you have collected the stone fragments if you wish to continue smashing.
-- Personally i find it best to leave the gravel on the ground and collect it all at once after all of the smashing is done.
-- It also saves you from becoming 'pinned' if you are overloaded with it and stone fragemnts while collecting.
-- 


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

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

per_click_delay = 200;
waitDelay = 100;

up = nil;
right_click = nil;

button_names = {
"Smash Medium Stone",
"Smash Cracked Stone",
"Smash Broken Stone",
"Smash Split Stone",
"Drop Medium Stone",
"Drop Cracked Stone",
"Drop Broken Stone",
"Drop Split Stone",
};



function promptDelays()
	y = y + 40;
        lsPrint(5, y, 0, 0.8, 0.8, 0xffffffff, "Passes:");
        is_done, num_loops = lsEditBox("num_loops", 170, y, 0, 50, 30, 1.0, 1.0, 0x000000ff, 10);
        num_loops = tonumber(num_loops);
        if not num_loops then
        is_done = false;
        lsPrint(10, y+22, 10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
        num_loops = 10;	
	end
end

function waitForChange()
	local c=0;
	while srReadPixel(setWaitSpot_x, setWaitSpot_y) == setWaitSpot_px do
		lsSleep(1);
		c = c+1;
		if (lsShiftHeld() and lsControlHeld()) then
			error 'broke out of loop from Shift+Ctrl';
		end
	end
end

function clickAll(image_name, up)
	-- Find buttons and click them!
	srReadScreen();
	local buttons = findAllImages(image_name);
	
	if #buttons == 0 then
		return nil;
	else
		if up then
			for i=#buttons, 1, -1  do
				srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3);
				lsSleep(per_click_delay);
			end
		else
			for i=1, #buttons  do
				srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3);
				lsSleep(per_click_delay);
			end
		end
		lsSleep(50);
		return 1;
	end
end

function clickAllRight(image_name)
	-- Find windows and click them!
	srReadScreen();
	xyWindowSize = srGetWindowSize();
	local buttons = findAllImages(image_name);
	if #buttons == 0 then
		statusScreen("Could not find any pinned up windows...");
		lsSleep(1500);
	else
		statusScreen("Clicking " .. #buttons .. "windows(s)...");
		if up then
			for i=#buttons, 1, -1  do
				srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3, true);
				lsSleep(per_click_delay);
			end
		else
			for i=1, #buttons  do
				srClickMouseNoMove(buttons[i][0]+5, buttons[i][1]+3, true);
				lsSleep(per_click_delay);
			end
		end
		statusScreen("Done clicking (" .. #buttons .. " windows).");
		lsSleep(100);
	end
end


function refocus()
	statusScreen("Refocusing...");
	for i=2, #window_locs do
		setWaitSpot(window_locs[i][0], window_locs[i][1]);
		srClickMouseNoMove(window_locs[i][0] + 321, window_locs[i][1] + 74);
		waitForChange();
	end
end


function Unpin()
	askForWindow("Put ATITD window in focus first and Press Shift key to unpin/close all pinned windows.");
	srReadScreen();
	window_locs = findAllImages("DropUnpin.png");
	clickAllRight("DropUnpin.png", 1);
	lsSleep(200);
end


function SmashMediumStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Medium Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropMediumStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);


		srClickMouseNoMove(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);
		lsSleep(1000);

		end

		srReadScreen();
		buttons = findOneImage("DropSmashThis.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(500);
		count = count + 1;
		end
	end
end



function SmashCrackedStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Cracked Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropCrackedStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);


		srClickMouseNoMove(xyWindowSize[0]/2 + 30, xyWindowSize[1]/2 + -145);
		lsSleep(1000);

		
		end
		srReadScreen();
		buttons = findOneImage("DropSmashThis.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(500);
		count = count + 1;
		end
	end
end


function SmashBrokenStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Broken Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropBrokenStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);

		srClickMouse(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);

		end
		srReadScreen();
		buttons = findOneImage("DropSmashThis.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(500);
		count = count + 1;
		end
	end
end


function SmashSplitStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Split Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropSplitStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);

		srClickMouse(xyWindowSize[0]/2 + -10, xyWindowSize[1]/2 + -65);

		end
		srReadScreen();
		buttons = findOneImage("DropSmashThis.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(500);
		count = count + 1;
		end
	end
end


function DropMediumStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Medium Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropMediumStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		count = count + 1;
		end
	end
end


function DropCrackedStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Cracked Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropCrackedStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		count = count + 1;
		end
	end
end


function DropBrokenStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Broken Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropBrokenStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		count = count + 1;
		end
	end
end


function DropSplitStone()
	num_loops = promptNumber("How many passes ?", 1);
	askForWindow("Use F8F8 camera view, zoomed in 100% with the screen locked (Alt+L). Pin open the Drop menu & ensure your have Split Stones and a Sledgehammer in your inventory. Default to MAX for how many should be turned OFF. Dont move from your starting position untill the script has stopped, drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	for i=1, num_loops do
		srReadScreen();
		srClickMouse(xyWindowSize[0]/2 + 10, xyWindowSize[1]/2 + 65);
		buttons = findOneImage("DropSplitStone.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		count = count + 1;
		end
	end
end


function DropSledgehammer()
	local num_rounds;
	askForWindow("Drop your sledgehammer to mark the spot to return to after you have collected the stone fragments. To save time, leave the gravel on the ground and collect it all at once after all of the smashing is done, this also saves you from becoming 'pinned' if you are overloaded with both it and stone fragemnts while collecting. Click in ATITD and press shift to begin.");
	local count = 0;
	while true do
		statusScreen("Hammer Dropped");
		srReadScreen();
		buttons = findOneImage("DropSledgehammer.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
		end
		srReadScreen();
		buttons = findOneImage("DropOk.png");
		if #buttons > 0 then
			srClickMouseNoMove(buttons[1][0]+2, buttons[1][1] + 2, right_click);
			lsSleep(per_click_delay);
			return;
		end
	end
end 


function doit()
	while 1 do
		-- Ask for which button
		local image_name = nil;
		local is_done = nil;	
		while not is_done do
			local y = 40;
			local x = nil;
			local bsize = nil;
			for i=1, #button_names do
				if button_names[i] == "Smash Medium Stone" then
					x = 30;
					y = 10;
					-- bsize = 130;
				elseif button_names[i] == "Smash Cracked Stone" then
					x = 30;
					y = 40;
					-- bsize = 130;
				elseif button_names[i] == "Smash Broken Stone" then
					x = 30;
					y = 70;
				elseif button_names[i] == "Smash Split Stone" then
					x = 30;
					y = 100;
				elseif button_names[i] == "Drop Medium Stone" then
					x = 30;
					y = 130;
					bsize = 130;
				elseif button_names[i] == "Drop Cracked Stone" then
					x = 30;
					y = 160;
					bsize = 130;
				elseif button_names[i] == "Drop Broken Stone" then
					x = 30;
					y = 190;
				elseif button_names[i] == "Drop Split Stone" then
					x = 30;
					y = 220;
					end


				if lsButtonText(10, y, 0, 280, 0xFDD017ff, button_names[i]) then
					image_name = button_names[i];
					is_done = 1;
				end

			end

			if lsButtonText(lsScreenX - 290, lsScreenY - 90, z, 280, 0xFFA500ff, "Drop Sledgehammer") then
					DropSledgehammer();
					is_done = 1;
			end

			
			if lsButtonText(lsScreenX - 290, lsScreenY - 60, z, 280, 0xFFA500ff, "Unpin Windows") then
					Unpin();
					is_done = 1;
			end


			if lsButtonText(lsScreenX - 290, lsScreenY - 30, z, 280, 0xFF0000ff, "End script") then
				error "Clicked End Script button";
			end

			lsDoFrame();
			lsSleep(10);
		end	
		
		if image_name == "Smash Medium Stone" then
			SmashMediumStone();
		elseif image_name == "Smash Cracked Stone" then
			SmashCrackedStone();
		elseif image_name == "Smash Broken Stone" then
			SmashBrokenStone();
		elseif image_name == "Smash Split Stone" then
			SmashSplitStone();
		elseif image_name == "Drop Medium Stone" then
			DropMediumStone();
		elseif image_name == "Drop Cracked Stone" then
			DropCrackedStone();
		elseif image_name == "Drop Broken Stone" then
			DropBrokenStone();
		elseif image_name == "Drop Split Stone" then
			DropSplitStone();
		elseif image_name == "Drop Sledgehammer" then
			DropSledgehammer();
		elseif image_name == "Un-Pin Windows" then
			Unpin();


		end
	end
end