Variable controlled ATL choice statements in livecomposit

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
magi
Special Project Artist
Posts: 323
Joined: Thu Jul 14, 2005 7:06 pm
Projects: Hanafuda Club, Infinity Rain
Location: Arizona
Contact:

Variable controlled ATL choice statements in livecomposit

#1 Post by magi »

I am using live composit to make a character image base on several components.

Code: Select all

#Satchel Normal Live Composite
image sat normal = LiveComposite(
    (438, 1500),
    (0, 0), "sat body base.png",
    (0, 0), "sat bra 01.png",
    (0, 0), "sat panty 01.png",
    (0, 0), "sat shirt 01.png",
    (0, 0), "sat_arms",
    (0, 0), "sat shirt 01 shoulder.png",
    (0, 0), "sat hair back curl 01.png",
    (0, 0), "sat head forward.png",
    (0, 0), "sat hair base.png",
    (0, 0), "sat eye blink",
    (0, 0), "sat mouth",
    (0, 0), "sat hair front fringe 001.png")
Some of the image component I used here is animated ATL statement that I just recently started learning.

So far, I was able to insert a simple ATL image that makes this character's eyes blink, and a separate one that uses condition switch _last_speak to control lip flap.

Now, I have put in one image that is atl choice statement, ""sat_arms". I did some search around and I found instead of using condition switch, I can apply variable check to choice, apparently, so this was what I came up with.

Code: Select all

$ satap=1
image sat_arms:
    choice (satap==1):
        "sat arm back.png"
    choice (satap==2):
        "sat arm front.png"
The first problem I encounter with this setup was NameError. Saying that satap is undefined.

After fiddling around a little, I created an init: block and put that variable in there, however the live composition would not change if I were to change the variable by putting something like
"$ satap=2" in the body of the script. It'll just display whatever number that is in the init block.

Although I found its not the problem with "choice" statement itself I think. If I were to do one like the example from the documentation, it does randomly choose one of the arm poses everytime the composite was displayed. If I put pause and repeat, it'll animated it randomly, but if I were to insert a variable change, it does nothing, only display based on variable from the init: block.

I thought I needed to reload the composite for it to take effect so I did an experiment to see if after changing variable and showing the composite to see if it work, but nothing changes.

Code: Select all

label start:
    scene bg betaman room 001
    show sat normal at top with dissolve
    s "this is a test."
    hide sat normal at top with dissolve
    $ satap="2"
    show sat normal at top with dissolve
    s "to see if my pose change base on varialbe change."
    $ satap="1"
    show sat normal at top with dissolve
I am mostly an art person so I hope this won't come across as too tedious of a question.
I am not sure what I am doing wrong in this, thanks for reading. :)
Attachments
Capture.JPG

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2404
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Variable controlled ATL choice statements in livecomposi

#2 Post by Ocelot »

1 != '1'.

You are comparing variable with integer, but assigning a string to it. I honestly surprised it didn't crash. If you want integer, use integer: $ satap=1

On a side note: this is not what expressions in choice statements are created for, but amusingly, they would work, as you have intended.
< < insert Rick Cook quote here > >

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

Re: Variable controlled ATL choice statements in livecomposi

#3 Post by philat »

But what's the reason for using choice as opposed to ConditionSwitch or dynamic images? https://www.renpy.org/doc/html/changelo ... mic-images

magi
Special Project Artist
Posts: 323
Joined: Thu Jul 14, 2005 7:06 pm
Projects: Hanafuda Club, Infinity Rain
Location: Arizona
Contact:

Re: Variable controlled ATL choice statements in livecomposi

#4 Post by magi »

Ocelot: Hey thanks, making those integers consistent make the result more predictable.

philat: I do have a version if condition switch , but I was under the impresison that it can only be used for 2 condition for some reasons, but now I got the type of variable consistent it becomes more predictable, thanks. I am not too up on the new features, I am only just starting learning thing pieces by piece.

Code: Select all

image sat_arms = ConditionSwitch(
    "satap == 1", "sat arm back.png",
    "satap == 2", "sat arm front.png",
    "satap == 3", "sat arm thought 001.png")

Image
Image
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]