How to open world

s2smakinesi

New Member
Jul 16, 2020
4
0
I am trying make open world like milfy city. When I click the kitchen door I want to stay in kitchen but when I click the door I enter the kitchen, exit there and return the corridor. It's happening one click. How can ı stay in the kitchen when I click the door. I wrote my code below and my kitchen and corridor pictures.
Code:
#script file
define u = Character("Ben")

label start:
    "hello"
    scene image1
    "asd"
label firstdate:
    scene image3
    "this is my first date"
    call screen myfirstscreen
#another file
screen myfirstscreen():
    modal True
    add "image1"
    imagebutton:
        focus_mask True
        idle "image4"
        hover "image2"

        action Jump("firstdate")
image4.png koridor1sabahhover.png koridor1sabahhover.png koridor1sabahhover.png image3.png koridor1sabah.png
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Erm, I'm not sure your actual question makes sense. "When I click the kitchen door - I want to stay in the kitchen", except "When I click the door I enter the kitchen, exit there and return the corridor."

Normally, you'd have a RenPy screen: per room. With an imagebutton: per area of the screen you want to be clickable.

So when you're in the corridor, you show the corridor screen. Which seems to have 2 exits, the kitchen the and living room. You might have a 3rd clickable area to turn around, but that's up to you. Each of those clickable areas has an imagebutton and each image button has an action (which is probably an action Jump()).

Then, when you in the kitchen, you have a single clickable area, which seems to be a jump back into the corridor.

Each "area" would have a separate label: and all the code associated with that area would normally be there.

Your example only has a single area... label firstdate:. You show the screen, click the clickable area and it jumps back to itself. So it you're actual code has the same code... then you're locked in a loop in the corridor.

I'd expect something more like:

Python:
#--- screens file ---
screen room_corridor():
    modal True
    add "image1"
    imagebutton:
        focus_mask True
        idle "image4"
        hover "image2"
        action Jump("enter_kitchen")

    imagebutton:
        focus_mask True
        idle "image6"
        hover "image5"
        action Jump("enter_livingroom")

screen room_kitchen():
    modal True
    add "image101"
    imagebutton:
        focus_mask True
        idle "image104"
        hover "image102"
        action Jump("enter_corridor")


#--- script file ---
define u = Character("Ben")

label start:
    "hello"
    jump enter_corridor

label enter_corridor:

    scene image1
    call screen room_corridor

label enter_kitchen:

    scene image101
    call screen room_kitchen

label enter_livingroom:

    # blah, blah

Of course, this only gets you moving between rooms and not really doing anything while your there... but that is another topic.

As a slight aside, you don't need both a scene image1 AND an add "image1".

Personally, I would just use scene:, as just using add alone can lead to some odd things happening (like blank transparent screens or previous images you through were ancient history showing up).

add just adds an image to screen. In this context, that's just changing the background image to be a full screen image of the corridor or kitchen. But the scene statement is doing the same thing.

There's no harm in doing both, but you're effectively saying "set image1 as the background" then "when you show this screen, use image1 as its background" - it's doing twice the work... of fractions of a microsecond... but still.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,192
Personally, I would just use scene:, as just using add alone can lead to some odd things happening (like blank transparent screens or previous images you through were ancient history showing up).
It also permit to have a better customization since the scene can be updated at anytime, while the screen stay the same ; as long as the change don't interfere with the imagebutton content, of course.