Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitorSide = "top"
- monitorScale = 1
- if not fs.exists( "fui" ) then
- print( "Performing first time setup." )
- shell.run( "pastebin","get", "306Ns1qg", "fui" )
- print("Finished. Please run program again.")
- error()
- end
- monitor = peripheral.wrap( monitorSide )
- monitor.setTextScale( monitorScale )
- os.loadAPI("fui")
- fui.setMonitorSide( monitorSide )
- os.sleep(5)
- w,h = fui.getSize()
- line = {}
- function getRealTime()
- site = http.get("http://www.timeanddate.com/worldclock/denmark/copenhagen")
- data = site.readAll()
- if data then
- timeStart = string.find( data, "class=h1>" )
- timeEnd = string.find( data, "</span>", timeStart)
- zoneStart = string.find( data, "title=", timeEnd )
- zoneStart = string.find( data, ">", zoneStart )
- zoneEnd = string.find( data, "</a>", zoneStart)
- dateStart = string.find( data, "id=ctdat>" )
- dateEnd = string.find( data, "</span>", dateStart)
- if timeStart ~= nil then
- time = string.sub( data, timeStart + 9, timeEnd - 1)
- zone = string.sub( data, zoneStart + 1, zoneEnd - 1)
- date = string.sub( data, dateStart + 9, dateEnd - 1)
- end
- return true
- end
- return false
- end
- while true do
- text = getRealTime()
- getRealTime()
- fui.clear()
- fui.drawAlignText( "Welcome to", "mid", w/2+1, 2, "white" )
- fui.drawAlignText( "Fair's base", "mid", w/2+1, 4, "cyan" )
- fui.drawAlignText( "Current realtime:", "mid", w/2+1, 6, "white" )
- fui.drawAlignText( time..", "..zone, "mid", w/2+1, 8, "lightgray" )
- fui.drawAlignText( date, "mid", w/2+1, 9, "lightgray" )
- fui.drawAlignText( "Feel free to look around!", "mid", w/2+1, 11, "white" )
- os.sleep(0.8)
- end
Advertisement
Add Comment
Please, Sign In to add comment