We can do that by show/hide screen. But if we need there some complex algorithm, or for example drag-dropping, then it's hard to avoid things like "jump", "call" or "return" (e.g. return not None when dropping). And those things finalize the current interaction, so our dialog or menu progresses to the next statement.
How to come back to the same line of dialog or the same screen "choice" (that we started our additional actions from)?
There is a solution like renpy.call_in_new_context(), but it loses the current context. It hides the dialog screen and the like. What if we want to have both dialog or menu AND additional elements with complex logic or interactions like drag-and-drop?
After many hours of research I haven't found a good documented way, so here's how I did it using undocumented Ren'Py innards.
In this example, a button shows the additional screen. That screen polls undocumented renpy.game.context().current to get the address of the current statement (like "say" or "choice"). We repeatedly store that current address to a variable, and at the same time we can click and progress with dialog or menu, as much as we want.
Then if some actions are necessary that would perform additional tasks (and eventually finalize the current interaction), we stop polling the current address. Later, after we have done what we needed, we jump back to our saved address. This way we can see again the previous dialog line or choice menu.
The only drawback is that there will be a double record in History, but that can be mended (or ignored). Here's a complete test code with some additional bells and whistles. Just replace "some_picture" with some picture, or remove that scene statement. It's there just to show that things like changed background might need to be addressed.
Code: Select all
default currAddr = None
default currAddrLast = None
default inCall = None
default inCallLast = None
screen additional():
if not inCall:
$ currAddr = renpy.game.context().current
$ currAddrLast = currAddr[-1]
button:
text "Leave statement [currAddrLast!q]"
pos (0, 0)
action [
SetVariable("inCall", currAddr),
SetVariable("inCallLast", currAddrLast),
Jump("called")
]
else:
button:
text "Return to statement [inCallLast!q]"
pos (0, 100)
action [
Hide("additional"),
Jump(inCall)
]
screen myButt():
button:
text "Open Additional"
align (1.0, 0.0)
action [
SetVariable("inCall", None),
Show("additional")
]
label start:
show screen myButt
scene some_picture
"Starting"
menu:
"Menu"
"1":
"1"
"2":
"2"
label ending:
"Ending"
jump start
label called:
scene black
"""1. You don't ask questions.
2. You don't ask questions.
3. No excuses.
4. No lies.
5. You have to trust Dyler Turden.
"""
jump called