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

Reactor+computer

Started by Radekva, 05 January 2013 - 07:16 AM
Radekva #1
Posted 05 January 2013 - 08:16 AM
Hello guys! I have got problem with my computer in tekkit.
i can't connect Bundled cable with pc, can someone edit this program for Bundled cable please I do it already third day and i can't do it.

reactors = rs.getOutput("bottom")
if reactors == false then
reactors = "Reactor zapnut"
end
if reactors == true then
reactors = "Reactors vypnut"
end
shell.run("clear")
local function centerText (text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
centerText("------------My Software-----------")
term.setCursorPos(1,3)
centerText("------Reactor Control Panel-------")
term.setCursorPos(1,4)
centerText("--------------V1.1----------------")
term.setCursorPos(1,6)
print("")
centerText("on : off")
print("")
centerText("--Online statistiky--")
print("")
centerText("Power",reactors)
centerText(reactors)
write("Prikaz zde: ")
input = read()
if input == "on" then
rs.setOutput("bottom", false)
print("Reactor zapnut! Dbejte zvysene opatrnosti!")
end
if input == "off" then
rs.setOutput("bottom",true)
print("Reactor vypnut! Do uplneho vypnuti zbyva 5min")
end
write("Copyright")
sleep(2)
shell.run("clear")
shell.run("startup")


i try it this

redstone.getBundledOutput("bottom")
if reactors == false then
reactors = "Reactor zapnut"
end

if reactors == true then
reactors = "Reactors vypnut"
end

shell.run("clear")
local function centerText (text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
print(text)
end

centerText("———My Software———")
term.setCursorPos(1,3)
centerText("——Reactor Control Panel——-")
term.setCursorPos(1,4)
centerText("————–V1.1—————-")
term.setCursorPos(1,6)
print("")
centerText("on : off")
print("")
centerText("–Online statistiky–")
print("")
centerText("Power",reactors)
centerText(reactors)
write("Prikaz zde: ")
input = read()
if input == "on" then
redstone.setBundledOutput("bottom", colors.blue)
print("Reactor zapnut! Dbejte zvysene opatrnosti!")
sleep(2.0)
end
sleep(2)
if input == "off" then
redstone.setBundledOutput("bottom", colors.blue)
print("Reactor vypnut! Do uplneho vypnuti zbyva 5min")
sleep(2.0)
end

write("Copyright")
sleep(2)
shell.run("clear")
shell.run("startup")



but not working :(/>
please help me
Lyqyd #2
Posted 05 January 2013 - 09:00 AM
Please post a screenshot of how you have the cable connected to the bottom of the computer. You can use imgur.com for free image hosting, if necessary.
Radekva #3
Posted 05 January 2013 - 09:45 AM
There is in the first code and it worked
http://i.imgur.com/JUh47.png
and here is Bundled cable
http://i.imgur.com/Q01kN.png
ChunLing #4
Posted 05 January 2013 - 10:24 AM
For bundled cable, you'll want to use the Bundled functions, rs.getBundledInput(), rs.getBundledOutput(), rs.testBundledInput(), and rs.setBundledOutput(). These functions use colors from the colors API.

Oh, wait, I wasn't reading your second code (because it's all full of http formatting codes).

You forgot to assign reactors = rs.getBundledOutput("bottom")

And then you didn't update the reactors conditionals to use colors returns rather than booleans.
Edited on 05 January 2013 - 09:28 AM
Radekva #5
Posted 05 January 2013 - 10:49 AM
yeah html codes I got there when copying;) otherwise after adding reactors = just not working write "off" and the test lamp turns on but when I select "on" so lamp not turn off: (how can I replace it with false bundled cable? (rs.setOutput ("bottom", false))
Lyqyd #6
Posted 05 January 2013 - 11:01 AM
rs.setBundledOutput("bottom", 0) will turn it off again.
Radekva #7
Posted 06 January 2013 - 12:51 AM
reactors = redstone.getBundledOutput("bottom")
if reactors == false then
reactors = "Reactor zapnut"
end
if reactors == true then
reactors = "Reactors vypnut"
end[/font][/color]
shell.run("clear")
local function centerText (text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()

term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
centerText("———My Software———")
term.setCursorPos(1,3)
centerText("——Reactor Control Panel——-")
term.setCursorPos(1,4)
centerText("————–V1.1—————-")
term.setCursorPos(1,6)
print("")
centerText("on : off")
print("")
centerText("–Online statistiky–")
print("")
centerText("Power",reactors)
centerText(reactors)
write("Prikaz zde: ")
input = read()
if input == "on" then
redstone.setBundledOutput("bottom", colors.blue, 0)
print("Reactor zapnut! Dbejte zvysene opatrnosti!")
sleep(2.0)
end
sleep(2)
if input == "off" then
redstone.setBundledOutput("bottom", colors.blue, 1)
print("Reactor vypnut! Do uplneho vypnuti zbyva 5min")
sleep(2.0)
end
write("Copyright")
sleep(2)
shell.run("clear")
shell.run("startup")



I erased the html codes
I put rs.setBundledOutput ("bottom", colors.blue, 0) because the statement rs.setBundledOutput ("bottom", 0) can not be used. Command "on" must only turn off the blue and not all!
It's strange that when you boot the program so blue does not work but when I write either "on" or "off" so it turns on! But it has been turned off.
ChunLing #8
Posted 06 January 2013 - 03:12 AM
If you want to turn off only blue, then use:
rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"),colors.blue))
Likewise, to activate blue without affecting any other color output, use:
rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"),colors.blue))