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:Obol/Macros"

From ATITD7
Jump to navigationJump to search
Line 1: Line 1:
== Cut Stone Macro ==
+
== Fixed VeggieTales Macros ==
<pre>
+
In Automato (previously known as VeggieTales) once you get to the list of scripts you will see a button Open Folder.  Click it and find the script name that matches one of the following.  I suggest you copy it and make a new file so you have a back up before you change it.  Open the new file with an editor, I suggest [https://notepad-plus-plus.org/repository/6.x/6.8.5/npp.6.8.5.Installer.exe notepad++], it is a free editor, has line numbers and color codes the code. Clicking on one of the following links will take you to a page where you can copy the contents in the white box and paste it into the script replacing what ever is there.  Save the script and give it a try.  Hopefully it will work for you too.
-- Open windows with window_opener.lua
 
-- Arrange them with winder_arranger.lua in rock saw mode
 
-- Run this
 
-- Profit!
 
  
dofile("screen_reader_common.inc");
+
*[[User:Obol/cut_stone_mac|cut_stones.lua]]<br>
dofile("ui_utils.inc");
 
 
 
--local expected_windows = 40; -- Just to double check you don't have any extra windows open that it'll try to click on
 
 
 
expected_windows = promptNumber("How many Rock Saws?", 1);
 
take_locs = 0;
 
 
 
local per_click_delay = 0;
 
 
 
function setWaitSpot(x0, y0)
 
setWaitSpot_x = x0;
 
setWaitSpot_y = y0;
 
setWaitSpot_px = srReadPixel(x0, y0);
 
 
srSetMousePos(setWaitSpot_x, setWaitSpot_y);
 
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
 
-- lsPrintln('Waited ' .. c .. 'ms for pixel to change.');
 
end
 
 
 
function clickAll(image_name, up)
 
-- Find buttons and click them!
 
srReadScreen();
 
xyWindowSize = srGetWindowSize();
 
local buttons = findAllImages(image_name);
 
 
if #buttons == 0 then
 
error 'Could not find any \'Rock Saw\' windows.'
 
--statusScreen("Could not find specified buttons...");
 
--lsSleep(1500);
 
else
 
statusScreen("Clicking " .. #buttons .. "button(s)...");
 
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
 
statusScreen("Done clicking (" .. #buttons .. " clicks).");
 
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 doit()
 
askForWindow("Open, pin, and arrange rock saws with window_opener/window_arranger first.");
 
srReadScreen();
 
while true do
 
window_locs = findAllImages("This.png");
 
if not (#window_locs == expected_windows) then
 
error ("Did not find expected number of windows (found " .. #window_locs .. " expected " .. expected_windows .. ")");
 
end
 
 
 
-- refresh windows
 
--lsPrintln('Found ' .. #window_locs .. ' saws.');
 
clickAll("This.png", 1);
 
lsSleep(200);
 
 
-- take everything
 
window_locs = findAllImages("Take.png");
 
--lsPrintln('Found ' .. #window_locs .. ' Takes.');
 
if not (#window_locs == 0) then
 
clickAll("Take.png", 1);
 
lsSleep(200);
 
 
clickAll("Everything.png", 1);
 
lsSleep(200);
 
end
 
--refocus();
 
 
clickAll("MakeACutStone.png", 1);
 
lsSleep(200);
 
 
--refocus();
 
 
sleepWithStatus(245*1000, "Waiting for stones to finish");
 
end
 
end
 
</pre>
 

Revision as of 22:27, 23 October 2015

Fixed VeggieTales Macros

In Automato (previously known as VeggieTales) once you get to the list of scripts you will see a button Open Folder. Click it and find the script name that matches one of the following. I suggest you copy it and make a new file so you have a back up before you change it. Open the new file with an editor, I suggest notepad++, it is a free editor, has line numbers and color codes the code. Clicking on one of the following links will take you to a page where you can copy the contents in the white box and paste it into the script replacing what ever is there. Save the script and give it a try. Hopefully it will work for you too.