Using "action" with imagebutton on trooper6 clock

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
Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

Using "action" with imagebutton on trooper6 clock

#1 Post by Psion » Sat Dec 12, 2020 10:14 am

I`m using digital clock from viewtopic.php?f=51&t=21978. Im trying to make clock a button. So when you click on a clock its add an hour. But when i try to use "action" command to add time, it does not work. However it add time when i hover on it.
Sorry for noob question. Im sure i fogot to add symbol $ somewhere or something...

Code: Select all

screen clock_screen:
    imagebutton:
        idle myClock
        xpos 800 ypos 3
        action [myClock.add_time(1,0)] hovered ShowTransient("label_wait") unhovered Hide("label_wait")
        
        
screen label_wait:
    frame:
        background Frame("wait.png")
        transclude
        
Attachments
2020-12-12 17_06_33-Chemist.png
2020-12-12 17_06_33-Chemist.png (7.71 KiB) Viewed 419 times

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Using "action" with imagebutton on trooper6 clock

#2 Post by hell_oh_world » Sat Dec 12, 2020 10:26 am

functions are different from actions, if you want to run a function as an action use the Function() action. See the docs for more details.

Code: Select all

action Function(clock.add_time, 1, 0)

Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

Re: Using "action" with imagebutton on trooper6 clock

#3 Post by Psion » Sat Dec 12, 2020 10:36 am

Ok, its working, thank you.
I tried Function but not in a way you put it. I had more brackets...

Post Reply

Who is online

Users browsing this forum: No registered users