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:Selune"

From ATITD6
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 838: Line 838:
 
{{Collapse bottom}}
 
{{Collapse bottom}}
  
{{Collapse top|title=New Raeli Oven Monitor (IN TESTING)}}
+
{{Collapse top|title=New Raeli Oven Monitor (IN TESTING v3)}}
 
<pre>
 
<pre>
 
loadfile("luaScripts/screen_reader_common.inc")();
 
loadfile("luaScripts/screen_reader_common.inc")();
Line 845: Line 845:
  
 
askText = singleLine([[
 
askText = singleLine([[
   Raeli Color Monitor v1.1b (edit by Selune) --
+
   Raeli Color Monitor v1.1c (edit by Selune) --
   Make sure the Raeli Oven is pinned, then select the ATITD window and press shift.
+
   Make sure the Raeli Oven is pinned, select the ATITD window, and press shift.
 
]]);
 
]]);
  
Line 990: Line 990:
 
best_offset = 100000;
 
best_offset = 100000;
 
next_best_offset = 1000000;
 
next_best_offset = 1000000;
rgb_r = ((math.floor(px/256/256/256) % 256) - 7) * 255/248;
+
rgb_r = ((math.floor(px/256/256/256) % 256) - 7) * 255/247;
rgb_g = ((math.floor(px/256/256) % 256) - 7) * 255/248;
+
rgb_g = ((math.floor(px/256/256) % 256) - 7) * 255/247;
rgb_b = ((math.floor(px/256) % 256) - 6) * 255/248;
+
rgb_b = ((math.floor(px/256) % 256) - 5.5) * 255/247;
 
lab_l, lab_a, lab_b = rgb2lab(rgb_r, rgb_g, rgb_b);
 
lab_l, lab_a, lab_b = rgb2lab(rgb_r, rgb_g, rgb_b);
 
hsl_h, hsl_s, hsl_l = rgb2hsl(rgb_r, rgb_g, rgb_b);
 
hsl_h, hsl_s, hsl_l = rgb2hsl(rgb_r, rgb_g, rgb_b);
Line 1,126: Line 1,126:
 
 
 
if not color_found then
 
if not color_found then
lsPrint(130, y - 20, z, 0.7, 0.7, 0xFF0000ff, "No such color");
+
lsPrint(130, y - 20, z, 0.7, 0.7, 0xFF0000ff, "No such color (Remove any spaces)");
 
end
 
end
 
 
Line 1,167: Line 1,167:
 
function doit()
 
function doit()
 
askForWindow(askText);
 
askForWindow(askText);
while lsShiftHeld() do
 
-- Make user release shift key
 
lsCheckBreak();
 
end
 
 
 
askForPixel();
 
askForPixel();
 
 
Line 1,178: Line 1,173:
 
local index=0;
 
local index=0;
 
local color_name, confidence;
 
local color_name, confidence;
 +
local do_screenshot, do_end_burn;
 
while 1 do
 
while 1 do
 
local y = 0;
 
local y = 0;
 +
do_screenshot = false;
 
checkBreak();
 
checkBreak();
 
lsSleep(100);
 
lsSleep(100);
Line 1,189: Line 1,186:
 
if not (new_px == px) then
 
if not (new_px == px) then
 
index = index+1;
 
index = index+1;
 +
px = new_px;
 +
color_name, confidence = nearestColor(px);
 
if take_screenshots then
 
if take_screenshots then
srSaveLastReadScreen("screen_" .. index .. "_" .. t_string .. ".png");
+
do_screenshot = true;
 
end
 
end
px = new_px;
 
 
 
 
if stop_at_CB then
 
if stop_at_CB then
color_name, confidence = nearestColor(px);
 
 
if (color_name:upper() == stop_at_color:upper()) then
 
if (color_name:upper() == stop_at_color:upper()) then
 
if confidence > confidence_threshold then
 
if confidence > confidence_threshold then
clickAllText("Interrupt");
+
do_end_burn = true;
lsPlaySound("Complete.wav");
 
error ("Stopped burn at: " .. stop_at_color .. "  Confidence: " .. confidence);
 
 
else
 
else
 
for i = 1, 3 do
 
for i = 1, 3 do
Line 1,230: Line 1,225:
 
error "Canceled";
 
error "Canceled";
 
end
 
end
 +
lsDoFrame();
 +
srReadScreen();
 +
if do_screenshot then
 +
srSaveLastReadScreen("screen_" .. index .. "_" .. t_string .. ".png");
 +
end
 +
 +
if do_end_burn then
 +
clickAllText("Interrupt");
 +
lsPlaySound("Complete.wav");
 +
error ("Stopped burn at: " .. stop_at_color .. "  Confidence: " .. confidence);
 +
end
 +
end
 +
end
 +
</pre>
 +
{{Collapse bottom}}
 +
 +
{{Collapse top|title=Food Timer (IN TESTING v1)}}
 +
<pre>
 +
-- Food stat timer, made by Selune. Version 1.
 +
 +
loadfile("luaScripts/screen_reader_common.inc")();
 +
loadfile("luaScripts/ui_utils.inc")();
 +
 +
per_click_delay = 10;
 +
log_lines = {};
 +
num_log_lines = 10;
 +
food_name = "Blocker";
 +
function log(msg)
 +
lsPrintln(msg);
 +
if #log_lines == num_log_lines then
 +
for i=1,num_log_lines-1 do
 +
log_lines[i] = log_lines[i+1];
 +
end
 +
log_lines[num_log_lines] = msg;
 +
else
 +
log_lines[#log_lines+1] = msg;
 +
end
 +
end
 +
 +
local last_time = 0;
 +
function timedLog(new_time)
 +
local timeDiff;
 +
 +
timeDiff = new_time - last_time;
 +
last_time = new_time;
 +
 +
log(food_name .. " -- Duration: " .. math.floor(timeDiff / 1000 / 60) .. ":" .. math.mod(timeDiff / 1000, 60));
 +
end
 +
 +
function askForImage()
 +
haveCoords = false;
 +
go_now = false;
 +
while not go_now do
 +
checkBreak();
 +
srReadScreen();
 +
mouse_x, mouse_y = srMousePos();
 +
local y = 10;
 +
local x = 40;
 +
 +
if not have_coords then
 +
lsPrintWrapped(x, y, 1, lsScreenX - x - 10, 0.7, 0.7, 0xFFFFFFff,
 +
"Put your mouse in the top left of the Strength stat NUMBER. You should see all stat values in the preview. It doesn't have to be perfect!");
 +
 +
srMakeImage("CUSTOM", mouse_x, mouse_y, 10, 100);
 +
if lsShiftHeld() then
 +
saved_x = mouse_x;
 +
saved_y = mouse_y;
 +
have_coords = true;
 +
end
 +
else
 +
lsPrintWrapped(x, y, 1, lsScreenX - x - 10, 0.7, 0.7, 0xFFFFFFff,
 +
"Coords chosen, press 'Reset' to change or 'Do It' to start.");
 +
srMakeImage("CUSTOM", saved_x, saved_y, 10, 100);
 +
end
 +
 +
if have_coords then
 +
if lsButtonText(10, lsScreenY - 30, 0, 80, 0xFFFFFFff, "Do It") then
 +
go_now = true;
 +
end
 +
 +
if lsButtonText(100, lsScreenY - 30, 0, 80, 0xFFA500ff, "Reset") then
 +
have_coords = false;
 +
end
 +
end
 +
 +
if lsButtonText(lsScreenX - 100, lsScreenY - 30, 0, 80, 0xFFFFFFff, "Exit") then
 +
error "Canceled";
 +
end
 +
 +
srShowImageDebug("CUSTOM", 8, 8, 1, 3);
 +
lsDoFrame();
 +
end
 +
end
 +
 +
function doit()
 +
askForWindow("Food Timer - Records how long a particular meal lasts, down to the half-second. Works even with aqueduct or other already-running food buffs (So eat blocker first!) Made by Selune!");
 +
askForImage();
 +
srMakeImage("CUR_STATS", saved_x, saved_y, 10, 100);
 +
 +
for i=1, 20 do
 +
log("...");
 +
end
 +
 +
local t0 = lsGetTimer();
 +
local new_time;
 +
while 1 do
 +
local i = 0;
 +
local y = 5;
 +
local x = 40;
 +
local is_done = false;
 +
new_time = lsGetTimer();
 +
checkBreak();
 +
lsSleep(100);
 +
srReadScreen();
 +
 +
lsPrintWrapped(x, y, 1, lsScreenX - x - 10, 1, 1, 0xFFFFFFff,
 +
"Now recording, eat up!");
 +
 +
y = y + 25;
 +
lsPrintWrapped(x, y, 1, lsScreenX - x - 10, 1, 1, 0xFF2020ff,
 +
"Remember to block first!");
 +
 +
y = y + 30;
 +
lsPrintWrapped(x, y, 1, lsScreenX - x - 10, 0.7, 0.7, 0xC0C0C0ff,
 +
"Name (for log):");
 +
 +
y = y + 20;
 +
is_done, food_name = lsEditBox("Food Name:", x, y, z, 250, 30, 0.7, 0.7, 0x000000ff, food_name);
 +
 +
if not srFindImageInRange("CUR_STATS", saved_x, saved_y, 10, 100) then
 +
lsSleep(500);
 +
srReadScreen();
 +
srMakeImage("CUR_STATS", saved_x, saved_y, 10, 100);
 +
for i = 1, 3 do
 +
lsPlaySound("Clank.wav");
 +
lsSleep(100);
 +
end
 +
timedLog(new_time - t0);
 +
end
 +
 +
y = y + 30;
 +
if #log_lines then
 +
for i=1, #log_lines do
 +
lsPrint(x + 10, y, 1, 0.7, 0.7, 0x808080ff, log_lines[i]);
 +
y = y + 15;
 +
end
 +
end
 +
 +
if lsButtonText(lsScreenX - 110, lsScreenY - 30, 0, 100, 0xFFFFFFff, "Exit") then
 +
error "Canceled";
 +
end
 +
 +
srShowImageDebug("CUR_STATS", 8, 8, 1, 3);
 
lsDoFrame();
 
lsDoFrame();
 
end
 
end

Latest revision as of 21:04, 9 February 2013

Selune's Macros have been updated to the TaleScripts repository. Please leave any ideas for improvements or new macros here.