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

Color and erroring

Started by KoopaTheTurtle, 23 June 2017 - 07:37 AM
KoopaTheTurtle #1
Posted 23 June 2017 - 09:37 AM
Hey guys. I have been following a Youtube video on how to make a Program to read BigReactors and display the data. He got 3 errors (two was forgetting to close a bracket) and the last one was due to color. what he had was

display.setBackgroundColor(color.blue)
he said to fix it was to change the color.blue to colors.blue
but this isnt working for me

reactor = peropheral.wrap("back")
display = peripheral.wrap("right")
display.setBackgroundColor(colors.red)
while true do
	display.clear()
	power = reactor.getEnergyStored()
	fuel = reactor.getFuelAmount()
	max = reactor.getFuelAmountMax()
	display.setCursorPos(1,1)
	display.write("Power: ")
	display.setCursorPos(8,1)
	display.write(power)
	display.setCursorPos(1,4)
	display.write("Fuel % ")
	display.setCursorPos(8,4)
	display.write(math.floor((fuel/max)*100))
	if power >= 9000000 then
	reactor.setActive(false)
	end
	if power <= 2500000 then
	reactor.setActive(true)
	end
	sleep(10)
end
Edited on 24 June 2017 - 05:11 AM
KingofGamesYami #2
Posted 23 June 2017 - 12:03 PM
Are you certain there is a monitor on the right side of the computer?
Bomb Bloke #3
Posted 23 June 2017 - 12:10 PM
but this isnt working for me

So what IS happening? If you're getting an error, what does it say?
KoopaTheTurtle #4
Posted 24 June 2017 - 05:43 AM
Are you certain there is a monitor on the right side of the computer?

I have it so the Computer Port is on the right side of the reactor going into the left side of the computer, i then have it coming from the right side of the monitor into the right side of a 2*3 monitor

but this isnt working for me
So what IS happening? If you're getting an error, what does it say?
startup:1: attempt to index ? (a nil value)
KoopaTheTurtle #5
Posted 24 June 2017 - 07:10 AM
I found the problem. Spelling mistake on my end for peripheral on the 1st line. Im now getting the attempt nil error on line 3 which is the
display.setBackgroundColor(colors.pink)
Bomb Bloke #6
Posted 24 June 2017 - 07:40 AM
If you're getting an attempt to index nil, then no peripheral was found to the right. If you're getting an attempt to call nil, then a peripheral was found, but it's not a monitor.

Remember that peripherals connected via wired modems must be wrapped using the network name you were given when you activated the modem.