The Wiki for Tale 8 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:Cegaiel/Macros"
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
<pre> | <pre> | ||
dofile("common.inc"); | dofile("common.inc"); | ||
+ | |||
+ | |||
+ | askText = "Quickly Learn all skills offered by a University\n\nClick on a University, Choose Learn to open the Technologies window.\n\nMake sure this window is not near the center, where popup boxes will occur!\n\nThe macro will do 5 passes of clicking all the Learn buttons and closing all the popups. The reason for multiple passes is to be sure there aren't multiple new levels for any existing skill you might have already"; | ||
+ | |||
function doit() | function doit() | ||
− | + | askForWindow(askText); | |
− | + | ||
− | + | ||
+ | for i = 1,5 do | ||
+ | checkBreak(); | ||
+ | srReadScreen(); | ||
+ | learnButton = findAllImages("learn.png"); | ||
+ | |||
− | + | if #learnButton == 0 then | |
− | + | sleepWithStatus(750,"[" .. i .. "/5] No buttons found ...", nil, 0.7, 0.7); | |
− | + | else | |
− | + | sleepWithStatus(750,"[" .. i .. "/5] Clicking Learn buttons, closing popups ...", nil, 0.7, 0.7); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | for j=1,#learnButton do | |
− | + | checkBreak(); | |
− | + | srClickMouseNoMove(learnButton[j][0], learnButton[j][1], 1); | |
− | + | lsSleep(100); | |
− | + | srReadScreen(); | |
+ | OK = srFindImage("OK.png"); | ||
+ | -- Basic Shipbuilding might produce Cancel / Pay Tuition popup. | ||
+ | -- You'll need to manually Pay tuition on this one (assuming you have tuition in inventory) | ||
+ | Cancel = srFindImage("cancelThin.png"); | ||
+ | if OK then | ||
+ | srClickMouseNoMove(OK[0],OK[1],1); | ||
+ | end | ||
+ | if Cancel then | ||
+ | srClickMouseNoMove(Cancel[0],Cancel[1],1); | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | end | ||
− | + | lsPlaySound("Complete.wav"); | |
− | |||
end | end | ||
</pre> | </pre> |
Revision as of 09:52, 28 February 2019
LearnLessons.lua
Useful if someone is teaching you lessons and you're slow to pay attention. Will click the Yes and OK popups as they appear so lesson can continue in a timely manner.
dofile("common.inc"); askText = "Quickly Learn all skills offered by a University\n\nClick on a University, Choose Learn to open the Technologies window.\n\nMake sure this window is not near the center, where popup boxes will occur!\n\nThe macro will do 5 passes of clicking all the Learn buttons and closing all the popups. The reason for multiple passes is to be sure there aren't multiple new levels for any existing skill you might have already"; function doit() askForWindow(askText); for i = 1,5 do checkBreak(); srReadScreen(); learnButton = findAllImages("learn.png"); if #learnButton == 0 then sleepWithStatus(750,"[" .. i .. "/5] No buttons found ...", nil, 0.7, 0.7); else sleepWithStatus(750,"[" .. i .. "/5] Clicking Learn buttons, closing popups ...", nil, 0.7, 0.7); for j=1,#learnButton do checkBreak(); srClickMouseNoMove(learnButton[j][0], learnButton[j][1], 1); lsSleep(100); srReadScreen(); OK = srFindImage("OK.png"); -- Basic Shipbuilding might produce Cancel / Pay Tuition popup. -- You'll need to manually Pay tuition on this one (assuming you have tuition in inventory) Cancel = srFindImage("cancelThin.png"); if OK then srClickMouseNoMove(OK[0],OK[1],1); end if Cancel then srClickMouseNoMove(Cancel[0],Cancel[1],1); end end end end lsPlaySound("Complete.wav"); end
Screenshot.lua
Sends Alt+C to the game at intervals to take a screenshot. The frame000,001,002,etc.png file will appear in your ATITD GAME folder.
dofile("common.inc"); dofile("constants.inc"); askText = "Presses Alt+C to create .png in ATITD folder"; timer = 900000; -- 15 mins - time is in ms. 60000 = 1 minute function doit() askForWindow(askText); while 1 do -- checkBreak(); is already included in function sleepWithStatus sleepWithStatus(timer,"Waiting to take screenshot..."); srKeyDown2(VK_MENU); lsSleep(100); srKeyEvent('c'); lsSleep(100); srKeyUp2(VK_MENU); end end
learnUniversity.lua
Quickly click all the Learn buttons at a University. Download learnUniversity.zip which includes learn.png and learnUniversity.lua . You will need learn.png for this script to work!
dofile("common.inc"); askText = "Quickly Learn all skills offered by a University\n\nClick on a University, Choose Learn to open the Technologies window.\n\nMake sure this window is not near the center, where popup boxes will occur!\n\nThe macro will do 5 passes of clicking all the Learn buttons and closing all the popups. The reason for multiple passes is to be sure there aren't multiple new levels for any existing skill you might have already"; function doit() askForWindow(askText); for i = 1,5 do checkBreak(); srReadScreen(); learnButton = findAllImages("learn.png"); if #learnButton == 0 then sleepWithStatus(750,"[" .. i .. "/5] No buttons found ...", nil, 0.7, 0.7); else sleepWithStatus(750,"[" .. i .. "/5] Clicking Learn buttons, closing popups ...", nil, 0.7, 0.7); for j=1,#learnButton do checkBreak(); srClickMouseNoMove(learnButton[j][0], learnButton[j][1], 1); lsSleep(100); srReadScreen(); OK = srFindImage("OK.png"); if OK then srClickMouseNoMove(OK[0],OK[1],1); end end end end lsPlaySound("Complete.wav"); end