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.
screen desktop():
.....
######## Desktop Icons ##########
....
# Chatrooms
imagebutton:
at transform:
pos (330, 150)
auto 'images/desktop browse/home/chatroom_icon_%s.webp' focus_mask True
action ToggleVariable("chatrooms_open", "True")
# Area to put all draggable windows in
fixed:
pos(190, 75)
xysize(1500, 750)
# Put all screens in this one group
draggroup:
...
if chatrooms_open:
drag:
draggable True
drag_raise True
use chatrooms
...
Each drag uses a screen with a window and its own functionality. There's also a close button:
screen chatrooms():
....
textbutton "close":
action [SetVariable("chatrooms_open", "False")] # I also tried hiding the screen but that didn't work either
xalign 1.2 yalign -0.2
This set up works for the most part and I'm able to open the screens without any problems. The issue is that closing them doesn't work. When I click on the close button, all the button text just turns white for some reason and the screen stays. I can still interact with the screen normally. The reason I have it set up like this instead of purely putting unique drags within the screens instead is that I wanted certain behaviors like drag_raise, thus requiring them all to be within the same drag group. If anyone has a better idea in mind, I'm all ears but that's what I have for now.
Last edited by jepp21 on Wed Mar 13, 2024 11:14 pm, edited 1 time in total.
No wonder it doesn't work. You are setting your variable "chatrooms_open" to a string that reads "True" / "False". What you wanted is either toggling it or setting it to True (not a string!). Since a non-empty string is always considered True, meaning "False" is also considered True, the hiding doesn't work.
No wonder it doesn't work. You are setting your variable "chatrooms_open" to a string that reads "True" / "False". What you wanted is either toggling it or setting it to True (not a string!). Since a non-empty string is always considered True, meaning "False" is also considered True, the hiding doesn't work.