Making a screen that shows results one by one

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
goldo
Regular
Posts: 63
Joined: Mon Jan 23, 2017 8:23 am
Contact:

Making a screen that shows results one by one

#1 Post by goldo » Mon Mar 30, 2020 10:03 am

Hi guys,

I am trying to create a specific screen animation that displays the results of an interaction (like stat X up by Y, gold and XP made...) one after the other. Basically it's like a vbox, with each element fading in after the other. Cherry on top would be to have a brief 'tadaa' sound playing as each result shows.

I'm guessing using ATL inside the screen would be best, but I have no clue exactly how to go about it.

I'm guessing it would look something like this:

Code: Select all

screen result_screen:

    has vbox

    text "Results" bold True

    text "Strength: +" + str(strength_bonus) at magic_transform # fades in after 1 second, playing sound
    text "XP: +" + str(xp_bonus) at magic_transform # fades in after 2 second, playing sound
    text "Gold: +" + str(gold_bonus) at magic_transform # fades in after 3 second, playing sound
My problem is that I have no idea how to write the "magic_transform" part or how to add a timer to make it happen each after the other (or how to play a sound at the same time, for that matter).

If you could point me in the right direction, a quick code example would be awesome... Thank you!

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Making a screen that shows results one by one

#2 Post by Per K Grok » Mon Mar 30, 2020 11:24 am

goldo wrote:
Mon Mar 30, 2020 10:03 am
Hi guys,

I am trying to create a specific screen animation that displays the results of an interaction (like stat X up by Y, gold and XP made...) one after the other. Basically it's like a vbox, with each element fading in after the other. Cherry on top would be to have a brief 'tadaa' sound playing as each result shows.

I'm guessing using ATL inside the screen would be best, but I have no clue exactly how to go about it.

I'm guessing it would look something like this:

Code: Select all

screen result_screen:

    has vbox

    text "Results" bold True

    text "Strength: +" + str(strength_bonus) at magic_transform # fades in after 1 second, playing sound
    text "XP: +" + str(xp_bonus) at magic_transform # fades in after 2 second, playing sound
    text "Gold: +" + str(gold_bonus) at magic_transform # fades in after 3 second, playing sound
My problem is that I have no idea how to write the "magic_transform" part or how to add a timer to make it happen each after the other (or how to play a sound at the same time, for that matter).

If you could point me in the right direction, a quick code example would be awesome... Thank you!

I'm not quite sure exactly what the result you are looking for are, but maybe there are something in the following that could be useful.

Code: Select all

default tid=0

screen result_screen:


    vbox:

        text "Results" bold True
        if tid==0:
            text "Strength: +" + str(strength_bonus)        # at magic_transform # fades in after 1 second, playing sound
        elif tid==1:
            text "XP: +" + str(xp_bonus)                    # at magic_transform # fades in after 2 second, playing sound
        elif tid==2:
            text "Gold: +" + str(gold_bonus)                # at magic_transform # fades in after 3 second, playing sound


        if tid==2:
            timer 2.0 action [SetVariable("tid", 0),  Play(0,"sound/BUZZ01.ogg")] 
        else:
            timer 2.0 action [SetVariable("tid", tid + 1),  Play(0,"sound/BUZZ01.ogg")] repeat True

goldo
Regular
Posts: 63
Joined: Mon Jan 23, 2017 8:23 am
Contact:

Re: Making a screen that shows results one by one

#3 Post by goldo » Mon Mar 30, 2020 1:03 pm

Thanks! That helps with the text and sound part. :)

I will try that with ATL and report on how it's going.

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

Re: Making a screen that shows results one by one

#4 Post by philat » Mon Mar 30, 2020 8:56 pm

There is a delayed_blink transform in the skip_indicator screen (which shows three blinking triangles on repeat during skipping) which should be helpful on the ATL front.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]