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

:17: expected string, number

Started by FrozenFirebat, 06 January 2013 - 03:16 PM
FrozenFirebat #1
Posted 06 January 2013 - 04:16 PM
I get a :17: expected string, number error – And I can't seem to figure out the error.


local function White()
redstone.setBundledOutput("back", colors.white)
sleep(1)
redstone.setBundledOutput("back", 0)
end
local function Red()
redstone.setBundledOutput("back", colors.red)
sleep(1)
redstone.setBundledOutput("back", 0)
end
local function Yellow()
redstone.setBundledOutput("back", colors.yellow)
sleep(1)
redstone.setBundledOutput("back", 0)
end
local function Orange()
redstone.setBundledOutput("back", colors.orange)
sleep(1)
redstone.setBundledOutput("back", 0)
end
local function Movedown()
local i = 1
repeat
  White()
  Sleep(2)
  Red()
  Sleep(3)
  i = i + 1
until i == 100
end
local function Moveup()
local j = 1
repeat
  Yellow()
  Sleep(5)
  j = j + 1
until j == 100
end
local function Movesouth()
local k = 1
repeat
  Orange()
  Sleep(2)
  Red()
  Sleep(3)
  k = k + 1
until k == 17
end


while true do
Movesouth()
Sleep(1)
Movedown()
Sleep(1)
Moveup()
Sleep(1)
end
Kingdaro #2
Posted 06 January 2013 - 04:47 PM
It's saying colors.orange doesn't exist but I'm not sure why.
FrozenFirebat #3
Posted 06 January 2013 - 04:51 PM
Yeah if I change the colors.orange to colors.white on line 17… the program actually runs, lights up white once, and then gives me :43: attempt to call nil
Kingdaro #4
Posted 06 January 2013 - 05:01 PM
I don't see anywhere you've defined "Sleep" with a capital S, so just lowercase every usage of Sleep(). Also, with the colors.orange issue, either check that you haven't made any sort of typo anywhere, and if it still doesn't work, just use 2 instead of colors.orange.
FrozenFirebat #5
Posted 06 January 2013 - 05:04 PM
Thx. I wasn't aware that it required case sensitivity
Dusty_Rebel #6
Posted 06 January 2013 - 05:07 PM
I See you are making an airship… Are You?
FrozenFirebat #7
Posted 06 January 2013 - 05:20 PM
flying quarry.

It's got a 17x17 bore head, and it should move south 17 blocks, then try to drill 100x times and then try to retract the arm 100 times….
remiX #8
Posted 06 January 2013 - 11:29 PM
Try colours.orange? O.o

In a another program do this:

a = fs.open("file.txt", "w")
for i, col in pairs(colors) do
    print(col)
    a.writeLine(col)
end
a.close()

And paste the output from the 'file.txt' file here