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

[SOLVED] Colorcheck program, window:48: expected number. Please help quick!

Started by RainbowCow, 26 January 2015 - 06:03 PM
RainbowCow #1
Posted 26 January 2015 - 07:03 PM
I've tried to figure this out, but I can't. I'm making a color check program, which just looks through the colors, and prints them on the screen.

But I get "window:48: expected number". I tried looking at other posts, but wouldn't work. Please help.



-- Setup

term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.grey)
textutils.slowPrint("Color check, started.")
sleep(2)
term.clear()
term.setCursorPos(27,3)

-- Code

term.setTextColor("colors.white")
textutils.slowPrint("White.")
print(" ")
sleep(1)
term.setTextColor("colors.grey")
textutils.slowPrint("Grey.")
print(" ")
sleep(1)
term.setTextColor("colors.blue")
textutils.slowPrint("Blue.")
print(" ")
sleep(1)
term.setTextColor("colors.cyan")
textutils.slowPrint("Cyan.")
print(" ")
sleep(1)
term.setTextColor("colors.darkblue")
textutils.slowPrint("Darkblue.")
print(" ")
sleep(1)
term.setTextColor("colors.lightblue")
textutils.slowPrint("Lightblue.")
print(" ")
sleep(1)
term.setTextColor("colors.red")
textutils.slowPrint("Red.")
print(" ")
sleep(1)
term.setTextColor("colors.darkred")
textutils.slowPrint("Darkred.")
print(" ")
sleep(1)
term.setTextColor("colors.green")
textutils.slowPrint("Green.")
print(" ")
sleep(1)
term.setTextColor("colors.lime")
textutils.slowPrint("Limegreen.")
print(" ")
sleep(1)
term.setTextColor("colors.yellow")
textutils.slowPrint("Yellow.")
print(" ")
sleep(1)
term.setTextColor("colors.pink")
textutils.slowPrint("Pink.")
print(" ")
sleep(1)
term.setTextColor("colors.purple")
textutils.slowPrint("Purple.")
print(" ")
sleep(1)
term.setTextColor("colors.Black")
term.setBackgroundColor("colors.grey")
textutils.slowPrint("Black.")
print(" ")
sleep(1)
term.setBackgroundColor("colors.black")

Thanks!
Edited on 27 January 2015 - 06:40 PM
KingofGamesYami #2
Posted 26 January 2015 - 07:13 PM
The error is within window. This tells us you are calling a term method incorrectly, with a value that isn't a number.

In this case, you are setting the text color to a string.


--#correct
term.setTextColor( colors.red )
term.setTextColor( colours.red )
term.setTextColor( 16384 )
--#incorrect
term.setTextColor( "colors.red" )
RainbowCow #3
Posted 26 January 2015 - 10:15 PM
Oh.. That is very correct, I must have been away while writing it.. thanks!