Digital Clock Question

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
dragonlord3989
Regular
Posts: 30
Joined: Tue Nov 17, 2015 1:34 pm
Contact:

Digital Clock Question

#1 Post by dragonlord3989 »

Hello I am new to this website and ren'py but I was reading over this post http://lemmasoft.renai.us/forums/viewto ... f=8&t=8154 and I was wondering is there any way to change the time from 24 hour to 12 hour with am and pm cycles any help would be greatly appreciated. Also is it possible to give the text a outline some thing similar to http://www.indezine.com/products/powerp ... 010_04.jpg but green being the main color and black being the outline.
At the moment I have this
screen time_overlay:
add "watch" at Position(xpos=10, ypos=2)
$ minutes = time_in_minutes % 60
$ hours = (time_in_minutes / 60) % 24
text ("%d:%02d" % (hours, minutes)) pos (55, 70)
I have tried this out but still no luck on changing the color of the text
screen time_overlay:
add "watch" at Position(xpos=10, ypos=2)
$ minutes = time_in_minutes % 60
$ hours = (time_in_minutes / 60) % 24
text {color=#00000}("%d:%02d" % (hours, minutes)) pos (55, 70){/color)
but still no luck

Sidji972
Regular
Posts: 107
Joined: Tue Jan 21, 2014 8:50 pm
Location: Canada
Contact:

Re: Digital Clock Question

#2 Post by Sidji972 »

I don't know how to set the clock to 12 hours, but here the way to get your outlines effect.

Code: Select all

screen date_overlay:
    $ day = (time_in_minutes / 60 / 24) % 28
    $ month = (time_in_minutes / 60/ 24 / 28) % 12
    text ("Day%d %d" % (day, month)): 
        pos (667, 60)
        color "000"
        outlines [(2, "179F53", 0,0)]

dragonlord3989
Regular
Posts: 30
Joined: Tue Nov 17, 2015 1:34 pm
Contact:

Re: Digital Clock Question

#3 Post by dragonlord3989 »

Sidji972 wrote:I don't know how to set the clock to 12 hours, but here the way to get your outlines effect.

Code: Select all

screen date_overlay:
    $ day = (time_in_minutes / 60 / 24) % 28
    $ month = (time_in_minutes / 60/ 24 / 28) % 12
    text ("Day%d %d" % (day, month)): 
        pos (667, 60)
        color "000"
        outlines [(2, "179F53", 0,0)]
Thank you very much

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Digital Clock Question

#4 Post by philat »

Converting to 12 hour time is just a matter of math. Tweak the basic concept below as necessary.

Code: Select all

$ hours, minutes = divmod(time_in_minutes, 60)
$ m, hours = divmod(hours, 12)
if m % 2 == 1:
    $ apm = "PM"
else:
    $ apm = "AM"
text "[hours]:[minutes] [apm]"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Baidu [Spider]