[SOLVED] preventing screens from being clicked after 1st time

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.
Post Reply
Message
Author
Dr_arell
Regular
Posts: 61
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

[SOLVED] preventing screens from being clicked after 1st time

#1 Post by Dr_arell » Tue Apr 20, 2021 6:38 pm

i got a screen and i want to make it so after shown it runs its action just the first time the screen is clicked.

context:
im using screens also like my character sprites, the final result im trying to achieve is a "Rick and Morty a way back home" interactive characters ui.
basically you click on characters and then a text menu is displayed moving on to conversations on each choice.

well i can do all this but the screen stays there, and you can click it again resetting the conversation and thats the issue. im not trying to hide the screen, i just want it to be unclickable after the first time, again these are also my character sprites.

the screens move around every time they are reloaded, sometimes they appear on the left, sometimes on the right, on top of that, there are screen sprites variations chosen randomly, thats why i cant switch the screen for the image used on the screen, as it has randomness involved, the screen has to persist.

any idea how to make it so it runs its action just the first time ?
Last edited by Dr_arell on Mon May 10, 2021 8:23 pm, edited 1 time in total.

uncoded
Regular
Posts: 27
Joined: Fri Apr 09, 2021 10:29 am
Contact:

Re: preventing screens from being clicked after 1st time

#2 Post by uncoded » Fri Apr 23, 2021 10:04 am

I'm not sure what you are trying to achieve (idk Rick and Morty, I just looked at this video a few seconds). Aren't you just describing a visual novel, aka Ren'Py's core feature ?
If not (sorry), can you provide a demo, and describe what you expect ? (maybe it is in this video, but I didn't see it, so please provide a timestamp)

Anyway, if you want something to happen just once, maybe you can just use a variable and a if condition, and put your one-time processing inside the if ...
🐾

User avatar
Syrale
Regular
Posts: 57
Joined: Sun Oct 25, 2015 10:28 am
Completed: Robot Daycare, Deep Sea Valentine, Locke(d)
Projects: Artificial Selection, rei_carnation
itch: kigyo
Contact:

Re: preventing screens from being clicked after 1st time

#3 Post by Syrale » Fri Apr 23, 2021 10:45 am

I think you might be looking for SensitiveIf().

Since your screens already mostly work, you just have to do the following:
For the button actions, instead of

Code: Select all

action WhatYouWantItToDo()
use

Code: Select all

action [SensitiveIf(not in_conversation), WhatYouWantItToDo()]
Whenever a conversation starts, and you no longer want the sprites to be clickable, set in_conversation to True.
Then, when you want the screens to be clickable again, just set in_conversation to False.
Last edited by Syrale on Tue May 11, 2021 3:03 am, edited 1 time in total.

Dr_arell
Regular
Posts: 61
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

Re: [SOLVED] preventing screens from being clicked after 1st time

#4 Post by Dr_arell » Mon May 10, 2021 8:31 pm

thanks for your help ill try both of your methods and i think what uncoded said makes sense, but i think ill see if i can get what syrale said runing cuz it looks cleaner

respecting for the example uncoded asked, its not shown in that video, or at least on that version of the game, when you click on a character it should display a text menu that yes its very similar to the menu tool renpy gives you, in that version you click on the character and jumps straight to the story/dialogue
you can see what im talking about in this video, at 19:01 https://www.youtube.com/watch?v=YA0-Pf3mupg

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]