Jump to content




Simple code that JUST WONT WORK


  • You cannot reply to this topic
2 replies to this topic

#1 Thebenchmark1337

  • New Members
  • 1 posts

Posted 29 June 2016 - 07: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

#2 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 30 June 2016 - 12: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 by Dog, 30 June 2016 - 04:15 AM.


#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 June 2016 - 02: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.

View PostDog, on 30 June 2016 - 12:52 AM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users