Jump to content




Real World / MinecraftWorld Time Display Program *New Ver 2.0


  • You cannot reply to this topic
10 replies to this topic

#1 surferpup

  • Members
  • 286 posts
  • LocationUnited States

Posted 11 January 2014 - 02:39 AM

TimeDisplays v. 2.0

This fairly simple program will display Real World time for up to three timezones (pulling time from time.org) and Minecraft world (local) time on the computer as well as on any number of wired attached monitors. I wrote it for a gathering area of sorts on my servers (the area serves as a transit station). The players on my server seem to think it is fun to have going. We have a chunk loader in this area, so the program is constantly active. This version is cleaner and pretty well de-bugged. Let me know what you think. The program uses http access as well as the parallel API to update the displays of time.

Screen Shot


Posted Image


Multi-Monitor


Posted Image



Change Log

Features

Usage

Code

Paste bin link: http://pastebin.com/AUQfZjRK

Thanks to Lyqyd, theoriginalbit, Death and Bubba for the help.

Edited by surferpup, 02 February 2014 - 02:59 AM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 January 2014 - 01:27 PM

Moved to Programs.

#3 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 13 January 2014 - 03:24 AM

This looks pretty cool, an API would be even cooler though, why not look in to making a real world time API?

#4 surferpup

  • Members
  • 286 posts
  • LocationUnited States

Posted 14 January 2014 - 10:54 PM

When I tackle coding up an API, it will be first on my list. I just figured out how to do programs in Lua. How bout giving me a point in the right direction?

#5 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 14 January 2014 - 11:21 PM

View Postsurferpup, on 14 January 2014 - 10:54 PM, said:

When I tackle coding up an API, it will be first on my list. I just figured out how to do programs in Lua. How bout giving me a point in the right direction?

Sure, I'm not sure if there's any tutorial, you might want to have a look. I'll give a brief example though.

Make a file for you API, in this case I'll call it 'example'.

Each function/variable in the API file can be access. For example,
--this can only be accessed within this file
local helloText = 'Hello'
function hello()
    print(helloText)
end
bye = 'Good bye'

Then, in a program you could run:
os.loadAPI('example')
example.hello()
--prints 'Hello'
print(example.bye)
--prints 'Good bye'
print(example.helloText)
--doesn't work

Feel free to PM me if you need any more help.

#6 surferpup

  • Members
  • 286 posts
  • LocationUnited States

Posted 15 January 2014 - 12:54 AM

Got it. An API is thus like a library. Thanks.

#7 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 15 January 2014 - 01:17 AM

View Postsurferpup, on 15 January 2014 - 12:54 AM, said:

Got it. An API is thus like a library. Thanks.

Yep. Your welcome.

#8 Symmetryc

  • Members
  • 434 posts

Posted 20 January 2014 - 10:34 AM

It should also be noted that you can use APIs through the use of the dofile function as an import-like statement, that way you can keep all of the variables local, thus not polluting the global environment and achieving the additional speed boost that comes with local variables.

Example API:
return {
  get_time = function()
    --#do stuff
  end;
}
Example Program using this API:
local time = dofile("time.lua")
print(time.get_time())


#9 surferpup

  • Members
  • 286 posts
  • LocationUnited States

Posted 02 February 2014 - 02:56 AM

I have now made the ability to grab real world date and time an API. The Real World Time API is now in beta and open for review.

#10 xBoom

  • New Members
  • 2 posts

Posted 08 March 2014 - 07:04 PM

Is there any way to extend the code so you can have more then 3 times zones, if so how

Thanks for any help - xBoom

#11 viveleroi

  • Members
  • 5 posts

Posted 19 April 2014 - 02:27 AM

I'm trying this now, great work!

I'm noticing that BST time is wrong in the API. Currently London uses BST, which is UTC+1 in the summer, but shows as UTC+2 on the api.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users