Advertisement
Mackan90096

Terminal Glasses Tool

Aug 11th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. lights = false
  2. door = false
  3. Help = false
  4. show = true
  5. local p = peripheral.wrap("top")
  6. local bgcol = 0xFF0000
  7. local txtcol = 0x00FFFF
  8.  
  9. function error(msg)
  10. p.clear()
  11. mybox = p.addBox(1,1, 100, 50, bgcol, 0.5)
  12. local w = mybox.getX()
  13. mytext = p.addText(50, 10, tostring(msg), txtcol)
  14. end
  15.  
  16. function help()
  17. p.clear()
  18. p.clear()
  19. mybox = p.addBox(1,1, 120, 150, bgcol, 0.5)
  20. mytext = p.addText(1, 10, "Help", txtcol)
  21. mytext = p.addText(1, 20, "Shows or hides the help", txtcol)
  22. mytext = p.addText(1, 40, "=1+1", txtcol)
  23. mytext = p.addText(1, 50, "Shows what 1+1 is,", txtcol)
  24. mytext = p.addText(1, 60, "Works with any number", txtcol)
  25. mytext = p.addText(1, 70, "and operator", txtcol)
  26. mytext = p.addText(1, 90, "Hide / Show", txtcol)
  27. mytext = p.addText(1, 100, "Hides or shows the", txtcol)
  28. mytext = p.addText(1, 110, "overlay", txtcol)
  29. end
  30.  
  31. function start()
  32. p.clear()
  33. mybox = p.addBox(1,1, 100, 50, bgcol, 0.5)
  34. mytext = p.addText(1, 1, "Version: 1.0", txtcol)
  35. mytext = p.addText(1, 20, "Try $$help", txtcol)
  36. end
  37.  
  38. start()
  39.  
  40. while true do
  41. _, p1 = os.pullEvent("chat_command")
  42.  if p1 == "help" then
  43.  if show then
  44.   if Help then
  45.   Help = false
  46.   start()
  47.  else
  48.  Help = true
  49.  help()
  50.  end
  51.  end
  52.  if string.find(p1, "=") then
  53.  if show then
  54.  txt = (tostring(p1):match("=(.+)"))
  55.  num = loadstring("return "..txt)()
  56.   mytext = p.addText(1, 40, tostring(num), textcol)
  57.  sleep(5)
  58.  start()
  59.   end
  60.   end
  61.  if string.find(p1, "reverse ") then
  62.    if show then
  63.      txt = tostring(p1):match("reverse(.+)")
  64.      num = string.reverse(txt)
  65.      mytext = p.addText(1, 40, tostring(num), txtcol)
  66.      sleep(5)
  67.      start()
  68.      
  69.    end
  70.  end
  71.   elseif p1 == "hide" then
  72.   if show then
  73.   p.clear()
  74.   show = false
  75.   end
  76.   elseif p1 == "show" then
  77.   if not show then
  78.   show = true
  79.   start()
  80.   end
  81. else
  82. if show then
  83.     error("Error!")
  84.     sleep(1)
  85.     start()
  86.   end
  87.  end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement