modify digger script

This commit is contained in:
sfokin 2025-04-06 06:02:14 +03:00
parent 234e769fe9
commit 42b098cbb7

View File

@ -72,6 +72,11 @@ local function drawui()
name="btnyinc",
label="y+",
Y=1.6, X=0.8, H=0.8, W=1.2,
},{
command="addbutton",
name="btnup",
label="^",
Y=1.6, X=0, H=0.8, W=0.6,
},{
command="addbutton",
name="btnzinc",
@ -151,17 +156,15 @@ updatepositionui()
end
local function sendmessage(msg)
if not mem.orderId then return end
local str = "q" .. tostring(mem.orderId)
digiline_send(str, msg)
-- digiline_send("q2", msg)
-- digiline_send("q3", msg)
-- digiline_send("q4", msg)
-- digiline_send("q5", msg)
-- digiline_send("q6", msg)
-- digiline_send("q7", msg)
-- digiline_send("q8", msg)
-- digiline_send("q9", msg)
digiline_send("q1", msg)
digiline_send("q2", msg)
digiline_send("q3", msg)
digiline_send("q4", msg)
digiline_send("q5", msg)
digiline_send("q6", msg)
digiline_send("q7", msg)
digiline_send("q8", msg)
digiline_send("q9", msg)
end
local function displayQuarryStatus(mon, msg, name)
@ -186,6 +189,7 @@ end
if event.type == "program" then
mem.position = {x = 0, y = 0, z=0}
mem.target = {x = 0, y = 0, z=0}
mem.radius = 8
mem.step = 17
mem.sim = false
mem.msg = ""
@ -224,7 +228,8 @@ elseif event.type == "digiline" and event.channel == "jumpdrive" then
elseif event.type == "interrupt" then
digiline_send("pmhv", "get")
digiline_send("nuclear", "get")
sendmessage("GET")
local str = "q" .. tostring(mem.orderId)
digiline_send(str, "get")
mem.orderId = mem.orderId + 1
if mem.orderId > 9 then mem.orderId = 1 end
interrupt(5)
@ -238,6 +243,9 @@ elseif event.type == "digiline" and event.channel == "touch" then
if mem.step < 1 then
mem.step = 1
end
elseif event.msg.btnup then
local y = mem.target.y + mem.radius
digiline_send("jumpdrive", { command = "set", key = "y", value = y })
elseif event.msg.btnxinc then
local x = mem.target.x + mem.step
digiline_send("jumpdrive", { command = "set", key = "x", value = x })