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

Need help with a redston/bundled cable program

Started by zz1118, 03 September 2012 - 12:27 AM
zz1118 #1
Posted 03 September 2012 - 02:27 AM
Hey i need some help with a program so that i can activate and deactivate some redstone stuff


I would like it to be a program were it there are multiple options
example:
.forcefield
.quarry

and when you chose it asks how long in seconds you want to keep it on or preferably an on or off option…

thank-you
Kazimir #2
Posted 03 September 2012 - 06:32 AM

--------------------------------------------------
local function timer()
print("For run the quarry enter 'RunQ'")
print("For run the forcefield enter 'RunF'")
local input = read()
term.clear() term.setCursorPos(1,1)
print("Enter working time")
local tim = read()
term.clear() term.setCursorPos(1,1)
---|
    if input == "RunQ" then rs.setBundledOutput("back", 1) end
    if input == "RunF" then rs.setBundledOutput("back", 2) end
---|
sleep(tim)
rs.setBundledOutput("back", 0)
end
--------------------------------------------------
local function start()
print("For run the quarry enter 'RunQ'")
print("For run the forcefield enter 'RunF'")
local input = read()
term.clear() term.setCursorPos(1,1)
---|
    if input == "RunQ" then rs.setBundledOutput("back", 1) end
    if input == "RunF" then rs.setBundledOutput("back", 2) end
---|
print("For stopping the job enter 'stop'")
local s = read()
if s == "stop" then rs.setBundledOutput("back", 0) end
end
--------------------------------------------------
local function option()
print("For launch with timer enter 'LTim'")
print("For launch without timer enter 'LnoTim'")
local opt = read()
term.clear() term.setCursorPos(1,1)
---|
    if opt == "LTim" then timer() end
    if opt == "LnoTim" then start() end
---|
end
--------------------------------------------------
term.clear() term.setCursorPos(1,1)
option()
--------------------------------------------------
zz1118 #3
Posted 03 September 2012 - 08:02 AM
thankyou so much!!!