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

Need help

Started by malymuwme, 30 March 2013 - 09:44 AM
malymuwme #1
Posted 30 March 2013 - 10:44 AM
Hi i have a problem. Iam creating Reactor Control Panel , but my status don't showing right status of the reactors.

Here is the Code :


term.clear()
print("A.R.S. Corporation	 ")
print("		  Presents			")
print("				 Reactor Control Panel")
print("Programed by malymuwme")
print(" ")
print(" ")
print(" ")
print("Reactor Status:")
if rs.getBundledOutput("back",colors.red,false) then
print("Reactor 1 is Offline or not connected")
print("")
else
write("Reactor 1 is Online")
print("")
end
if rs.getBundledInput("back",colors.purple,false) then
print("Reactor 2 is Offline or not connected")
print("")
else
print("Reactor 2 is Online")
print("")
end
print("EU producing:")
print("")
if rs.getBundledInput("back",colors.orange,false) then
print("Reactor 1 is inactive")
print("")
else
print("Reactor 1 is active")
print("")
end
if rs.getBundledInput("back",colors.yellow,false) then
print("Reactor 2 is inactive ")
print("")
else
print("Reactor 2 is active")
print("")
end

Its not finished yet.

Screens of the rooms and cables:
Main Computer:





Cables


Reactor 1 Status :


Reactor 2 Status:

Upper cables


and last EU production status :


At all screens are bundled cables and colored cables.
Brandhout #2
Posted 30 March 2013 - 12:41 PM
Ur not using rs.getBundledInput in the correct way. It requires just a single input a string of the side you are using. Use it like this:

if rs.getBundledOutput("back") == colors.black then
	print("Reactor 1 is Offline or not connected\n")
else
	print("Reactor 1 is Online\n")
end
To check is black is one of the colors that is on use colors.test(….). See wiki for info on this.

You can also use the escape sequence \n to enter the next line.

I've always been using term.write() instead of write() is there a difference?

Edit: minor typo in colors.black
Engineer #3
Posted 30 March 2013 - 12:46 PM
Ur not using rs.getBundledInput in the correct way. It requires just a single input a string of the side you are using. Use it like this:

if rs.getBundledOutput("back") == colos.black then
	print("Reactor 1 is Offline or not connected\n")
else
	print("Reactor 1 is Online\n")
end
To check is black is one of the colors that is on use colors.test(….). See wiki for info on this.

You can also use the escape sequence \n to enter the next line.

I've always been using term.write() instead of write() is there a difference?
No there is not

Edit: There actually is
|
V
Kingdaro #4
Posted 30 March 2013 - 01:14 PM
Yes there is. write() supports the usage of \n and word wrapping. term.write() does not.