Smiley43210

LorkIkol's Progress (Existence)

May 7th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. local w, h = term.getSize()
  2. term.clear()
  3. term.setCursorPos(1, 1)
  4. local header = "LordIkol's Status"
  5. local hlen = (w - #header) / 2
  6. print(string.rep("-", math.ceil(hlen)) .. header .. string.rep("-", math.floor(hlen)))
  7. local x1, y1 = term.getCursorPos()
  8. print("Traveling to the end of the universe.")
  9. print("Please wait...")
  10. write("Progress: ")
  11. local x2, y2 = term.getCursorPos()
  12. for i = 0, 10000, 0.25 do
  13.   term.setCursorPos(x2, y2)
  14.   local t = i / 100 .. "%"
  15.   write(t .. string.rep(" ", w - #t))
  16.   sleep(tonumber(math.random(0, 1) == 0 and "0." .. math.random(5, 9) or "1." .. math.random(0, 4)))
  17. end
  18. term.setCursorPos(x1, y1)
  19. term.clearLine()
  20. print("Reached the end of the universe. Now what?")
  21. term.clearLine(); print(); term.clearLine()
  22. term.setCursorPos(1, y2 - 1)
Advertisement
Add Comment
Please, Sign In to add comment