[SOLVED] button and function in a screen: how can I use an operation?

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
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

[SOLVED] button and function in a screen: how can I use an operation?

#1 Post by deltadidirac »

hi all,

I'm building a cheat menu, here there is a button that would increase your money....
my problem is that I don't know how and where add this function:
$ money += 5000
## this operation would be execute whenn when you click on the button

here my example:

Code: Select all

screen cheat_1:
    modal True
    zorder 150
    add "cheat_1" at zoommov
    imagebutton:  
        idle "cheatbut-id"
        hover "cheatmon-ho"
        action [  ??????????????????   ]                       ##### here I thought to insert hte function:   $ money += 5000 as in a label (but obviously here don't run)
        xpos 173
        ypos 398
I searched around here and on renpy site, but I didn't found any example
anyone can help me?
I imagine that is only an easy way on how script the operation

thanks

User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

Re: [SOLVED] button and function in a screen: how can I use an operation?

#2 Post by deltadidirac »

this is the solution gave me from a member of Discord:

Code: Select all

on "show" action SetVariable("money",money+5000)

Post Reply

Who is online

Users browsing this forum: No registered users