Advertisement
Guest User

canvas

a guest
Nov 13th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. --Equipt Overlay Glasses & Clock Peripherals
  2. local interface = peripheral.wrap("back")
  3.  
  4. --Canvas to draw objects on
  5. local canvas = interface.canvas()
  6. canvas.clear()
  7.  
  8. --Group box and text objects together
  9. local iGroup = canvas.addGroup({0,50})
  10. local rect = iGroup.addRectangle(0,0,180,32, 0x00FF002F)
  11. local text = iGroup.addText({5,5}, "")
  12. local dbg = iGroup.addText({5,15}, "")
  13.  
  14.  
  15. local day
  16. local tracker = 0
  17. local flag = 0
  18. local daysLeft
  19.  
  20.  
  21. while true do
  22.     day = interface.getDay()
  23.     angle = math.floor(interface.getCelestialAngle() + 0.5)
  24.     light = interface.getSkyLight()
  25.     if day ~= tracker then
  26.        tracker = day
  27.        flag = 0
  28.        --daysLeft = (36-day%36)
  29.        --text.setText("Day: " .. day .. " | " .. daysLeft .. " Days to " .. tracker)
  30.     end
  31.     if (angle > 355 or angle < 5) then
  32.         if light <= 8 then
  33.             text.setText("Eclipse!")
  34.             flag = 1
  35.         end      
  36.     else
  37.         text.setText("")
  38.     end
  39.     if (flag == 1 and angle > 95 and angle < 245) then
  40.         text.setText("Get Ready for Holog")
  41.     end
  42.     dbg.setText("A: "..angle.."  L: "..light.."  F: "..flag.."  T: "..tracker)
  43.        
  44.     sleep(5)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement