ATL on "show" doesn't work with buttons which have actions

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:

ATL on "show" doesn't work with buttons which have actions

#1 Post by backansi » Fri Oct 01, 2010 1:41 pm

Code: Select all


# Ren'Py Version: Ren'Py 6.11.1b

init:
    
    transform transition:
        xalign .5 
        on show:
            linear .5 alpha 1 ypos 0.5
        on hide:
            linear .5 alpha 0 ypos 1.0
            
    screen topic:
        
        textbutton 'have an action' action Jump('chat') at transition ypos .1
        textbutton 'have a list of action' action [ Hide ('topic'), Jump('chat') ] at transition ypos .2
        textbutton 'no action' at transition ypos .3

label start:
    call screen topic

label chat:
    '..............'

I think it's a bug but if I missed something please tell me what I did wrong.
Thanks.

Octavise
Newbie
Posts: 15
Joined: Thu Oct 28, 2010 2:48 pm
Contact:

Re: ATL on "show" doesn't work with buttons which have actio

#2 Post by Octavise » Thu Oct 28, 2010 3:05 pm

Hmm....I'm new to Renpy but:

1. Will ATL take two properties after a warper?
linear .5 alpha 1 ypos 0.5

all the code I've seen have only listed one property after a warper

2. Will writing linear alpha 1 do anything if alpha hasn't been set to 0 yet. Or is 0 default for alpha when a "linear" warper is written this way.

Again I'm new to Renpy my self but those are the things I would check.
P.S You should include the traceback (error report) so people can follow the problem.

shylock
Regular
Posts: 35
Joined: Wed Oct 13, 2010 11:57 am
Projects: Isle of St. Marcus, `Silver Seas'
Location: Upstate NY
Contact:

Re: ATL on "show" doesn't work with buttons which have actio

#3 Post by shylock » Thu Oct 28, 2010 6:44 pm

functions called by textbuttons cannot have arguments. What's happening is that renpy is thinking that the result of function(argument) is what's trying to be called, rather than calling the function with that argument.

Incendium
Regular
Posts: 25
Joined: Wed Dec 09, 2009 12:57 am
Contact:

Re: ATL on "show" doesn't work with buttons which have actio

#4 Post by Incendium » Thu Oct 28, 2010 10:28 pm

Actions are a special case as they are actually a class which implements a method called __call__().

When you create the object, it is actually returning the reference to the class which then executes the __call__() method when the button is clicked. Here is a simplified example:

Code: Select all

class Test:
    def __call__():
        return 'hello, world'

my_test = Test() # creates a new instance of class Test
my_test() # returns 'hello, world'
In this case, Jump is a class which implements the __call__ method, as is any Ren'Py "Action".

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: ATL on "show" doesn't work with buttons which have actio

#5 Post by backansi » Thu Oct 28, 2010 10:36 pm

Octavise wrote:P.S You should include the traceback (error report) so people can follow the problem.
I'm not a n00b at asking question. It just not worked the way I think so there was no traceback.txt .
Incendium wrote: Actions are a special case as they are actually a class which implements a method called __call__().

When you create the object, it is actually returning the reference to the class which then executes the __call__() method when the button is clicked.
Got it. Thanks.

Anyway, I got an answer about this problem.
PyTom wrote:That's not a problem I can deal with with the current design of ATL. What's happening is that the "show" event is being overridden by the "hover" or "idle" event, as appropriate.
But thanks all of you.

Post Reply

Who is online

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