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.
action [Hide ("hallwayThreeCorridorFourDoorOptions"), Hide ("hallwayThreeOptions"), if (introductionOver ) Jump ("corridorFour") else player "I really shouldn't miss my first class"]
That code fragment doesn't work for multiple reasons. Basically I want inside of the action part of an imagebutton, for it to check a variable. If it's true it does what it is supposed to do. If it is not true, the main character says something and the player is not allowed to go to corridorFour. Is there any way to do this elegantly and without creating a new label just for this check?
action [ Hide ("hallwayThreeCorridorFourDoorOptions"),
Hide ("hallwayThreeOptions"),
If( introductionOver,
Jump ("corridorFour"), # True action
Function( renpy.say, "A", "I really shouldn't miss my first class" ) # False action
Function( renpy.say, "B", "I really shouldn't miss my first class" ) # False action
Function( renpy.say, "C", "I really shouldn't miss my first class" ) # False action
) ]
Do I have to include the multiple lines inside a bracket or something?
action If( condition,
[ multiple true actions with commas between each ],
[ multiple false actions with commas between each ] )
Note though that afaik actions like renpy.say will end the interaction and thus end the action. It would be far better to just Jump to an interim label and do stuff there.
action If( condition,
[ multiple true actions with commas between each ],
[ multiple false actions with commas between each ] )
Note though that afaik actions like renpy.say will end the interaction and thus end the action. It would be far better to just Jump to an interim label and do stuff there.
if(scheduleAquired):
imagebutton:
idle "tempButtons/hallwayThreeHallwayTwoDoorButtonGround.png"
hover "tempButtons/hallwayThreeHallwayTwoDoorButtonHover.png"
action [If(enteredHomeroom,
Show("hallwayThreeHallwayTwoDoorOptions"),
Function( renpy.say, "mc", "I check my map. This is not the way to Homeroom. I can't be late for my first class." )
)]
xpos 950
ypos 300
but my game crashes and it tells me "Exception: Cannot start an interaction in the middle of an interaction, without creating new context"
Am I missing something?
After doing some research it seems to be because I am calling the screen in which this imagebutton is contained and not showing it.
I still say, It would be far better to just Jump to an interim label and do stuff there, rather than try to juggle with contexts while handling an interaction.
Remember that a label is just a reference to a script position, it does not have to include dialogue or sprites. You can jump or call a label just to handle binding a value to a range if you like or to toggle a date or to continue the story....