[SOLVED] Button that activates NVL mode

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
gecco
Newbie
Posts: 5
Joined: Sun Apr 09, 2023 8:09 pm
itch: geccobuttherealone
Contact:

[SOLVED] Button that activates NVL mode

#1 Post by gecco »

Hey there!

I am using https://nighten.itch.io/yet-another-phone-renpy in my game, making the NVL screen being formated as a phone screen. So i wanted to create a image button on the top left corner that can activate and deactivate the nvl mode, as it's pushing and pulling the phone away.

I am new to Ren'py and Python so I really do not know how to code it or in which file i should try coding it.
Last edited by gecco on Mon Apr 10, 2023 8:21 pm, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Button that activates NVL mode

#2 Post by _ticlock_ »

gecco wrote: Sun Apr 09, 2023 9:09 pm Hey there!

I am using https://nighten.itch.io/yet-another-phone-renpy in my game, making the NVL screen being formated as a phone screen. So i wanted to create a image button on the top left corner that can activate and deactivate the nvl mode, as it's pushing and pulling the phone away.

I am new to Ren'py and Python so I really do not know how to code it or in which file i should try coding it.
It depends on what you want to do with this system. Here is a possible example.

Code: Select all

screen phone_button:
    imagebutton:
        ...
        action Call("phone_msg")
        
label start:
    show screen phone_button
    ...
    
    
label phone_msg:
    # Here is your nvl phone dialogue.
    # Possibly, you want some variables that would track what is supposed to be shown here.

gecco
Newbie
Posts: 5
Joined: Sun Apr 09, 2023 8:09 pm
itch: geccobuttherealone
Contact:

Re: Button that activates NVL mode

#3 Post by gecco »

Thank you so much!!! I'll try it out!
Last edited by gecco on Mon Apr 10, 2023 3:01 pm, edited 1 time in total.

gecco
Newbie
Posts: 5
Joined: Sun Apr 09, 2023 8:09 pm
itch: geccobuttherealone
Contact:

Using the button to show and hide NVL mode

#4 Post by gecco »

_ticlock_ wrote: Sun Apr 09, 2023 10:30 pm
gecco wrote: Sun Apr 09, 2023 9:09 pm Hey there!

I am using https://nighten.itch.io/yet-another-phone-renpy in my game, making the NVL screen being formated as a phone screen. So i wanted to create a image button on the top left corner that can activate and deactivate the nvl mode, as it's pushing and pulling the phone away.

I am new to Ren'py and Python so I really do not know how to code it or in which file i should try coding it.
It depends on what you want to do with this system. Here is a possible example.

Code: Select all

screen phone_button:
    imagebutton:
        ...
        action Call("phone_msg")
        
label start:
    show screen phone_button
    ...
    
    
label phone_msg:
    # Here is your nvl phone dialogue.
    # Possibly, you want some variables that would track what is supposed to be shown here.
Thank you! the button works, but I wanted to make it in a way that if I click again, it hide the NVL screen, like showing and hiding the phone. How can i do that?

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Using the button to show and hide NVL mode

#5 Post by _ticlock_ »

gecco wrote: Mon Apr 10, 2023 2:59 pm Thank you! the button works, but I wanted to make it in a way that if I click again, it hide the NVL screen, like showing and hiding the phone. How can i do that?
For example:

Code: Select all

screen phone_button:
    default phone_on = False
    imagebutton:
        idle Solid("#f00", xysize=(100,100))
        hover Solid("#f0f", xysize=(100,100))
        # action If("phone_on", true = Return(), false=Call("phone_msg"))
        if phone_on:
            action SetScreenVariable("phone_on", False), Jump("phone_msg.end")
        else:
            action SetScreenVariable("phone_on", True), Call("phone_msg")

Code: Select all

label phone_msg:
    ...
label .end:
    show screen phone_button # To reset phone_on to False
    return

Post Reply

Who is online

Users browsing this forum: Bmac60506