mirror of
https://github.com/mt-mods/led_marquee.git
synced 2024-11-30 19:13:47 +01:00
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.
This commit is contained in:
parent
d47f2746d7
commit
81a06dc054
@ -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).
|
||||
|
||||
|
9
init.lua
9
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
|
||||
|
Loading…
Reference in New Issue
Block a user