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

How to make computers run commands after redstone hits

Started by diamondpumpkin, 19 April 2015 - 12:56 AM
diamondpumpkin #1
Posted 19 April 2015 - 02:56 AM
When I try to put rednet wiring (from Minefactory reloaded) into a computer try to make it run a command when the power gets to it. Idk what I'm doing wrong in the coding.

Note: I am VERY new to coding, I've barely gotten a scratch into it yet.

Code:
http://imgur.com/rTvwvsC
Lyqyd #2
Posted 19 April 2015 - 04:02 AM
Moved to Ask a Pro.
HPWebcamAble #3
Posted 19 April 2015 - 04:51 AM
You can put your code on the forums in between code tags ( [.code] [./code] , without the periods )

Here is your code, tweaked a bit:

m = peripheral.wrap("back") --# Wrap the monitor

while true do
  os.pullEvent("redstone") --# Wait for redstone to change in some way
  if redstone.testBundledInput("right", colors.white) then --# Check to see if the white color is on
    rs.setOutput("top", true) --# Turn on the top redstone output
    m.clear()
    m.setTextScale(1)
    m.setTextColor(colors.lime) --# colors.color is the same as just the number
    m.setCursorPos(1, 1)
    m.write("Open")
  else --# Otherwise
    rs.setOutput("top", false) --# Turn off the top redstone output
  end
end