Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local funcRun = true
- if not fs.exists("arcui") or args[1] == "true" then
- print("Downloading arcUI...")
- shell.run("pastebin get NuZUGEmn arcui")
- end
- if not fs.exists("time") or args[1] == "true" then
- print("Downloading time...")
- shell.run("pastebin get 6nArsPfK time")
- end
- os.loadAPI("arcui")
- os.loadAPI("time")
- local monX, monY = term.getSize()
- if settings.get("arcclock.lang", "not") == "not" or settings.get("arcclock.username", "not") == "not" then
- local lang = "en"
- local username = "player"
- arcui.drawWindow("arcClock")
- arcui.drawLabel("welcome_label", 1, 3, "Welcome to arcClock setup !")
- arcui.drawTextbox("username_textbox", 1, 6, monX, "Your username")
- arcui.drawLabel("lang_label", 1, 8, "Language :")
- arcui.drawButton("fr_btn", monX / 3 + monX / 3, 10, monX, 12, colors.cyan, "Français")
- arcui.drawButton("en_btn", 1, 10, monX / 3, 12, colors.cyan, "English")
- arcui.drawButton("ok_btn", 1, monY - 2, monX, monY, colors.green, ">")
- local function loop()
- while true do
- event, a1, a2 = os.pullEvent()
- if event == "button_close_clicked" then
- arcui.closeWindow()
- return true
- elseif event == "button_clicked" then
- if a1 == "fr_btn" then
- lang = "fr"
- elseif a1 == "en_btn" then
- lang = "en"
- elseif a1 == "ok_btn" then
- local rep = arcui.openDialog("confirm_dialog", "arcClock", "Save changes ?")
- if rep == true then
- settings.set("arcclock.lang", lang)
- settings.set("arcclock.username", username)
- settings.save(".settings")
- arcui.closeWindow()
- error("Please restart app")
- return true
- else
- arcui.redrawWindow("arcClock")
- end
- end
- elseif event == "textbox_text" then
- if a1 == "username_textbox" then
- if a2 ~= "" then
- username = a2
- else
- username = "player"
- end
- end
- end
- end
- end
- parallel.waitForAll(loop, arcui.eventHandler)
- end
- local langTexts = {fr = {"Bonjour", "Bonne nuit", "Bonjour", "Bonsoir", "Il est "}, en = {"Good afternoon", "Good night", "Good morning", "Good evening", "It's "}}
- arcui.deleteAllWidgets()
- arcui.bRun = true
- arcui.drawWindow("arcClock")
- arcui.drawLabel("msg_label", 1, monY - 1, "N/A")
- arcui.drawLabel("time_label", 1, monY, "N/A")
- local function eventHandler()
- while true do
- event, a1, a2 = os.pullEvent()
- if event == "button_close_clicked" then
- funcRun = false
- arcui.closeWindow()
- return true
- end
- end
- end
- local function loop()
- while funcRun do
- arcui.changeValue("time_label", "text", langTexts[settings.get("arcclock.lang")][5]..time.getWorldComplete())
- if time.isWorldDay() then
- arcui.changeValue("msg_label", "text", langTexts[settings.get("arcclock.lang")][1]..", "..settings.get("arcclock.username"))
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.orange)
- paintutils.drawFilledBox(monX / 2 - 2, 4, monX / 2 + 2, 8, colors.yellow)
- elseif time.isWorldNight() then
- arcui.changeValue("msg_label", "text", langTexts[settings.get("arcclock.lang")][2]..", "..settings.get("arcclock.username"))
- if time.getWorldMoonPhase() == 1 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 2, 3, monX / 2 + 3, 8, colors.white)
- elseif time.getWorldMoonPhase() == 2 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2, 3, monX / 2 + 3, 9, colors.white)
- paintutils.drawLine(monX / 2 - 1, 4, monX / 2 - 1, 8, colors.white)
- paintutils.drawLine(monX / 2 - 2, 5, monX / 2 - 2, 7, colors.white)
- elseif time.getWorldMoonPhase() == 3 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 - 1, 9, colors.black)
- paintutils.drawFilledBox(monX / 2 + 2, 3, monX / 2 + 3, 7, colors.white)
- elseif time.getWorldMoonPhase() == 4 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2, 9, colors.black)
- paintutils.drawLine(monX / 2 + 1, 4, monX / 2 + 1, 8, colors.black)
- paintutils.drawLine(monX / 2 + 2, 5, monX / 2 + 2, 7, colors.black)
- elseif time.getWorldMoonPhase() == 5 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 2, 4, monX / 2 + 2, 8, colors.black)
- elseif time.getWorldMoonPhase() == 6 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2, 3, monX / 2 + 3, 9, colors.black)
- paintutils.drawLine(monX / 2 - 1, 4, monX / 2 - 1, 8, colors.black)
- paintutils.drawLine(monX / 2 - 2, 5, monX / 2 - 2, 7, colors.black)
- elseif time.getWorldMoonPhase() == 7 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 + 1, 3, monX / 2 + 3, 9, colors.black)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 - 2, 7, colors.white)
- elseif time.getWorldMoonPhase() == 8 then
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2, 9, colors.white)
- paintutils.drawLine(monX / 2 + 1, 4, monX / 2 + 1, 8, colors.white)
- paintutils.drawLine(monX / 2 + 2, 5, monX / 2 + 2, 7, colors.white)
- end
- elseif time.isWorldDawn() then
- arcui.changeValue("msg_label", "text", langTexts[settings.get("arcclock.lang")][3]..", "..settings.get("arcclock.username"))
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.orange)
- paintutils.drawFilledBox(monX / 2 - 2, 4, monX / 2 + 2, 8, colors.yellow)
- paintutils.drawLine(monX / 2 + 3, 3, monX / 2 - 3, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 4, monX / 2 - 2, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 5, monX / 2 - 1, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 6, monX / 2, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 7, monX / 2 + 1, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 8, monX / 2 + 2, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 3, 9, monX / 2 + 3, 9, colors.lightGray)
- elseif time.isWorldDusk() then
- arcui.changeValue("msg_label", "text", langTexts[settings.get("arcclock.lang")][4]..", "..settings.get("arcclock.username"))
- paintutils.drawFilledBox(1, 3, monX, 9, colors.lightGray)
- paintutils.drawBox(monX / 2 - 3, 3, monX / 2 + 3, 9, colors.gray)
- paintutils.drawFilledBox(monX / 2 - 3, 3, monX / 2 + 2, 8, colors.white)
- paintutils.drawLine(monX / 2 + 3, 3, monX / 2 - 3, 9, colors.lightGray)
- paintutils.drawLine(monX / 2 + 2, 3, monX / 2 - 3, 8, colors.lightGray)
- paintutils.drawLine(monX / 2 + 1, 3, monX / 2 - 3, 7, colors.lightGray)
- paintutils.drawLine(monX / 2, 3, monX / 2 - 3, 6, colors.lightGray)
- paintutils.drawLine(monX / 2 - 1, 3, monX / 2 - 3, 5, colors.lightGray)
- paintutils.drawLine(monX / 2 - 2, 3, monX / 2 - 3, 4, colors.lightGray)
- paintutils.drawLine(monX / 2 - 3, 3, monX / 2 - 3, 3, colors.lightGray)
- end
- term.setBackgroundColor(colors.lightGray)
- sleep(0.5)
- end
- end
- parallel.waitForAll(eventHandler, arcui.eventHandler, loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement