Page 1 of 1

Ren'py macro

Posted: Fri Mar 06, 2015 3:41 am
by Yuuji
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.

Re: Ren'py macro

Posted: Fri Mar 06, 2015 9:55 am
by PyTom
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.

Re: Ren'py macro

Posted: Fri Mar 06, 2015 10:19 am
by Yuuji
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 :)