I'm working on some conceptual stuff, and I'm trying to sorta make a 'dress up' model where a user can apply different layers via a simple interface at the side of the screen. In the grand scheme of things, there will be checks and balances to prevent conflicting layers and whatnot, but this is purely educational/conceptual for now.
My question is how can I use a screen to pass a variable to a separate label/subroutine? I have a screen menu, it pops up, I select the option, ???, then profit. I'm not fully understanding the Renpy documention here. Using my sample below, I can get my screen to call my label/subroutine, but that's all I can do; I can't get any arguments or keyword arguments to pass, although I'm not fully sure how that works with the Call action. I try to do something like action Call("apply_item", glasses) and it crashes.
My overall desired algorithm:
1. User hits menu/calls it on their own.
2. Selects item from menu
3. Layer is applied to (or removed from) the image on the screen.
4. Return to menu
Below is my trial code:
Code: Select all
define m = Character("Model", who_color="#ffd27c", who_outlines=[(0, "#000", 2, 2)])
image model base = "images/model_base.png"
screen dress_screen(glasses, shirt, pants):
frame:
xalign 0.95 ypos 50
vbox:
textbutton _("Glasses"):
action Call("apply_item")
textbutton _("Shirt"):
action Call("apply_item")
textbutton _("Pants"):
action Call("apply_item")
label start:
#initialization
$ glasses= False
$ shirt= False
$ pants= False
scene black
show model base at center
m "New model"
call screen dress_screen(glasses, shirt, pants)
r "Done"
return
label apply_item:
#Check for layer conflicts
#Apply image here
m "applied"