Advertisement
kenik

HologramV2

Nov 26th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local c = require("component")
  2. local unicode = require("unicode")
  3. local holo = c.hologram
  4. local symbols = require("symbols")
  5.  
  6. if not holo then error("This program reqiures holoram projector.") end
  7.  
  8. local hologram = {}
  9.  
  10. ---------------------------------------
  11.  
  12. local function clear()
  13. holo.clear()
  14. end
  15.  
  16. function hologram.drawSymbol(x, y, z, symbol, color)
  17. for i = 1, #symbol do
  18. for j = 1, #symbol[i] do
  19. if symbol[i][j] == 1 then
  20. holo.set(x + j - 1, y - i + 1, z, color)
  21. end
  22. end
  23. end
  24. end
  25.  
  26. function hologram.text(x, y, z, text, color)
  27. local length = unicode.len(text)
  28. local smeshenie = 0
  29. for i = 1, length do
  30. local sym = unicode.sub(text, i, i)
  31. hologram.drawSymbol(x + smeshenie, y, z, symbols[sym], color)
  32. smeshenie = smeshenie + 6
  33. end
  34. end
  35.  
  36.  
  37. ---------------------------------------
  38.  
  39. local args = {...}
  40. local text = "Open Computers"
  41. if args[1] then
  42. text = tostring(args[1])
  43. else
  44. print("No text specified, using default value 'Open Computers'.")
  45. end
  46. local text = text .. " "
  47. local scale = tonumber(args[2]) or 1
  48. local height = tonumber(args[3]) or 10
  49.  
  50. local date
  51.  
  52. holo.setScale(scale)
  53.  
  54. while true do
  55. holo.clear()
  56. hologram.text(1, height, 24, text:upper(), 2)
  57. os.sleep(1)
  58. end
  59.  
  60. ---------------------------------------
  61.  
  62. return hologram
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement