Jump to content




HELP Power Status Bar

utility computer help

8 replies to this topic

#1 Mimifan2

  • Members
  • 4 posts

Posted 02 July 2014 - 01:43 AM

I'm new to computercraft, but have a good amount of knowledge of other programming languages and I don't understand why I am getting this error.
I'm writing a program to read the energy level from an energy cell ( using a comparator). The signal is then being broken down into three groups, Green, Red, Yellow, then sent by rednet to another computer. This computer is where the problem lies. I'm getting an error "bios:366: [string "startup"]:13: syntax error"

http://pastebin.com/1i3Z3yLx

Any help would be greatly appreciated and if you are interested in the other part I can pastebin that as well, just comment.

  • rednet.open("left")


  • while true do


  • local level = rednet.receive()


  • if level == "Green" then


  • rs.setOutput("top" , true)


  • rs.setOutput("front", true)


  • rs.setOutput("right", true)


  • end


  • if level == "Yellow" then


  • rs,setOutput("front", true)


  • rs.setOutput("right", true)


  • rs.setOutput("top", false)


  • end


  • if level == "Red" then


  • rs.setOutput("right", true)


  • rs.setOutput("top", false)


  • rs.setOutput("front", false)


  • end


  • os.sleep(600)


  • end


#2 joebodo

  • Members
  • 69 posts

Posted 02 July 2014 - 03:03 AM

Line 12 has a comma instead of a period. rs<comma>setOutput

#3 Mimifan2

  • Members
  • 4 posts

Posted 02 July 2014 - 02:43 PM

Thanks, that fixed the problem however now i am getting an error "bios : 366:[string "startup"]:6: ')' expected" Thanks again

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 02 July 2014 - 04:07 PM

there is no reason that error should occur in the script given. Let's take apart your error:
bios : 336:[string "startup"] This means the error is an error in your typing, in the program "startup"
:6: The error occured on line 6
: ')' expected It wanted a ) to close a previous (.

I'm guessing you are missing ) on line 5 of the script you are running, but not the one you posted.

#5 Mimifan2

  • Members
  • 4 posts

Posted 02 July 2014 - 06:27 PM

Here is the new code, still have the same error.
http://pastebin.com/PtDyUVJg

  • rednet.open("left")


  • while true do


  • local level = rednet.receive()


  • if level =="G" then


  • rs.setOutput("top". true)


  • rs.setOutput("front". true)


  • rs.setOutput("right". true)


  • end


  • if level == "Y" then


  • rs,setOutput("front". true)


  • rs.setOutput("right". true)


  • rs.setOutput("top". false)


  • end


  • if level == "R" then


  • rs.setOutput("right". true)


  • rs.setOutput("top". false)


  • rs.setOutput("front". false)


  • end


  • os.sleep(60)


  • end

Thanks for explaining the debugging i was not 100% sure that's how it worked. There is no ( on line 5 so I'm not sure why that error would occur.

#6 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 02 July 2014 - 06:53 PM

Yeah, the only thing I can see out of place is
if level =="G" then
try changing to
if level == "G" then

Are you sure this is the exact script?

#7 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 02 July 2014 - 06:54 PM

On a side note, I'd recommend you put your code in [code] tags. There's a button for it in the editor, that looks like this: <>
It looks so much better if you do.

#8 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 02 July 2014 - 06:56 PM

You can't use periods to separate your function call arguments. Change them to commas.

#9 Mimifan2

  • Members
  • 4 posts

Posted 03 July 2014 - 01:44 AM

Got it to work after some final teeks, if your interested let me know and i will put it on pastebin





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users