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

Power On Self Test

Started by invis45, 19 March 2012 - 10:47 PM
invis45 #1
Posted 19 March 2012 - 11:47 PM
i want to emulate a power on self test (POST) on a computer and my code doesn't seem to be working. can you tell me where the error is?

Code:


term.clear()
term.setCursorPos(1, 1)

print("Power on self test started:")
sleep(1)
local function clearScreen()

print("Checking system..|")
sleep(1)
local function clearScreen()

print("Checking system../")
sleep(1)
local function clearScreen()

print("Checking system..--")
sleep(1)
local function clearScreen()

print("Checking system..")
sleep(1)
local function clearScreen()

print("Checking system..|")
sleep(1)
print("System..OK")

end

And i get this error with the code:
bios:206: [String "post"]:20: unfinished string
Espen #2
Posted 20 March 2012 - 12:09 AM
is an escape character and it escapes the next character in a String.
If you don't want it to escape the last double-quote, then escape the escape character itself: instead of

Example + function fix:

local function clearScreen()
  term.clear()
  term.setCursorPos(1, 1)
end

print("Power on self test started:")
sleep(1)
clearScreen()

print("Checking system..|")
sleep(1)
clearScreen()

print("Checking system../")
sleep(1)
clearScreen()

print("Checking system..--")
sleep(1)
clearScreen()

print("Checking system..")  -- Here is the escaped backslash.
sleep(1)
clearScreen()

print("Checking system..|")
sleep(1)
print("System..OK")
invis45 #3
Posted 20 March 2012 - 03:05 AM
Thank you so much
And thanks for fixing the clearscreen thing
I know Lu's a little bit but I've never had to use a clear screen command or a