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

[Error] bios:206: [string "clock"]:16: unexpected symbol

Started by Tastybeanz, 30 January 2013 - 07:32 AM
Tastybeanz #1
Posted 30 January 2013 - 08:32 AM
Hi, trying to write a clock that will count and show on my monitors, doesn't really seem to be going well. Not sure what's going on, but if someone could help, I'd appreciate it.
Lyqyd #2
Posted 30 January 2013 - 08:35 AM
Split into new topic.

Please provide the full code you are using.
Tastybeanz #3
Posted 30 January 2013 - 08:46 AM
Here's my code so far
local mon = peripheral.wrap("left")
function rond(num, idp)
local mult = 10^ (idp or 0)
return math.floor(num * mult +o.5) / mult
end
function loop()
while true do
mon.clear()
mon.SetCursorPos(1,1)
mon.setTextScale(3)
z = os.time()
if z < 12 then
y = z
a = y%1
h = y - a
b = a * 60
m = round( B)/>
if m >= 10 then
min = m
elseif m < 10 then
min = "0"..m
end
if h < 1 then
hour = 12
elseif h >= 1 then
hour = h
end
x = hour..":"..min.." AM"
elseif z > 12 then
a = y%1
h = y - a
b = a * 60
m = round( B)/>
if m >= 10 then
min = m
elseif m < 10 then
min = "0"..m
end
if h < 1 then
hour = 12
elseif h >= 1 then
hour = h
end
x = hour..":"..min.." PM"
end
mon.write (x)
sleep(1)
end
end
loop()
NeverCast #4
Posted 30 January 2013 - 08:56 AM
Lack of indentation makes me cry!
That said there is nothing called clock in that code.

Is there anything else you're doing?
How are you trying to run the program?


return math.floor(num * mult +o.5)

Should be 0.5, not o.5


m = round( B)/>

Not sure where that /> came from, but shouldn't be there
Tastybeanz #5
Posted 30 January 2013 - 09:00 AM
Monitor left disk/clock is what I'm trying to do and I'm sure I'm not doing anything else other than this.
Lyqyd #6
Posted 30 January 2013 - 09:01 AM
Your function's name is "rond" but you're calling "round". There are a number of other problems with the code, such as the one mentioned above and the use of SetCursorPos as opposed to setCursorPos.
Tastybeanz #7
Posted 30 January 2013 - 09:02 AM
Lack of indentation makes me cry!
That said there is nothing called clock in that code.

Is there anything else you're doing?
How are you trying to run the program?


return math.floor(num * mult +o.5)

Should be 0.5, not o.5


m = round( B)/>

Not sure where that /> came from, but shouldn't be there
Hmm, that /> Isn't showing up in my code. I'll try the o.5 though.
NeverCast #8
Posted 30 January 2013 - 09:03 AM
local mon = peripheral.wrap("left")


You can just term.redirect(peripheral.wrap("left"))
Then monitor left blah wont be required.

That said fix those few errors. Also if you could tell me what is on line 16. That'd be great.
NeverCast #9
Posted 30 January 2013 - 09:04 AM
Your function's name is "rond" but you're calling "round". There are a number of other problems with the code, such as the one mentioned above and the use of SetCursorPos as opposed to setCursorPos.

Nice spotting on that one Lyqyd.
Without indenting my bug spotting ability gets a -5 Efficiency
Tastybeanz #10
Posted 30 January 2013 - 09:05 AM
Your function's name is "rond" but you're calling "round". There are a number of other problems with the code, such as the one mentioned above and the use of SetCursorPos as opposed to setCursorPos.
Sorry, that .SetCursorPos is just a typo, it's .setCursorPos in the actual code.
NeverCast #11
Posted 30 January 2013 - 09:05 AM
why you no copy paste?
Tastybeanz #12
Posted 30 January 2013 - 09:13 AM
local mon = peripheral.wrap("left")


You can just term.redirect(peripheral.wrap("left"))
Then monitor left blah wont be required.

That said fix those few errors. Also if you could tell me what is on line 16. That'd be great.
line 16 should be
b = a * 60
Tastybeanz #13
Posted 30 January 2013 - 09:17 AM
Hmm, made all the changes you suggested, and now I'm getting bios:206: [string "clock"]:1: '=' expected.
NeverCast #14
Posted 30 January 2013 - 09:19 AM
Try running the clock without using the monitor. We might get better error messages.
Tastybeanz #15
Posted 30 January 2013 - 09:20 AM
Try running the clock without using the monitor. We might get better error messages.
Well now I'm getting bios:206: [string "clock"]:4: ')' expected
NeverCast #16
Posted 30 January 2013 - 09:34 AM
Can you pastebin your actual code please? Instead of writing it out?
Tastybeanz #17
Posted 30 January 2013 - 09:50 AM
Sorry, complete noob here. How would I do that?
Tastybeanz #18
Posted 30 January 2013 - 09:55 AM
Well, this has been of no help, so I shall give up. Thanks for the support.
ChunLing #19
Posted 30 January 2013 - 11:19 AM
Giving up is a perfectly acceptable alternative, but you might want to make it possible for people to help you by posting your current code along with the current error.
Lyqyd #20
Posted 30 January 2013 - 11:19 AM
Try being a little more patient, please. Five minutes is not a reasonable time to expect replies in. If the code is in a local game, you can go to your save folder and copy it off of the computer or disk that it's on. If it is on a multiplayer server, you can try using the pastebin program (pastebin put <filename>) and linking the resulting paste here.