An idea for a dynamically re-programmable Roguelike.

patternsidea.lua 673B

123456789101112131415161718192021222324
  1. -- PATTERN: table of patterns to be sent on initialization and/or
  2. -- after "program" channel receives a pattern table
  3. -- Patterns individually sent on "setsort"
  4. -- Completion message sent on "status"
  5. function send()
  6. if mem.send > 0 then
  7. digiline_send("setsort", PATTERN[mem.send])
  8. mem.send = mem.send - 1
  9. interrupt(1.2)
  10. elseif mem.send == 0 then
  11. digiline_send("status", "Programming complete.")
  12. else
  13. mem.send = #PATTERN
  14. interrupt(1.2)
  15. end
  16. end
  17. if (event.type == "program" and PATTERN) or event.type == "interrupt" then
  18. send()
  19. elseif event.type == "digiline" and event.channel == "program" then
  20. PATTERN = event.msg
  21. send()
  22. end