Jump to content




[SOLVED] Text not appearing (Weird bug)


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

#1 Kadecamz

  • New Members
  • 113 posts

Posted 12 September 2012 - 10:03 PM

term.clear()
sleep(0)
term.setCursorPos(1,1)
event, p1 = os.pullEvent("key")
print("Press ESC to shutdown")
print("Press any other key to go back to normal")
if p1 == 1 then
write("Shutting Down")
sleep(1)
write(".")
sleep(1)
write(".")
sleep(1)
write(".")
sleep(1)
os.shutdown()
else
print("Returning to normal")
write("14%")
sleep(1)
term.setCursorPos(1,3)
write("34%")
sleep(1)
term.setCursorPos(1,3)
write("57%")
sleep(1)
term.setCursorPos(1,3)
write("78%")
sleep(1)
term.setCursorPos(1,3)
write("97%")
sleep(1)
term.setCursorPos(1,3)
print("Done!")
sleep(2)
term.clear()
sleep(0)
term.setCursorPos(1,1)
shell.run("startup")
end

I made an improved exit program, but there is a weird bug where when I run the program it doesn't show the text till I press one of the keys.

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 12 September 2012 - 10:14 PM

That's simple. The os.pullEvent() command halts all function calls until it receives an event. You will want to have your two print commands BEFORE your os.pullEvent() function call.

#3 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 12 September 2012 - 10:16 PM

You told it to wait for a key:
event, p1 = os.pullEvent("key")
So it will wait for a key :)/>

#4 Kadecamz

  • New Members
  • 113 posts

Posted 12 September 2012 - 10:16 PM

Oh, thank you!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users