Ren'py macro

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
User avatar
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

Ren'py macro

#1 Post by Yuuji » Fri Mar 06, 2015 3:41 am

Hello! I have a suggestion but maybe someone has told about it before me. Sometimes I need to implement the same code in several places of ren'py scripts. For example, some of my buttons have different location and image background but the same conditional actions. I think it's good idea to implement in engine something like macro(if it's feasible). Sorry if I've chosen wrong place to make this topic.
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.

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

#2 Post by PyTom » Fri Mar 06, 2015 9:55 am

Right now, you can do this with the screen language use statement.

Code: Select all

screen file_button(number):
      textbutton "[number]" action FileAction(number)

screen save:
     vbox:
         use file_button(1)
         use file_button(2)
         use file_button(3)
Something like that.
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
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

Re: Ren'py macro

#3 Post by Yuuji » Fri Mar 06, 2015 10:19 am

Yes, of course I can create screens with parameters and use these screens, but I think it would be fine if something like C pre-processor had been as engine feature. It's just suggestion, so don't mind if you think that's bad or unnecessary idea :)
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.

Post Reply

Who is online

Users browsing this forum: No registered users