Little Known Ren'Py

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
User avatar
PyTom
Ren'Py Creator
Posts: 15469
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:

Little Known Ren'Py

#1 Post by PyTom » Sun Sep 08, 2013 4:09 pm

Here's a thread where I can post little Ren'Py tidbits that might not be getting enough attention, in the hopes that people will notice than their use will help influence people's programming title.


#1. ATL Transforms can be used inside ATL Interpolations

If you have a sufficiently simple ATL transform, you can use it inside an ATL interpolation (for example, "linear") statement. Sufficiently simple is defined as a single line, consisting entirely of property-setting clauses. This is the case for the sort of positioning transforms we see a lot. (The built-in left, right, and center, or ones you define yourself.)

So you could have:

Code: Select all

transform topleft:
     xalign 0.0 yalign 0.0

transform topright:
     xalign 0.0 yalign 1.0
You can do:

Code: Select all

transform left_right_left_right:
    left
    linear 1.0 right
    linear 1.0 left
    linear 1.0 right

The idea is that you can abstract out positions in your ATL.

I hope this helps a little.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
KomiTsuku
Eileen-Class Veteran
Posts: 1023
Joined: Mon Sep 22, 2008 11:32 pm
Completed: Dreams of the Skies, Anton's Vacation, Luka, The Halberd and The Tiger, Rising Angels, Pyrite Heart, Rising Angels: Reborn, The Halberd and The Fox, VN Tycoon, RA: Hope
Projects: Rising Angels
Organization: IDHAS Studios
IRC Nick: Komi
itch: idhas
Location: Somewhere
Contact:

Re: Little Known Ren'Py

#2 Post by KomiTsuku » Sun Sep 08, 2013 4:12 pm

I still think you are using demon magic to make #1 work.

*goes to implement*

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Little Known Ren'Py

#3 Post by Elmiwisa » Mon Sep 09, 2013 5:19 am

Ah this thread seem like a good idea. :) How often would this be updated? Also, shouldn't it get pinned to the top? :idea:

User avatar
PyTom
Ren'Py Creator
Posts: 15469
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 Known Ren'Py

#4 Post by PyTom » Mon Sep 09, 2013 11:13 am

It will be updated when I feel like adding something to it. And it shouldn't get pinned - I don't think people read pinned threads that often. :-)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1777
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Little Known Ren'Py

#5 Post by OokamiKasumi » Mon Sep 09, 2013 6:25 pm

Elmiwisa wrote:...shouldn't it get pinned to the top? :idea:
I'm for pinning it so it won't get Lost among all the other posts.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Little Known Ren'Py

#6 Post by TrickWithAKnife » Wed Sep 18, 2013 10:23 am

I have to agree with pinning it. If I hadn't replied, this topic would have been lost to the murky depths of page 2 within a couple of days. Once that happens, it's like it never existed.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

clannadman

Re: Little Known Ren'Py

#7 Post by clannadman » Mon Sep 23, 2013 8:06 am

Is this more of a cookbook thread?

User avatar
PyTom
Ren'Py Creator
Posts: 15469
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 Known Ren'Py

#8 Post by PyTom » Mon Sep 23, 2013 5:33 pm

No, since it's not on a single topic. And while I'm at it, I have a good idea for a second post.


#2. Say with image attributes.

Say with image attributes was added in 6.12, but its use never really took off. Hopefully, this will fix that. First off, what are image attributes? In the following image statements, the bolded parts are image attributes.

image eileen tshirt happy = "eileen_tshirt_happy.png"
image eileen swimsuit happy = "eileen_swimsuit_happy.png"
image eileen swimsuit mad = "eileen_swimsuit_happy.png"

Ren'Py keeps track of the attributes of each image. When you show an image with attributes, it tries to find a unique image such that the smallest number of attributes change. So we can do:

Code: Select all

# If eileen isn't shown, we have to give all the attributes.
show eileen tshirt happy
e "So we're here at the beach."

show eileen swimsuit
e "How do I look?"

show eileen mad
e "Hey! My eyes are up here!"
This code shows eileen tshirt happy, eileen swimsuit happy, and eileen swimsuit mad, in that order.


That code isn't much simpler then the version that includes more attributes. However, if we give the characters we use the image parameter, like so:

Code: Select all

define e = Character("Eileen", image="eileen")
we can then use the say with image attributes statement. That's just a regular say statement (as opposed to a narration say) with image attributes placed between the character and the text. The code above could then be written as:

Code: Select all

show eileen tshirt happy
e "So we're here at the beach."

e swimsuit "How do I look?"

e beach "Hey! My eyes are up here!"
You need the first show statement, since say with image attributes won't show an image tag that isn't currently shown. But after that, say with image attributes makes it easy to updates a character's expressions.

(There's some more stuff involving side images, but I'll stop here for today, to let people digest this, find mistakes, and ask questions.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Little Known Ren'Py

#9 Post by Elmiwisa » Tue Sep 24, 2013 6:07 am

I didn't know this is unpopular feature. I use them all the time, just so convenient.
I think it's possible that this doesn't mesh really well with transition and transform. There is config.say_attribute_transition but there is less control over that, and absolutely nothing for transform I think.
Unfortunately this doesn't work with say statement which is part of menu though :(
Like this:

Code: Select all

menu:
    alice bored "Where?" #<---will produce error
    #choices here

Post Reply

Who is online

Users browsing this forum: Bing [Bot], deadhand, Google [Bot], mikolajspy