How to 'stop' game when I show player interactivemap?

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
MuteSummer
Newbie
Posts: 2
Joined: Sun Jan 19, 2020 1:31 pm
Contact:

How to 'stop' game when I show player interactivemap?

#1 Post by MuteSummer » Sun Jan 19, 2020 2:30 pm

Hello. So, we got this: player read some text, and then in corner of screen appear button "Map" . Untill player click this button, game mustnt end, and no other text must appear (at least I try make it like this). Whats best way to solve this problem?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 611
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: How to 'stop' game when I show player interactivemap?

#2 Post by Per K Grok » Sun Jan 19, 2020 5:33 pm

MuteSummer wrote:
Sun Jan 19, 2020 2:30 pm
Hello. So, we got this: player read some text, and then in corner of screen appear button "Map" . Untill player click this button, game mustnt end, and no other text must appear (at least I try make it like this). Whats best way to solve this problem?
I would use

$ renpy.pause(hard=True)

though that is somewhat frowned upon.
You would then need something that take the player beyond that stop point. You could have a jump to label in the screen action that gets the game running again when the player done what it where supposed to do.
Image Visual Story Telling, DeviantArt Group for animations, comics, games and illustrations https://www.deviantart.com/acgi

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2814
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: How to 'stop' game when I show player interactivemap?

#3 Post by Imperf3kt » Sun Jan 19, 2020 6:29 pm

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

User avatar
gas
Miko-Class Veteran
Posts: 546
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How to 'stop' game when I show player interactivemap?

#4 Post by gas » Sun Jan 19, 2020 8:15 pm

I dunno if you want for that "text" to stay put, but more probably what you want for is to CALL that screen.

call screen mybutton

The execution stop until something do a Return action.
Your button can Show another screen the same and execution doesn't proceed as long as you don't give a Return action somewhere (more probably selecting the location in that map).
10 ? "RENPY"
20 GOTO 10

RUN

strayerror
Regular
Posts: 106
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: How to 'stop' game when I show player interactivemap?

#5 Post by strayerror » Sun Jan 19, 2020 11:38 pm

You can use screenlang's modal True to achieve this effect.

If we use the screen to intercept interactions similar to the suggestion by gas, but use show screen rather than call screen we're able to display it overlaid on dialogue instead of outright replacing it. The caveat to this approach is that because we've forgone the secret sauce provided by call screen, we must hide the button screen ourselves when we're finished with it. In this example we use the button action to simply Return which acts as a normal player click/interaction that advances the game, and explicitly hide the screen in the next line of the script/dialogue that we're progressing through.

There are also some nice side-benefits to this approach: By leveraging show screen in conjunction with Return rather than Jump or Call actions, the rollback system simply sees the advancement as a normal interaction giving us safe rollback-compatible progression with working rollback and roll-forward despite having forced the player to take an action on a screen. It's also skip-proof, providing an experience very similar in style to Ren'Py's out of the box menu system. Finally, using a screen allows access to the usual accessibility features, allowing additional information to be given to visually-impaired users about the non-standard progression method if desired, and by default allowing the use of the keyboard to proceed (via the arrow keys to locate the button and enter to "click") if they're unable to visually locate the button.

Hope this A) is what you wanted, and B) helped! XD

Code: Select all

label start:
    scene black
    "At first, everything was dark."
    "There was nothing for it."
    show screen the_button()
    "If I was to make it out alive, I'd have to click the map."
    hide screen the_button
    jump map

label map:
    scene
    "It turned out the map was a lie."
    "Unfinished, with nowhere to go. What a silly demo."
    pause
    return

screen the_button():
    modal True

    textbutton 'Map':
        action Return()
        align (.95, .95)
        hover_background '#666'
        idle_background '#333'
        padding (10, 10)

User avatar
gas
Miko-Class Veteran
Posts: 546
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How to 'stop' game when I show player interactivemap?

#6 Post by gas » Mon Jan 20, 2020 6:30 am

strayerror wrote:
Sun Jan 19, 2020 11:38 pm
...
[/code]
You don't need a Return() that way, you can simply Hide() as action. That doesn't require the need to directly hide the screen.
Anyway, I suppose that button is there to actually show somethingm, probably that map screen... Who knows XD.
10 ? "RENPY"
20 GOTO 10

RUN

MuteSummer
Newbie
Posts: 2
Joined: Sun Jan 19, 2020 1:31 pm
Contact:

Re: How to 'stop' game when I show player interactivemap?

#7 Post by MuteSummer » Mon Jan 20, 2020 2:01 pm

Per K Grok wrote:
Sun Jan 19, 2020 5:33 pm
MuteSummer wrote:
Sun Jan 19, 2020 2:30 pm
Hello. So, we got this: player read some text, and then in corner of screen appear button "Map" . Untill player click this button, game mustnt end, and no other text must appear (at least I try make it like this). Whats best way to solve this problem?
I would use

$ renpy.pause(hard=True)

though that is somewhat frowned upon.
You would then need something that take the player beyond that stop point. You could have a jump to label in the screen action that gets the game running again when the player done what it where supposed to do.
Thanks! That definetly what I needed!:3

strayerror
Regular
Posts: 106
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: How to 'stop' game when I show player interactivemap?

#8 Post by strayerror » Mon Jan 20, 2020 2:51 pm

gas wrote:
Mon Jan 20, 2020 6:30 am
You don't need a Return() that way, you can simply Hide() as action. That doesn't require the need to directly hide the screen.
Anyway, I suppose that button is there to actually show somethingm, probably that map screen... Who knows XD.
Unfortunately using Hide (and removing the hide screen line comes with numerous drawbacks:
- Clicking it won't appear to do anything, the button vanishes but nothing progresses.
- It's not rollback safe - try rolling back and forward over the click, when rolling forward the button will stay visible, and because the screen is modal it'll block non-roll-forward progression until clicked again.
- It requires including the screen name in the definition of the screen, which can hamper development when needing to rename a screen or copy paste a snippet for reuse, so it's a nice QoL boost if we can possibly avoid it.

The idea with using show screen is a little cheaty - we as developers know that clicking the button is mandatory to progress, so there's no need for a branching dialogue or code path, we just temporarily change the method of progression. The jump map in the example is intended to represent the jump to the map proper, what the map dialogue does (call a map screen, display an image), doesn't matter for the purposes of this mechanic.

Hope that provides some insight as to why sometimes Hide isn't an ideal solution. :)

Post Reply

Who is online

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