Why can't you use screen language for this? I just created a test version of this in screen language with conditional buttons.
Here is a summary of what I did:
*There are lots of ways to do access your closet, I created a Closet button that will open and close the closet and put that in the bottom-ish right corner of the screen, which makes the Resume button a bit pointless. However, I also didn't make the closet screen modal...but I could see you wanting to do that. If you did, then you would want that resume screen and you could slim down the Closet button's code. I can see a case for both options.
*I didn't see the need for the change_shirt function when you can just set the shirt variable directly, so I got rid of that function.
*For your conditionals to work, I set up unlock flags, you'll see them after the start label. The way the If action works is (Condition, What to do if True, What to do if False), by having "None" as the what to do if False, the button is greyed out and insensate if the item is not unlocked.
*I also thought it might be nice, in the absence of your Dynamic Displayable graphics, to see that color is actually changing (i.e. that the variable change works), so I made it so that the shirt label changes color based on what button you've pushed.
*The code also unlocks each button in order so you can see that that works.
This is the code (this is the complete script.rpy file:
Code: Select all
screen closet_screen():
tag menu
#modal True
vbox:
if shirt == 0:
label "{color=#FF9900}Shirt" align (0.5, 0.1)
elif shirt == 1:
label "{color=#006600}Shirt" align (0.5, 0.1)
elif shirt == 2:
label "{color=#FF0000}Shirt" align (0.5, 0.1)
else:
label "Shirt" align (0.5, 0.1)
hbox:
textbutton "Orange" action If(unlock_orange_shirt, SetVariable ("shirt", 0), None)
textbutton "Green" action If(unlock_green_shirt, SetVariable ("shirt", 1), None)
textbutton "Red" action If(unlock_red_shirt, SetVariable ("shirt", 2), None)
textbutton "Resume" action Hide("closet_screen")
screen control():
frame:
xalign 0.95
yalign 0.7
textbutton "Closet" action If(renpy.get_screen("closet_screen"), Hide("closet_screen"), Show("closet_screen"))
# The game starts here.
label start:
$shirt = None
$unlock_orange_shirt = False
$unlock_green_shirt = False
$unlock_red_shirt = False
show screen control()
"Nothing is unlocked--Orange: [unlock_orange_shirt], Green: [unlock_green_shirt], Red: [unlock_red_shirt]"
$unlock_orange_shirt = True
"Unlocking Orange--Orange: [unlock_orange_shirt], Green: [unlock_green_shirt], Red: [unlock_red_shirt]"
$unlock_green_shirt = True
"Unlocking Green--Orange: [unlock_orange_shirt], Green: [unlock_green_shirt], Red: [unlock_red_shirt]"
$unlock_red_shirt = True
"Unlocking Red--Orange: [unlock_orange_shirt], Green: [unlock_green_shirt], Red: [unlock_red_shirt]"
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978