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:Soak/Macro"

From ATITD7
Jump to navigationJump to search
Line 2: Line 2:
  
  
Firepit V1
+
Firepit V1.2
  
- The way the macro works is by checking the colors at your mouse position and stoking the flame when colors are correct.
+
- The way the macro works is by checking the colors at your mouse position when starting macro, and stoking the flame when colors are correct.
 +
- pin the firepit for macro to stoke.
 +
- only works for 1 firepit
 
- save as lua
 
- save as lua
  
Line 15: Line 17:
 
  strokes = 0;
 
  strokes = 0;
 
  strokeCheck = 0;
 
  strokeCheck = 0;
  askForWindow(" Start the firepit and keep mouse over the firepit, the macro only checks at your mouse position. Press shift over ATITD window to continue. Macro by Soak");
+
  strokeCheck2 = 0;
 +
strokeColor = 0xFFFFFF;
 +
strokeOffset = makePoint(0, 0);
 +
  askForWindow(" Start the firepit and keep mouse over the firepit, the macro only checks at your mouse position. Press shift over ATITD window to continue. Macro by Soak");
 +
MouseXY = getMousePos();
 
   while true do
 
   while true do
 
    
 
    
 
     srReadScreen();
 
     srReadScreen();
    local pos = getMousePos();
+
     local pixels = pixelDiffs(pos[0], pos[1], 0);
+
local result2 = pixelMatch(MouseXY, strokeOffset, strokeColor, 0);
     local status = "Pos: (" .. pos[0] .. ", " .. pos[1] .. ")\n";
+
 
 +
     local pixels = pixelDiffs(MouseXY[0], MouseXY[1], 0);
 +
 
 +
     local status = "Pos: (" .. MouseXY[0] .. ", " .. MouseXY[1] .. ")\n";
 +
 
 
     status = status .. "Color: " .. table.concat(pixels, ", ");
 
     status = status .. "Color: " .. table.concat(pixels, ", ");
status = status .. "\n Check: ".. strokeCheck ;
 
status = status .. "\n Total Stoke: " .. strokes;
 
 
 
 +
status = status .. "\nCheck: ".. strokeCheck .. " extra: " ..strokeCheck2  ;
 +
status = status .. "\nTotal Stoke: " .. strokes ;
 
 
-- check if pixels are correct color to stoke
 
if pixels[1] == 255 then -- 1 start
 
if pixels[2] == 255 then -- 2 start
 
if pixels[3] == 255 then -- 3 start
 
strokeCheck = strokeCheck + 1;
 
end -- end 3
 
end -- end 2
 
end -- 1 end
 
 
 
 
 
-- we reset the strokecheck if all colors dont match up
+
if result2 then
if pixels[1] < 255 then
+
strokeCheck2 = strokeCheck2 +1;
strokeCheck = 0;
+
strokeCheck = strokeCheck +1;
end
+
if strokeCheck > 2 then
 
+
clickAllImages("This.png"); -- update the firepit UI
if pixels[2] < 255 then
+
sleepWithStatus(150, "refrshing UI");
strokeCheck = 0;
+
clickAllImages("stoke2.png"); -- clicking the stoke option
end
+
sleepWithStatus(500, "clicking");
 
+
strokes = strokes +  1;
if pixels[3] < 255 then
+
strokeCheck = 0; -- reset value
strokeCheck = 0;
+
strokeCheck2 = 0;
end
+
sleepWithStatus(32000, "Found 255, stokes " .. strokes);
+
end
+
else
+
strokeCheck = 0;
 +
 +
end
 
 
 +
 +
if strokes > 60 then
 +
break;
 +
end
 
 
  -- check to make sure flame is ready to be stoked
+
if strokeCheck > 3 then -- flame is ready
+
  sleepWithStatus(200, status);
srKeyEvent("s"); -- stoke the flame
 
strokes = strokes + 1;
 
strokeCheck = 0; -- reset value
 
sleepWithStatus(36000, "Found 255, stokes " .. strokes);
 
end
 
sleepWithStatus(100, status);
 
  
 
      
 
      

Revision as of 19:48, 16 October 2015

Automato Macros


Firepit V1.2

- The way the macro works is by checking the colors at your mouse position when starting macro, and stoking the flame when colors are correct. - pin the firepit for macro to stoke. - only works for 1 firepit - save as lua

dofile("common.inc");
-- firepit macro by soak
-- light the firepit and put mouse over the flame
-- when firepit is at 255,255,255 color will stoke the flame using hotkeys
function doit()
 strokes = 0;
 strokeCheck = 0;
 strokeCheck2 = 0;
 strokeColor = 0xFFFFFF;
 strokeOffset = makePoint(0, 0);
  askForWindow(" Start the firepit and keep mouse over the firepit, the macro only checks at your mouse position. Press shift over ATITD window to continue. Macro by Soak");
 MouseXY = getMousePos();
  while true do
  
    srReadScreen();
	
	local result2 = pixelMatch(MouseXY, strokeOffset, strokeColor, 0);

    local pixels = pixelDiffs(MouseXY[0], MouseXY[1], 0);

    local status = "Pos: (" .. MouseXY[0] .. ", " .. MouseXY[1] .. ")\n";

    status = status .. "Color: " .. table.concat(pixels, ", ");
	
	status = status .. "\nCheck: ".. strokeCheck .. " extra: " ..strokeCheck2  ;
	status = status .. "\nTotal Stoke: " .. strokes ;
	
	
	
	if result2 then
	strokeCheck2 = strokeCheck2 +1;
	strokeCheck = strokeCheck +1;
	if strokeCheck > 2 then
		clickAllImages("This.png"); -- update the firepit UI
		sleepWithStatus(150, "refrshing UI");
		clickAllImages("stoke2.png"); -- clicking the stoke option
		sleepWithStatus(500, "clicking");
		strokes = strokes +  1;
		strokeCheck = 0; -- reset value
		strokeCheck2 = 0;
		sleepWithStatus(32000, "Found 255, stokes " .. strokes);
	 end
	 else
	 strokeCheck = 0;		
	 
	end
	
	 	
	if strokes > 60 then
		break;
	end	
	
		
 sleepWithStatus(200, status);

    
  end
end