[Solved] Screen action Show and kwargs issue

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
User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

[Solved] Screen action Show and kwargs issue

#1 Post by backansi »

Code: Select all

init:
    $ morn = 'Rest'
    $ free = 'Rest'
    $ noon = 'Rest'
    
    screen planner: 
        
        vbox:
            align (.5, .5)
            grid 3 2:
                text 'Morning' 
                text 'BreakTime'
                text 'Afternoon'
                
                textbutton morn action Show('schedule', period='morn')
                textbutton free action Show('schedule', period='free')
                textbutton noon action Show('schedule', period='noon')
            textbutton 'Confirm' action Return()
                
    screen schedule(period):
        frame:
            align (.5, .8) 
            vbox: 
                textbutton 'Rest' action [SetVariable(period, 'Rest'), Hide('schedule')]
                textbutton 'Practicing' action [SetVariable(period, 'Practice'),Hide('schedule')]
                textbutton 'Planning Strategy' action [SetVariable(period, 'Planning Strategy'), Hide('schedule')]
                textbutton 'Mind Control' action [SetVariable(period, 'Mind Control'), Hide('schedule')]
                

label start:
    call screen planner
It seems show action with period 'free' and 'noon' does not work within my script.
Whenever I click any button in schedule screen only morn button changes its text.
I do not know what did I miss :?
Last edited by backansi on Tue Oct 10, 2017 6:27 am, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Screen action Show and kwargs issue

#2 Post by Divona »

It is strange, as period kwarg should pass the string to SetVariable... it just pass whatever the first kwarg set to... well, I came up with another way to do it:

EDIT: The issue seems to be a bug with Renpy version 6.99.12. It's fixed with version 6.99.13.

Code: Select all

default morn = 'Rest'
default free = 'Rest'
default noon = 'Rest'

init python:
    def set_schedule(period, value):
        global morn, free, noon

        if period == 'morn':
            morn = value

        if period == 'free':
            free = value

        if period == 'noon':
            noon = value

screen planner:

    vbox:
        align (.5, .5)
        grid 3 2:
            text 'Morning'
            text 'BreakTime'
            text 'Afternoon'

            textbutton morn action Show('schedule', period='morn')
            textbutton free action Show('schedule', period='free')
            textbutton noon action Show('schedule', period='noon')
        textbutton 'Confirm' action Return()

screen schedule(period):

    frame:
        align (.5, .8)
        vbox:
            textbutton 'Rest' action [Function(set_schedule, period, 'Rest'), Hide('schedule')]
            textbutton 'Practicing' action [Function(set_schedule, period, 'Practice'),Hide('schedule')]
            textbutton 'Planning Strategy' action [Function(set_schedule, period, 'Planning Strategy'), Hide('schedule')]
            textbutton 'Mind Control' action [Function(set_schedule, period, 'Mind Control'), Hide('schedule')]


label start:

    call screen planner
Completed:
Image


Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Majestic-12 [Bot]