Guest User

screensaver

a guest
Feb 13th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. args = {...}
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. if not args[1] then
  5.  print("Usage: screensaver <text> [text] [text] etc.")
  6.  write("Random Fact Thing: ")
  7.  tip = math.random(1,10)
  8.  if tip == 1 then print("Try using -u or -l instead of one text!")
  9.  elseif tip == 2 then print("Try the program secret/alongtimeago!")
  10.  elseif tip == 3 then print("Try putting a (regular) monitor and a wither skeleton skull in a crafting table!")
  11.  elseif tip == 4 then print("Try erroring this program again like this for another fact thing!")
  12.  elseif tip == 5 then print("These fact things are an easter egg! Shhh!")
  13.  elseif tip == 6 then print("Pumpkins make good headgear, no angry endermen!")
  14.  elseif tip == 7 then print("This program has a few secrets...")
  15.  elseif tip == 8 then print("Sometimes the main menu of Minecraft sometimes says 'Minceraft'!")
  16.  elseif tip == 9 then print("There are 10 random fact things in total.")
  17.  elseif tip == 10 then print("I'm getting bored of typing these.")
  18.  elseif tip == 11 then print("This fact thing will never show up. Minecraft has a splash screen like this.") end
  19.  return
  20. end
  21. numb1 = 1
  22. numb2 = 0
  23. lower = false
  24. upper = false
  25. while args[numb1] ~= nil do
  26.  if args[numb1] == "-u" and lower ~= true then
  27.   upper = true
  28.  elseif args[numb1] == "-l" and upper ~= true then
  29.   lower = true
  30.  end
  31.  numb2 = numb2 + string.len(args[numb1])
  32.  numb1 = numb1 + 1
  33. end
  34. numb3 = 1
  35. local function screensaver()
  36.  local w,h = term.getSize()
  37.  term.setCursorPos(math.random(w-numb2),math.random(h))
  38.  term.setTextColour(2^math.random(14))
  39.  while args[numb3] ~= nil and args[numb3] ~= "-u" and args[numb3] ~= "-l" and args[1] ~= "credits" do
  40.   if upper == true then
  41.    args[numb3] = string.upper(args[numb3])
  42.   elseif lower == true then
  43.    args[numb3] = string.lower(args[numb3])
  44.   end
  45.   term.write(args[numb3].." ")
  46.   numb3 = numb3 + 1
  47.  end
  48.  if args[1] == "credits" then
  49.   term.setCursorPos(1,1)
  50.   print("Coded by: Shnupbups100")
  51.   print("Code originally by: Kingdaro")
  52.   print("FORUMS post wIth idea: Cranium")
  53.   print("LOVElY mOd by: Dan200 and Cloudy")
  54.   print("Umbrellas.")
  55.   print("(yes, there's a hidden message in there)")
  56.   sleep(8)
  57.   os.reboot()
  58.  end
  59.  numb3 = 1
  60. end
  61. while true do
  62.  screensaver()
  63.  os.startTimer(0.05)
  64.  event, p1, p2, p3 = os.pullEvent()
  65.  if event ~= "timer" then
  66.   term.clear()
  67.   term.setCursorPos(1,1)
  68.   break
  69.  end
  70. end
Advertisement
Add Comment
Please, Sign In to add comment