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

Simple code that JUST WONT WORK

Started by Thebenchmark1337, 29 June 2016 - 06:47 PM
Thebenchmark1337 #1
Posted 29 June 2016 - 08:47 PM
Literally a super simple code.

What im trying to do here, Is I created a locking mechanism activated by a dandy redstone cable.

Program is called LockDown

term.clear()
term.setCursorPos(1, 1)
Print("Lock Down!")
rs.setBundledOutput("back", 1)
sleep(2)
Print("Lab has been locked")



Thats literally it. Then, for the unlocking

Program is called Unlock

term.clear()
term.setCursorPos(1, 1)
Print("Unlocking Lab!")
rs.setBundledOutput("Back", 0)
sleep(2)
Print("Lab is now open")

The error is

bios:14: [string "LockDown"]:2: ')' expected
Dog #2
Posted 30 June 2016 - 01:52 AM
One thing I see is that you're capitalizing 'print' - it should be all lower case. Capitalization matters in Lua. Also, in your unlock program you have "Back" instead of "back".

Additionally, and to be fair I may be wrong about this, I believe you have to specify *which* cable in a bundled output you wish to signal.
e.g.
rs.setBundledOutput("back", colors.white).

redStone.setBundledOutput on the CC wiki

Although 1 is a valid color number (white?), 0 is not, so that will probably generate an error as well.
Edited on 30 June 2016 - 03:15 AM
Bomb Bloke #3
Posted 30 June 2016 - 03:33 AM
benchmark, the code you're showing us won't produce the error you've quoted (though Dog's right about your capitalisation issues). Check that it matches what you've actually got in the computer; I'm suspecting you may have a period where you intended to put a comma, or somesuch.

Although 1 is a valid color number (white?), 0 is not, so that will probably generate an error as well.

0 indicates "no colours", so it's valid here. You can't use it with a terminal display (ie through term.setTextColour / term.setBackgroundColour), but it's the only way to disable all signals when dealing with a bundled cable.