This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Legless's profile picture

Help with DW20's code.

Started by Legless, 19 May 2013 - 06:55 AM
Legless #1
Posted 19 May 2013 - 08:55 AM
Hi, guys.
Recently I watched direwolf20's video. This is a CC Advanced Monitors spotlight.
http://www.youtube.com/watch?v=5dD4gg108Z8
Here is the link to his program.
http://pastebin.com/x8G3JKWg

It's quite easy. There are some buttons on monitor, which are changing their colors, when clicked.
I want to add some actions too.
For example, first button shut/open the door (emit redstone signal from the left), second one on/off Nuclear Reactor (emit redstone signal from the right). And I'm stuck. I'm trying to add a condition (which button is pressed) into the code below, but get failed a lot of times. Any ideas? It will be better if number of buttons can be easily multiplied,



function screen()
   local currColor
   for name,data in pairs(button) do
      local on = data["active"]
      if on == true then currColor = colors.lime else currColor = colors.red end
      fill(name, currColor, data)
   end
end

=====

Another small question.
Sometimes I need to write a start-up message on monitor for my neighbours. I have to edit startup everytime I need.
It looks like

mon = peripheral.wrap("top")
mon.clear()
mon.setCursorPos(1,1)
mon.write("bla-bla-bla")
Nothing hard, but if I need a lot of strings of "bla-bla-bla", it irritates. Is there any quicker solutions?
Lyqyd #2
Posted 20 May 2013 - 12:23 AM
Split into new topic. A title was provided for you.