Don't like ads? PRO users don't see any ads ;-)
Guest

Centered Secret Touch

By: npexception on Mar 13th, 2013  |  syntax: Lua  |  size: 0.76 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- adjust this values to your needs.
  2. local monitorSide = "top"
  3. local color1 = colors.orange
  4. local color2 = colors.lightGray
  5.  
  6. local message1 = "Welcome to the Cube"
  7. local message2 = "Click anywhere to continue"
  8.  
  9. local monitor = peripheral.wrap(monitorSide)
  10. local w,h = monitor.getSize()
  11.  
  12. while true do
  13.   monitor.clear()
  14.   local x = (w/2) - (string.len(message1)/2) + 1
  15.   local y = (h/2)
  16.   monitor.setCursorPos(x,y)
  17.   monitor.setTextColor(color1)
  18.   monitor.write(message1)
  19.   x = (w/2) - (string.len(message2)/2) + 1
  20.   y = y + 1
  21.   monitor.setCursorPos(x,y)
  22.   monitor.setTextColor(color2)
  23.   monitor.write(message2)
  24.  
  25.   os.pullEvent("monitor_touch")
  26.   monitor.setTextColor(colors.white)
  27.   shell.run("monitor "..monitorSide.." secret/alongtimeago")
  28. end