renpy and computer time

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
tuna_sushi
Veteran
Posts: 299
Joined: Thu Jul 07, 2011 9:33 am
Projects: BloomingBlossoms
Contact:

renpy and computer time

#1 Post by tuna_sushi »

Is it possible to connect a renpy game with the computer time?
Example: if it is 11:00 - 15:00, person A's hairstyle will change. (That's not how it works in my game, it's just an example.)

If it is possible, how to do it?

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: renpy and computer time

#2 Post by DragoonHP »

Read about Python datetime module.

Then you'll just have to compare the values and use LiveComposite or any other function of your choice.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: renpy and computer time

#3 Post by Alex »

Kind of example

Code: Select all

init python:
    import time

label start:
    $ my_var = time.localtime()
    $ show_date = str (my_var)
    "[show_date]"

    $ show_date = str("%d.%d.%d" %(my_var [2],my_var [1],my_var [0]) )
    "[show_date]"

tuna_sushi
Veteran
Posts: 299
Joined: Thu Jul 07, 2011 9:33 am
Projects: BloomingBlossoms
Contact:

Re: renpy and computer time

#4 Post by tuna_sushi »

Ah, thank you two!
I read the module, now I'll try it out once I get Ren'Py to work...

Post Reply

Who is online

Users browsing this forum: Ocelot