[...] MC make conversation with her and MC went back to hallway unfortunately player clicked her again " Here I want to show you already talked to her " but I don't know how to make this code in renpy.
I assume you're using something like
imagemap
(clickable rectangles) or
imagebutton
(clickable hotspots of any shape).
Personally, I prefer
imagebutton
and wrote up a while ago how to create clickable hotspots that way.
https://f95zone.to/threads/finding-...-point-click-game-on-renpy.25325/post-1565577
I also wrote a working tech-demo style game semi-recently, with actual code and images.
https://f95zone.to/threads/help-with-imagemaps.50306/post-3336719
Hopefully, whilst you're still new to RenPy - you won't need those explanations... but I'll link them anyway, just in case.
Meanwhile, there is another option to consider instead of "I already talked to her"...
You could just remove the clickable hotspot, so the player CAN'T pick the same conversation twice.
I'm thinking something like:
Python:
default went_to_house2 = False
screen imagebutton_example1_screen():
modal True
add "ib_eg1_background"
imagebutton auto "ib_eg1_opt1_%s.png":
focus_mask True
action Jump ("day1_picked_house1")
if went_to_house2 == False:
imagebutton auto "ib_eg1_opt2_%s.png":
focus_mask True
action Jump ("day1_picked_house2")
imagebutton auto "ib_eg1_opt3_%s.png":
focus_mask True
action Jump ("endof_myexample")
label start:
scene black with fade
"Start:.... "
label day1_start:
scene black
call screen imagebutton_example1_screen
# no need to do anything here, since control will never reach here due to all the hotpots jumping to other places within the code.
label day1_picked_house1:
scene black
pc "I went to house 1."
jump day1_start
label day1_picked_house2:
scene black
pc "I went to house 2."
$ went_to_house2 = True
jump day1_start
label endof_myexample:
"*** THE END ***"
return
In this fictitious example, the player can pick from 3 options. The first two are "go to house 1" and "go to house 2" and the third is "quit/exit".
For some arbitrary reason, you can only visit house 2 once. So rather that go with the "You already visited this house", I'm instead adding
if went_to_house2 == False:
to the
screen
code - to only show the clickable hotspot if the house hasn't been visited yet (well, the variable hasn't been set to True yet).
Alternatively, you could go with a standard
screen
outline and instead go with the example others have given, that would include code that looked something like:
Python:
label day1_picked_house2:
scene black
if went_to_house2 == False:
pc "I went to house 2."
$ went_to_house2 = True
else:
"You already visited this house."
jump day1_start
Another solution to a completely different question, is if you were using
menu:
choices instead of clickable image hotspots. There you can make the menu choice optional by adding
if
statements after the menu option. Including something like:
Python:
label day1_start:
menu:
"Go to House 1" if went_to_house1 == False
$ went_to_house1 = True
jump day1_picked_house1
"Go to House 2" if went_to_house2 == False
$ went_to_house2 = True
jump day1_picked_house2
"I've visited all the houses, time to move on..."
jump endof_myexample
label day1_picked_house1:
#blah blah, more code...
In this case, menu choices will only appear once and again you won't need to include any "You already visited this house." type messages.
If you end up setting all the variables so that NO choices would appear... RenPy skips the menu all together and just continues on to the next statement.
There are all sort of variations on this
menu:
theme, where a final option of something like "Continue" is only shown if all the other options have already been picked... or the game keeps a count of how many menu options have been chosen with a simple number variable, and a "Continue" type menu option is shown after 1 or 2 or 3 or whatever many choices have been made (a handy way to make the player pick at least 1 option, without needing to pick all of them).
Anyway, that is a lot more than you asked for... but each has their own advantages/disadvantages and will be very situational depending on what you are trying to do in your game.