DashingStrike / Automato-ATITD

Automato scripts for A Tale in the Desert
MIT License
5 stars 25 forks source link

Developer Tool: Fine Tuning Charcoal Ovens #154

Open Cegaiel opened 6 years ago

Cegaiel commented 6 years ago

Hi Guys, I was a bit frustrated when I was looking at cc_auto.lua and wanted to verify where it was looking on each bar.

This for example:

minHeat = makePoint(199, 15);
minHeatProgress = makePoint(152, 15);
minOxy = makePoint(80, 33);
maxOxy = makePoint(116, 33);
maxOxyLowHeat = makePoint(160, 33);
minWood = makePoint(108, 50);
minWater = makePoint(58, 70);
minWaterGreen = makePoint(96, 70);
maxDangerGreen = makePoint(205, 90);
maxDanger = makePoint(219, 90);
uberDanger = makePoint(228, 90);
progressGreen = makePoint(62, 110);

So looking at minHeat = makePoint(199, 15); We see 199, 15, but where the heck is that location on my oven!!!?

I wanted to verify where all of these are exactly to see if potential fine tuning could be done on cc_ovens.

Here is test_ccOvenBars.zip . Just put this in your automato\games\atitd\scripts folder. test_ccOvenBars.zip

What this macro does is simply point to every bar and location in the oven to show you where it's pointing to.

NO, don't run this macro on your oven in the game as you might burn your precious wood!

Instead run Automato on the screenshots below...

Here are images of a running cc oven and hearth. You can actually run Automato on these images (just load in paint program or click below (to open in new web browser). Then you can start Automato (tap shift to start over your paint or web browser).

cc_oven

cc_hearth

Here is the code of the zip file linked above:

dofile("common.inc");

askText = "Check/Fine Tune Oven Bar Locations and \"Percentages\" for cc_oven.lua";

-- first Number of makePoint();
-- 0% = 56, 100% = 249, each % = 1.94 (left number of makePoint)

-- second number of makePoint();
-- Heat Bar = 15
-- Oxygen Bar = 33
-- Wood Bar = 50
-- Water Bar = 70
-- Danger Bar = 90
-- Progress Bar = 110

cycle_speed = 2500;

bars = 
{
["minHeat"] = makePoint(199, 15);
["minHeatProgress"] = makePoint(152, 15);
["minOxy"] = makePoint(80, 33);
["maxOxy"] = makePoint(116, 33);
["maxOxyLowHeat"] = makePoint(160, 33);
["minWood"] = makePoint(108, 50);
["minWater"] = makePoint(58, 70);
["minWaterGreen"] = makePoint(96, 70);
["maxDangerGreen"] = makePoint(205, 90);
["maxDanger"] = makePoint(219, 90);
["uberDanger"] = makePoint(228, 90);
["progressGreen"] = makePoint(62, 110);
};

function doit()
    askForWindow(askText);

    while 1 do
  for value, location in pairs(bars) do
    checkBreak();
    srReadScreen();
    findOven();
    srSetMousePos(x + location[0] , y + location[1]); 
    sleepWithStatus(cycle_speed, "Mouse is pointing to your cc oven:\n\n" .. value, nil, 0.7, 0.7);
  end
    end
end

function findOven()
  local result = srFindImage("ThisIs.png");
    local corner = findImageInWindow("mm-corner.png",
                     result[0], result[1]);
    if not corner then
      error("Failed to find corner of cc window.");
    end
    result[1] = corner[1];-- - 0;
    x = result[0];
    y = result[1];
end

Sped up .gif (but it moves much slower (by default) and pointing speed can be adjusted):

test_ccovenbars