From 81a06dc0541ae4e765db1d039389cd2a4e2826a3 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 17 Aug 2018 09:49:26 -0400 Subject: [PATCH] add a command to immediately scroll the displayed message by one step to be used in lieu of the three existing auto-scroll commands in case you want the LuaC to handle the stepping. --- README.md | 1 + init.lua | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f21998..05c637b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The panels also respond to these control messages: * "start_scroll" starts the last-displayed message scrolling to the left, automatically moving, and automatically re-starting. The scroll action will spread across and down a multi-line wall (just set a new, different channel on the first row you want to exclude). * "stop_scroll" actually does nothing, since all printable messages automatically stop the timer, but it's a human-readable way to indicate it. * "scroll_speed" followed by a decimal number (in the string, not a byte value) sets the time between scroll steps. Minimum 0.5s, maximum 5s. +* "scroll_step" will immediately advance the last-displayed message by one character. Omit the "start_scroll" and "scroll_speed" keywords, and use this instead if you want to let your LuaController control the scrolling speed. If you need vertical scrolling, you will have to handle that yourself (since the size of a screen/wall is not hard-coded). diff --git a/init.lua b/init.lua index e7fc944..c3f8cd6 100644 --- a/init.lua +++ b/init.lua @@ -175,13 +175,14 @@ local on_digiline_receive_string = function(pos, node, channel, msg) if setchan ~= channel then return end if msg and msg ~= "" and type(msg) == "string" then - led_marquee.set_timer(pos, 0) if string.len(msg) > 1 then if msg == "off_multi" or msg == "clear" then + led_marquee.set_timer(pos, 0) msg = string.rep(" ", 1024) meta:set_string("last_msg", msg) led_marquee.display_msg(pos, channel, msg) elseif msg == "allon_multi" then + led_marquee.set_timer(pos, 0) msg = string.rep(string.char(144), 1024) meta:set_string("last_msg", msg) led_marquee.display_msg(pos, channel, msg) @@ -190,13 +191,17 @@ local on_digiline_receive_string = function(pos, node, channel, msg) if not timeout or timeout < 0.5 or timeout > 5 then timeout = 0 end led_marquee.set_timer(pos, timeout) elseif msg == "stop_scroll" then - return -- (the timer is already stopped by receipt of a message) + led_marquee.set_timer(pos, 0) + return elseif string.sub(msg, 1, 12) == "scroll_speed" then local timeout = tonumber(string.sub(msg, 13)) if not timeout or timeout < 0.5 or timeout > 5 then timeout = 0 end meta:set_int("timeout", timeout) led_marquee.set_timer(pos, timeout) + elseif msg == "scroll_step" then + led_marquee.scroll_text(pos) else + led_marquee.set_timer(pos, 0) meta:set_string("last_msg", msg) led_marquee.display_msg(pos, channel, msg) end