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
Line 838: Line 838:
 
{{Collapse bottom}}
 
{{Collapse bottom}}
  
{{Collapse top|title=New Raeli Oven Monitor (IN TESTING v2)}}
+
{{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,231: Line 1,226:
 
end
 
end
 
lsDoFrame();
 
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
 
end
 
end
 
</pre>
 
</pre>
 
{{Collapse bottom}}
 
{{Collapse bottom}}

Revision as of 16:35, 16 January 2013

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