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

redstone activated terminal

Started by Darth_Ben17, 25 September 2013 - 07:46 PM
Darth_Ben17 #1
Posted 25 September 2013 - 09:46 PM
I need a code so that a computer will activate when I press a button or pull a lever

I will later make a code on a different computer to activate tis terminal
Lyqyd #2
Posted 25 September 2013 - 11:35 PM
Split into new topic.

Please post your current code.
Darth_Ben17 #3
Posted 25 September 2013 - 11:47 PM
I just want it to activate with/without redstone signal so I can have some standard programs but there will be nothing else in startup
Lyqyd #4
Posted 25 September 2013 - 11:51 PM
This should help you get started.
Darth_Ben17 #5
Posted 25 September 2013 - 11:55 PM
if not I would have this is startup:

function os.pullEvent()
local event, p1, p2, p3, p4, p5
if event == "terminal" then
end
return event, p1, p2, p3, p4, p5
end
term.clear()
term.setCursorPos(1, 1)
print "Enter Password"
print " "
write("Password:")
correctpass = "123"  -- not the actual password
pass = read("*")
if pass == (correcrpass) then
term.clear()
term.setCursorPos(1, 1)
write("Correct")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
print "Welcome"
term.setCursorPos(1, 3)
else
print " "
write("Incorrect")
sleep(2)
shell.run("startup")
end

sorry typo I meant have it in startup

Ive already checked out that and im new to CC so I don't really get it :(/>

I found this code but it only activates not deactivate

while true do
os.pullEvent("redstone")
if rs.getInput("back") then
break
end
end
BigTwisty #6
Posted 26 September 2013 - 05:23 PM
You are incredibly unclear about what you mean by "activate". Do you want it to run a program when a redstone signal is applied, and then stop that program when the redstone signal goes away? If so, then the "deactivation" would need to be part of the program that runs.

startup:

while true do
  _,side = os.pullEvent("redston")
  if side == "back" then
	shell.run("prog")
  end
end

prog:

begin
  -- Do stuff
  -- Kick dog
  -- Make fun of Lyqyd
  -- Get banned from CC forum
until not rs.getInput("back")