Showing/Changing variables with ui functions.

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
Hukatsu
Newbie
Posts: 5
Joined: Fri Jan 13, 2017 6:15 pm
Contact:

Showing/Changing variables with ui functions.

#1 Post by Hukatsu »

Hey guys, I want to know how to show and change variables inside a "ui". Code example:

Code: Select all

init python:
    def calls():
        if show_calls:

            ui.frame()
            ui.vbox()
            
            ui.label("Make a Telephonic Call")
            ui.textbutton("Call Lucas", clicked="change a variable out of init python")
            ui.textbutton("Call Chris", clicked="change variable")
            ui.textbutton("Call Lais", clicked="change variable")
            ui.text("You have (show variable's value here) calls remaining")
            ui.close()
    config.overlay_functions.append(chamadas)
How?

User avatar
SypherZent
Veteran
Posts: 362
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Location: Puerto Rico
Contact:

Re: Showing/Changing variables with ui functions.

#2 Post by SypherZent »

Could be many ways to achieve that.

Have you tried using "clicked=ui.returns(String)" where string is the value to return when the specific button is selected, and then evaluating the user's selection in the script?

Might be more information here:
https://www.renpy.org/wiki/renpy/doc/re ... _Functions

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Showing/Changing variables with ui functions.

#3 Post by xavimat »

Well... :roll:
simply don't use ui. functions. Use the screen language instead.
https://www.renpy.org/doc/html/screens.html
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]