The Wiki for Tale 6 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:Strutter/macro"

From ATITD6
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
edit and copy code to notepad or other text editor
+
copy code to notepad or other text editor
 +
==grabby.lua==
 +
 
 +
very alpha vers
 +
<pre>
 +
-- any cam
 +
-- water not coded
 +
-- likes to run for the hills and cause strange errors/popups
 +
 
 +
assert(loadfile("luaScripts/common.inc"))();
 +
assert(loadfile("luaScripts/ui_utils.inc"))();
 +
 
 +
 
 +
function doit()
 +
 
 +
numSlates = 0
 +
 
 +
local done = false
 +
local done2 = false
 +
 
 +
while not done do
 +
clay  = lsCheckBox(10, 10, z, 0xFFFFFFff, "Gather clay", clay);
 +
grass = lsCheckBox(10, 30, z, 0xFFFFFFff, "Gather grass", grass);
 +
slate = lsCheckBox(10, 50, z, 0xFFFFFFff, "Gather slate", slate);
 +
water = lsCheckBox(10, 70, z, 0xFFFFFFff, "Gather water", water);
 +
if lsButtonText(10, 90, z, 90, 0xFFFFFFff, "Done") then done = 1
 +
end
 +
 +
lsDoFrame();
 +
end
 +
askForWindow("As you move about you will grab the requested items.") ;
 +
 
 +
while not done2 do
 +
sleepWithStatus(100, "waiting: " ) ;
 +
srReadScreen();
 +
local xyWindowSize = srGetWindowSize();
 +
local midX = xyWindowSize[0] / 2;
 +
 
 +
if (slate) then
 +
local pos = srFindImageInRange("slate.png",0,0,midX,100,1000);
 +
if (pos) then
 +
safeClick(pos[0] + 3, pos[1] + 3);
 +
end
 +
end
 +
if (grass) then
 +
local pos = srFindImageInRange("grass.png",0,0,midX,100,1000);
 +
if (pos) then
 +
safeClick(pos[0] + 3, pos[1] + 3);
 +
end
 +
end
 +
if (clay) then
 +
local pos = srFindImageInRange("clay.png",0,0,midX,100,1000);
 +
if (pos) then
 +
safeClick(pos[0] + 3, pos[1] + 3);
 +
end
 +
end
 +
if lsButtonText(10, 90, z, 90, 0xFFFFFFff, "Done") then done2 = 1
 +
end
 +
 
 +
end
 +
 
 +
end
 +
 
 +
 
 +
</pre>
 +
 
 
==jug.lua==
 
==jug.lua==
  

Latest revision as of 14:51, 4 August 2013

copy code to notepad or other text editor

grabby.lua

very alpha vers

-- any cam
-- water not coded
-- likes to run for the hills and cause strange errors/popups

assert(loadfile("luaScripts/common.inc"))();
assert(loadfile("luaScripts/ui_utils.inc"))(); 


function doit()

numSlates = 0

local done = false
local done2 = false

	while not done do
		clay  = lsCheckBox(10, 10, z, 0xFFFFFFff, "Gather clay", clay);
		grass = lsCheckBox(10, 30, z, 0xFFFFFFff, "Gather grass", grass);
		slate = lsCheckBox(10, 50, z, 0xFFFFFFff, "Gather slate", slate);
		water = lsCheckBox(10, 70, z, 0xFFFFFFff, "Gather water", water);
		if lsButtonText(10, 90, z, 90, 0xFFFFFFff, "Done") then done = 1
		end
		 						
	lsDoFrame();	
	end
	askForWindow("As you move about you will grab the requested items.") ;

	while not done2 do
		sleepWithStatus(100, "waiting: " ) ;
		srReadScreen();
		local xyWindowSize = srGetWindowSize();
		local midX = xyWindowSize[0] / 2;

		if (slate) then 
			local pos = srFindImageInRange("slate.png",0,0,midX,100,1000);
		if (pos) then
			safeClick(pos[0] + 3, pos[1] + 3);
		end
		end
		if (grass) then 
			local pos = srFindImageInRange("grass.png",0,0,midX,100,1000);
		if (pos) then
			safeClick(pos[0] + 3, pos[1] + 3);
		end
		end
		if (clay) then 
			local pos = srFindImageInRange("clay.png",0,0,midX,100,1000);
		if (pos) then
			safeClick(pos[0] + 3, pos[1] + 3);
		end
		end
		if lsButtonText(10, 90, z, 90, 0xFFFFFFff, "Done") then done2 = 1
		end

	end

end


jug.lua

this is a rough veggie tales macro I use to make jugs it works on my screens by adjusting where I stand

you may need to change the numbers or adjust your zoom

hotkeys on chat down <F8><F8>veiw

hit control for 1 potterywheel pass


 loadfile("luaScripts/screen_reader_common.inc")();
 loadfile("luaScripts/ui_utils.inc")();
 loadfile("luaScripts/common.inc")();
 loadfile("luaScripts/serialize.inc")();
 loadfile("luaScripts/settings.inc")();
 loadfile("luaScripts/constants.inc")();

 gridHeight = 5;
 gridWidth = 6; 
 firstx =  200;
 firsty = 166;
 incx = 82; 
 incy = 82;
 x = 0;
 y = 0;




 function doit()

 askForWindow( "Make sure your chats are minimized, you are in the F8F8 view, " .. "and you can see all your pottery wheels then  hover ATITD window and press Shift to continue.");
 -- or press Control for setup"); 
 promptForSettings();
  while 1 do
  lsSleep(150); 
 
  prompt()

 	x = firstx; 
 	y = firsty;

	for row =1, gridHeight do
  
 		for column=1,  gridWidth do
   			checkBreak(); 
    
    			srSetMousePos(x , y);
    			lsSleep(150);
   			srKeyEvent("t");
    			lsSleep(150);
   			srKeyEvent("j");
    			x = x + incx;
    			--lsSleep(150);
			srReadScreen();
			if(srFindImage("toMake.png",5000)) then
				closeAllWindows();
				error("Out of supplies");
			end

  		end
   		x = firstx;
   		y = y + incy;
	end
  end
 end

 function promptForSettings() 
 -- lifted from brickhotkeys.lua

  scale = 1;
    
  local z = 0;
  local is_done = nil;
  local value = nil;
  -- Edit box and text display
  while not is_done do
    checkBreak();

    local y = 5;

    lsSetCamera(0,0,lsScreenX*scale,lsScreenY*scale);

    lsPrint(5, y, z, scale, scale, 0xFFFFFFff, "Grid width:");
    gridWidth = readSetting("gridWidth",gridWidth);
    is_done, gridWidth = lsEditBox("gridWidth", 125, y, z, 50, 30, scale, scale,
                                0x000000ff, gridWidth);
    if not tonumber(gridWidth) then
      is_done = nil;
      lsPrint(10, y+18, z+10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
      gridWidth = 1;
    end
    gridWidth = tonumber(gridWidth);
    writeSetting("gridWidth",gridWidth);
    y = y + 32;
	
    lsPrint(5, y, z, scale, scale, 0xFFFFFFff, "Grid height:");
    gridHeight = readSetting("gridHeight",gridHeight);
    is_done, gridHeight = lsEditBox("gridHeight", 125, y, z, 50, 30, scale, scale,
                                0x000000ff, gridHeight);
    if not tonumber(gridHeight) then
      is_done = nil;
      lsPrint(10, y+18, z+10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
      gridHeight = 1;
    end
    gridHeight = tonumber(gridHeight);
    writeSetting("gridHeight",gridHeight);
    y = y + 32;
	
    if lsButtonText(10, (lsScreenY - 30) * scale, z, 100, 0xFFFFFFff, "OK") then
      is_done = 1;
    end

    if lsButtonText((lsScreenX - 100) * scale, (lsScreenY - 30) * scale, z, 100, 0xFFFFFFff,
                    "End script") then
      error "Clicked End Script button";
    end

    lsDoFrame();
    lsSleep(150);



  end
 end

 function prompt()
	statusScreen("Press  Ctrl to continue.");
	waitForKeypress(true);
	statusScreen("Release the Ctrl button.");
	waitForKeyrelease();
	lsSleep(150);
	statusScreen("");
	lsSleep(150);
	return 
 end