This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
[Error] bios:206: [string "clock"]:16: unexpected symbol
Started by Tastybeanz, 30 January 2013 - 07:32 AMPosted 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.
Posted 30 January 2013 - 08:35 AM
Split into new topic.
Please provide the full code you are using.
Please provide the full code you are using.
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()
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
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
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.
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.
Posted 30 January 2013 - 09:02 AM
Hmm, that /> Isn't showing up in my code. I'll try the o.5 though.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
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.
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.
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
Posted 30 January 2013 - 09:05 AM
Sorry, that .SetCursorPos is just a typo, it's .setCursorPos in the actual code.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.
Posted 30 January 2013 - 09:05 AM
why you no copy paste?
Posted 30 January 2013 - 09:13 AM
line 16 should belocal 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.
b = a * 60
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.
Posted 30 January 2013 - 09:19 AM
Try running the clock without using the monitor. We might get better error messages.
Posted 30 January 2013 - 09:20 AM
Well now I'm getting bios:206: [string "clock"]:4: ')' expectedTry running the clock without using the monitor. We might get better error messages.
Posted 30 January 2013 - 09:34 AM
Can you pastebin your actual code please? Instead of writing it out?
Posted 30 January 2013 - 09:50 AM
Sorry, complete noob here. How would I do that?
Posted 30 January 2013 - 09:55 AM
Well, this has been of no help, so I shall give up. Thanks for the support.
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.
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.