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 1,236: Line 1,236:
 
error ("Stopped burn at: " .. stop_at_color .. "  Confidence: " .. confidence);
 
error ("Stopped burn at: " .. stop_at_color .. "  Confidence: " .. confidence);
 
end
 
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();
 
end
 
end
 
end
 
end
 
</pre>
 
</pre>
 
{{Collapse bottom}}
 
{{Collapse bottom}}

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.