Cookbook Analog Clock Problem

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
Kuh-Couch
Newbie
Posts: 24
Joined: Fri Jul 02, 2010 10:46 am
Contact:

Cookbook Analog Clock Problem

#1 Post by Kuh-Couch » Sun Oct 09, 2011 2:23 pm

Hi!
I'm fiddling a bit with renpy lately again and now I'm trying something on base of the analog clock from the cookbook.

So far, I implemented the clock like in the recipe. Works fine!

Now I want it modified:

The variable minute should increment until a cerain value and show the result with every step.

I used the following code in the script:

Code: Select all

    python:
        while minutes <= 720:
            minutes =+ 10
            renpy.pause(0.05)
        #
    #
Yes. It's a simple while loop. But renpy (python?) is a bit annoying when you don't have a clue about the syntax. =/
What it does: It starts the game, it shows the clock, the clockhands move by the value 10, the game stops. I can enter the game menu though.
I think it has something to do with the pause command.

Would someone please clearify this nasty problem for me ^^ thank you =)

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

Re: Cookbook Analog Clock Problem

#2 Post by Alex » Sun Oct 09, 2011 2:32 pm

I think problem is <minutes =+ 10>. This just sets the value to 10 (+10 is just 10 - a positive number), so your while loop becomes infinite. Try <minutes += 10>.

Kuh-Couch
Newbie
Posts: 24
Joined: Fri Jul 02, 2010 10:46 am
Contact:

Re: Cookbook Analog Clock Problem

#3 Post by Kuh-Couch » Sun Oct 09, 2011 3:05 pm

Boah, I'm so stupid. It works, thanks. Man this is embarrassing ...

Anyway. Now that this is solved, I'll write here when there are new problem with what I'm planning concerning the clock =)

User avatar
Another
Regular
Posts: 82
Joined: Sun Apr 18, 2010 8:57 am
Contact:

Re: Cookbook Analog Clock Problem

#4 Post by Another » Sun Oct 09, 2011 5:15 pm

I've made a "screenified" version of this clock -with different features- a while ago. Since the "screenification" considerably simplified the code, I think I should share it:
clock.zip
(7.91 KiB) Downloaded 378 times
Have a look at it, and use everything you want. :wink:

Display:
- plain images
- hours, minutes and seconds
- system hour with auto update (although I doubt this feature could be interesting for a VN... :lol: )

Post Reply

Who is online

Users browsing this forum: No registered users