Advertisement
Guest User

Daybox

a guest
Dec 23rd, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. -- by Romaen. this code all goes into one script.
  2.  
  3. daybox = daybox or {}
  4. daybox.daynight = daybox.daynight or 0
  5.  
  6. daybox.c = Geyser.MiniConsole:new({
  7.   name="daybox",
  8.   x="70%", y="50%",
  9.   autoWrap = true,
  10.   color = "black",
  11.   scrollBar = false,
  12.   fontSize = 8,
  13.   width="30%", height="20%",
  14. })
  15.  
  16. function daybox.write()
  17.   if not gmcp.IRE then return end
  18.   if not gmcp.IRE.Time then return end
  19.   if not gmcp.IRE.Time.Update then return end
  20.  
  21.   if gmcp.IRE.Time.Update.daynight then daybox.daynight = tonumber(gmcp.IRE.Time.Update.daynight) end
  22.  
  23.   local bg = ''
  24.   local fg = ''
  25.   local n = 0
  26.   local state = ''
  27.  
  28.   if daybox.daynight < 100 then
  29.     bg = '<deep_sky_blue>'
  30.     fg = '<yellow>'
  31.   else
  32.     bg = '<medium_blue>'
  33.     fg = '<white>'
  34.     daybox.daynight = daybox.daynight - 100
  35.   end
  36.  
  37.   local perc = math.floor(daybox.daynight / 4)
  38.  
  39.   n = 4
  40.   if perc > 22 then n = 26-perc elseif perc < 1 then n = 3 end
  41.   local line1 = bg..string.rep('-', perc-1)..fg..string.rep('@', n)..bg..string.rep('-', 22-perc)..'\n'
  42.  
  43.   n = 6
  44.   if perc > 21 then n = 27-perc elseif perc == 1 then n = 5 elseif perc < 1 then n = 4 end
  45.   local line2 = bg..string.rep('-', perc-2)..fg..string.rep('@', n)..bg..string.rep('-', 21-perc)..'\n'
  46.  
  47.   daybox.c:cecho('\n'..bg..string.rep('-', 25)..'\n'..line1..line2..line1..bg..string.rep('-', 25)..'\n')
  48. end
  49.  
  50. if isActive('daybox update', 'trigger') == 0 then
  51.   daybox.trigger = permPromptTrigger("daybox update", "", [[daybox.write()]])
  52. end
  53.  
  54. sendGMCP([[Core.Supports.Add ["IRE.Time 1"] ]])
  55. tempExactMatchTrigger([[Password correct. Welcome to Achaea.]], [[sendGMCP('Core.Supports.Add ["IRE.Time 1"]') ]], 1)
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement