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.

User:Strutter/macro

From ATITD6
Jump to navigationJump to search

edit and copy code to notepad or other text editor

jug.lua

 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