Little idea what I am doing (ATL) [Solved!]

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
10kNing
Regular
Posts: 51
Joined: Fri Apr 29, 2011 9:37 pm
Projects: Revenance (RPG), Mad-Love (GxB, on hold)
Location: NYC
Contact:

Little idea what I am doing (ATL) [Solved!]

#1 Post by 10kNing »

What I'm aiming for is an animated heart thingamabobber that moves more quickly as the variable "heartbeat" increases:

Code: Select all

    image heart:
        "heart/heart1.png"
        pause ((20 - heartbeat)/20)
        "heart/heart2.png"
        pause ((20 - heartbeat)/20)
        "heart/heart3.png"
        pause ((20 - heartbeat)/20)
        "heart/heart4.png"
        pause ((20 - heartbeat)/20)
        "heart/heart5.png"
        pause ((20 - heartbeat)/20)
        "heart/heart6.png"
        pause ((20 - heartbeat)/20)
        "heart/heart7.png"
        pause ((20 - heartbeat)/20)
        "heart/heart8.png"
        pause ((20 - heartbeat)/20)
        "heart/heart9.png"
        pause ((20 - heartbeat)/20)
        "heart/heart10.png"
        pause ((20 - heartbeat)/20)
        "heart/heart11.png"
        pause ((20 - heartbeat)/20)
        "heart/heart12.png"
        pause ((20 - heartbeat)/20)
        "heart/heart11.png"
        pause ((20 - heartbeat)/20)
        "heart/heart10.png"
        pause ((20 - heartbeat)/20)
        "heart/heart9.png"
        pause ((20 - heartbeat)/20)
        "heart/heart8.png"
        pause ((20 - heartbeat)/20)
        "heart/heart7.png"
        pause ((20 - heartbeat)/20)
        "heart/heart6.png"
        pause ((20 - heartbeat)/20)
        "heart/heart5.png"
        pause ((20 - heartbeat)/20)
        "heart/heart4.png"
        pause ((20 - heartbeat)/20)
        "heart/heart3.png"
        pause ((20 - heartbeat)/20)
        "heart/heart2.png"
        pause ((20 - heartbeat)/20)
        "heart/heart1.png"
        pause ((20 - heartbeat)/20)
        repeat

...

    $ heartbeat = 1
    show heart
    "Test line"
But this error popped up:
I'm sorry, but an uncaught exception occurred.

Executing ATL code at game/script.rpy:144
File "game/script.rpy", line 311, in script
"Test line"
ZeroDivisionError: float division

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\execution.py", line 261, in run
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\ast.py", line 396, in execute
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\exports.py", line 699, in say
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\character.py", line 770, in __call__
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\character.py", line 664, in do_display
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\character.py", line 471, in display_say
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\ui.py", line 237, in interact
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\core.py", line 1798, in interact
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\core.py", line 2103, in interact_core
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\core.py", line 1387, in draw_screen
File "render.pyx", line 366, in renpy.display.render.render_screen (gen\renpy.display.render.c:4470)
File "render.pyx", line 166, in renpy.display.render.render (gen\renpy.display.render.c:2063)
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\layout.py", line 511, in render
File "render.pyx", line 95, in renpy.display.render.render (gen\renpy.display.render.c:2325)
File "render.pyx", line 166, in renpy.display.render.render (gen\renpy.display.render.c:2063)
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\layout.py", line 511, in render
File "render.pyx", line 95, in renpy.display.render.render (gen\renpy.display.render.c:2325)
File "render.pyx", line 166, in renpy.display.render.render (gen\renpy.display.render.c:2063)
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\layout.py", line 511, in render
File "render.pyx", line 95, in renpy.display.render.render (gen\renpy.display.render.c:2325)
File "render.pyx", line 166, in renpy.display.render.render (gen\renpy.display.render.c:2063)
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\image.py", line 164, in render
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\image.py", line 54, in wrap_render
File "render.pyx", line 95, in renpy.display.render.render (gen\renpy.display.render.c:2325)
File "render.pyx", line 166, in renpy.display.render.render (gen\renpy.display.render.c:2063)
File "accelerator.pyx", line 62, in renpy.display.accelerator.transform_render (gen\renpy.display.accelerator.c:933)
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\display\motion.py", line 683, in update_state
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\atl.py", line 374, in execute
File "C:\Documents and Settings\Marcia\My Documents\Ren'Py 6.13.8\renpy\atl.py", line 568, in execute
ZeroDivisionError: float division
and I have no idea what that means since as far as I can tell I haven't divided by zero... I don't completely understand ATL yet, so could someone help me learn what's wrong with the code? Thank you.
Last edited by 10kNing on Fri May 11, 2012 7:10 pm, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Little idea what I am doing (ATL)

#2 Post by Milkymalk »

Ok, not really a pro here, so just wild guessing, but several thoughts:

1. try setting heartbeat to a number (i.e., defining the variable) before initiating the images
2. try to make ((20 - heartbeat)/20) a function that is then used there

What exactly are lines 144 and 311 in script.rpy?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

10kNing
Regular
Posts: 51
Joined: Fri Apr 29, 2011 9:37 pm
Projects: Revenance (RPG), Mad-Love (GxB, on hold)
Location: NYC
Contact:

Re: Little idea what I am doing (ATL)

#3 Post by 10kNing »

1. Already set heartbeat to a number ($ heartbeat = 1). It's supposed to be an integer between 0 and 20. The error still pops up even when the number is valid, thoughhhh

2. Made a function:

Code: Select all

        def findbeat(beat):
            return ( 20-beat )/20

...

    image heart:
        "heart/heart1.png"
        pause findbeat(heartbeat)
etc.
but the error still pops up, sadly.

Lines 143-145:

Code: Select all

        "heart/heart2.png"
        pause findbeat(heartbeat)
        "heart/heart1.png"
Line 311:
$ heartbeat = 1

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Little idea what I am doing (ATL)

#4 Post by Milkymalk »

Stupid question, but did those lines have these line numbers before you added the function? :)

What's interesting is that the error seems to come up towards the end of the ATL block...

Sorry, that was all I could think of. I don't see any division by zero either.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

10kNing
Regular
Posts: 51
Joined: Fri Apr 29, 2011 9:37 pm
Projects: Revenance (RPG), Mad-Love (GxB, on hold)
Location: NYC
Contact:

Re: Little idea what I am doing (ATL)

#5 Post by 10kNing »

Oh right -slightly dumb- The new line errors are at 313 ("Test line") and 146 (pause findbeat(heartbeat) between the last "heart1.png" and "repeat"). Huh... Well, thanks for trying to help, at least~!

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

Re: Little idea what I am doing (ATL)

#6 Post by Alex »

Try

Code: Select all

$ heartbeat = 1.00
(19/20 = 0, but 19.00/20.00 = 0.95)

10kNing
Regular
Posts: 51
Joined: Fri Apr 29, 2011 9:37 pm
Projects: Revenance (RPG), Mad-Love (GxB, on hold)
Location: NYC
Contact:

Re: Little idea what I am doing (ATL)

#7 Post by 10kNing »

It worked!! Thank you! ^^

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Little idea what I am doing (ATL)

#8 Post by Milkymalk »

Alex wrote:Try

Code: Select all

$ heartbeat = 1.00
(19/20 = 0, but 19.00/20.00 = 0.95)
I thought to get integer division, you had to use "//" instead of "/"?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Little idea what I am doing (ATL)

#9 Post by PyTom »

Milkymalk wrote:I thought to get integer division, you had to use "//" instead of "/"?
That's Python 3. Ren'Py uses Python 2 for the time being.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot