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

Need help with redirecting the terminal through modem cable.

Started by D3athbysp0rk, 02 April 2014 - 05:52 AM
D3athbysp0rk #1
Posted 02 April 2014 - 07:52 AM
so here's my lock code, I've kinda thrown bits and chunks of it together from other codes and my very basic knowledge of lua… but could someone assist me with redirecting what's written on the monitor through a modem cable, thank the monitor is also name 'monitor_0' when it's connected to the cable. the monitor is 3x1 blocks if this helps at all? thank you!


os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1,1)
print ("Zared's Security System Initialized")
local monitor = peripheral.wrap("monitor_0")
monitor.write("Zared's Vault Lock V2.6.11")
write("Password: ")
local input = read("*")
if input == "Synapse" then
  term.clear()
  term.setCursorPos(1,1)
  print ("correct! See monitor for details")
  local monitor = peripheral.wrap("monitor_0")
  term.redirect( monitor)
  print("Password Correct...")
  sleep(3)
  print("Establishing uplink to Partical Matrix.")
  sleep(3)
  print("Uplink established!")
  print("Threading code.")
  sleep(3)
  print("Setting Forcetron Partical Matrix State to: 'False'")
  sleep(3)
  print("Injection complete!")
  print("Disabling particles: True")
  sleep(2)
  term.clear()
  term.setCursorPos(1,1)
  term.restore()
  rs.setOutput("left",true)
  sleep(6)
  rs.setOutput("left",false)
  term.clear()
  term.setCursorPos(1,1)
else
  print("Password Incorrect!")
  sleep(2)
  term.clear()
  term.setCursorPos(1,1)
  term.restore()
  sleep(2)
  term.clear()
  term.setCursorPos(1,1)
  end
end
Edited on 03 April 2014 - 12:16 AM
CometWolf #2
Posted 02 April 2014 - 02:45 PM
Just change the wrapping to whatever the monitor's new name is

local monitor = peripheral.wrap("monitor_0")
D3athbysp0rk #3
Posted 03 April 2014 - 02:18 AM
Just change the wrapping to whatever the monitor's new name is

local monitor = peripheral.wrap("monitor_0")

i tried this, i'm getting
startup: 7: attempt to index ? (a nil value)

i updated the code above, any idea what's wrong?
Lyqyd #4
Posted 03 April 2014 - 04:37 AM
If the code in the OP is current like your post suggests, it means that either the monitor isn't named monitor_0 or the monitor isn't connected to the computer that the code is being run on.
D3athbysp0rk #5
Posted 03 April 2014 - 05:52 AM
If the code in the OP is current like your post suggests, it means that either the monitor isn't named monitor_0 or the monitor isn't connected to the computer that the code is being run on.

you're right. XD i'm a derp. i forgot to use the place a wired modem on the computer aswell. l0l.