ATL like choices in labels

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
mold.FF
Newbie
Posts: 21
Joined: Fri Jun 30, 2017 5:04 am
Projects: Tiny Bunny, Crown of Leaves, Army Gals: Poker DLC, Galaxy Girls: Poker DLC
Skype: irzen89
Contact:

ATL like choices in labels

#1 Post by mold.FF »

Hi guys,

Is it possible to implement a "choice" feature from the ATL into regular labels?
I like how I can do this:

Code: Select all

image lucy:
    "lucy_calm"
    4.
    choice:
        "lucy_wierd_1"
    choice:
        "lucy_wierd_2"
    choice:
        "lucy_wierd_3"
    1.
    repeat
And Lucy will stay calm for 4 seconds then do a wierdo with 3 random variations for 1 second, and return to calm for another 4 seconds.
It would be awesome if I could do something similar in dialogs:

Code: Select all

label classroom:
    "I've entered a classroom."
    choice:
        friend1 "Whatsup?"
    choice:
        friend2 "Yo!"
    choice:
        classmates "(Noise)"
    call screen WhatToDoInClassroom()
I know I can use renpy.random for that purpose, and thats what I'm using right now:

Code: Select all

label classroom:
    "I've entered a classroom."
    $ my_random = renpy.random.randint(1, 3)
    if my_random == 1:
        friend1 "Whatsup?"
    elif my_random == 2:
        friend2 "Yo!"
    elif my_random == 3:
        classmates "(Noise)"
    call screen WhatToDoInClassroom()
But there is a couple downsides in this method in comparison to "choices" in ATL:
- things it's starting getting harder when I need to use random within another random
- I have to specify amount of variations beforehand
- weighted random are harder to do

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: ATL like choices in labels

#2 Post by _ticlock_ »

mold.FF wrote: Fri Feb 03, 2023 1:54 pm Is it possible to implement a "choice" feature from the ATL into regular labels?
You can create custom RenPy statement using Creator-Defined Statements
Check the example in the documentation, it is pretty close to what you are looking for.

mold.FF
Newbie
Posts: 21
Joined: Fri Jun 30, 2017 5:04 am
Projects: Tiny Bunny, Crown of Leaves, Army Gals: Poker DLC, Galaxy Girls: Poker DLC
Skype: irzen89
Contact:

Re: ATL like choices in labels

#3 Post by mold.FF »

_ticlock_ wrote: Sat Feb 04, 2023 2:06 am
mold.FF wrote: Fri Feb 03, 2023 1:54 pm Is it possible to implement a "choice" feature from the ATL into regular labels?
You can create custom RenPy statement using Creator-Defined Statements
Check the example in the documentation, it is pretty close to what you are looking for.
!!!
I see how useful this feature could be.
A Big Thank You, _ticlock_

As far as I understood it, it allow me to do the following:
1. Make a "random" statement, which will run a random choice from the global random_choices list on post_execute phase.
2. Make a "choice" statement, which will add a given script block to the global random_choices list, or something like that.

Code: Select all

label classroom:
    "I've entered a classroom."
    random:
        choice:
            friend1 "Whatsup?"
            $ available_options.append("friend1") ## new addition, to show that I need a script section here, not just a random line.
        choice:
            friend2 "Yo!"
            $ available_options.append("friend2") ## new addition, to show that I need a script section here, not just a random line.
        choice:
            classmates "(Noise)"
    call screen WhatToDoInClassroom()
A pure choice - like in example I've posted earlier - looks like a far goal for me now.

Post Reply

Who is online

Users browsing this forum: No registered users