--- <b><u>TODO</u></b> speedwalktimer()
function speedwalktimer(walklist, walkdelay)
send(walklist[1])
table.remove(walklist, 1)
if #walklist>0 then
tempTimer(walkdelay, function() speedwalktimer(walklist, walkdelay) end)
end
end
--- <b><u>TODO</u></b> speedwalk(dirString, backwards, delay)
function speedwalk(dirString, backwards, delay)
local dirString = dirString:lower()
local walklist = {}
local walkdelay = delay
local reversedir = {
n = "s",
en = "sw",
e = "w",
es = "nw",
s = "n",
ws = "ne",
w = "e",
wn = "se",
u = "d",
d = "u",
ni = "out",
tuo = "in"
}
if not backwards then
for count, direction in string.gmatch(dirString, "([0-9]*)([neswudio][ewnu]?t?)") do
count = (count == "" and 1 or count)
for i=1, count do
if delay then walklist[#walklist+1] = direction
else send(direction)
end
end
end
else
for direction, count in string.gmatch(dirString:reverse(), "(t?[ewnu]?[neswudio])([0-9]*)") do
count = (count == "" and 1 or count)
for i=1, count do
if delay then walklist[#walklist+1] = reversedir[direction]
else send(reversedir[direction])
end
end
end
end
if walkdelay then
speedwalktimer(walklist, walkdelay)
end
end
Improved Speedwalk Function from Other.lua
Improved Speedwalk Function from Other.lua
I rewrote these functions so that they no longer set or use any global variables while still working exactly the same way.
Re: Improved Speedwalk Function from Other.lua
Thank you! I've added it in, and wrote a suite of tests for speedwalk() while at it as well.
(I'll get to the improved db:create next when I can)
(I'll get to the improved db:create next when I can)