Would the above be valid? if not, is there a way to do this correctly with RenPy?imagebutton:
idle "sozai/ui/clicked1.png"
hover "sozai/ui/clicked2.png"
clicked (($myPoints += 1), Remove(this)) #Add +1 to $myPoints and delete imagebutton afterwards when you click
xpos 58 ypos 545
xanchor 0 yanchor 0
"Clicked" actions
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.
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.
-
- Regular
- Posts: 121
- Joined: Thu Aug 12, 2010 11:47 am
- Contact:
"Clicked" actions
Is there a way to assign several actions to trigger when the user clicks an image button? For example, I would like for a variable to change as well as the image to disappear when the button is clicked:
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: "Clicked" actions
You can use a list as the argument to clicked. For the first part, the obvious thing is to use SetVariable("myPoints", myPoints + 1).
The hiding part is more interesting. Showing/hiding occurs at the screen level, not the button one. So you'd have to set a second variable that controls if the imagebutton is shown or not.
The hiding part is more interesting. Showing/hiding occurs at the screen level, not the button one. So you'd have to set a second variable that controls if the imagebutton is shown or not.
Code: Select all
screen foo:
if canAddPoint:
imagebutton:
idle "sozai/ui/clicked1.png"
hover "sozai/ui/clicked2.png"
clicked [ SetVariable("myPoints", myPoints + 1), SetVariable("canAddPoint", False) ]
xpos 58 ypos 545
xanchor 0 yanchor 0
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Regular
- Posts: 121
- Joined: Thu Aug 12, 2010 11:47 am
- Contact:
Re: "Clicked" actions
Thank you, PyTom!! This worked great! This is exactly what I'm looking for!
Re: "Clicked" actions
Thank you sooooooo much, exactly what I'm looking for too!!
- 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: "Clicked" actions
Be careful, aoSky, that post is 7 years old. Better learn how thinks are done today. For example, don't use "clicked" but "action".
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)
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)
-
- Veteran
- Posts: 312
- Joined: Fri Nov 17, 2017 6:40 pm
- Completed: Apocalypse Lovers
- Projects: Apocalypse Lovers
- Organization: Awake_Production
- Location: France
- Discord: https://discord.gg/apocalypse-lovers
- Contact:
Re: "Clicked" actions
Hi guys,
Sorry for the necroposting but I read the last message and I realize i've always wonder what was the difference beteween the old "cliked" and the new "action" in the image map, image button etc.
It's important for me to understand because I have almost ten thousand line of code using the "clicked" fonction and it still works but I want to know if I absolutly need to modify every "cliked" fonction by "action".
If you guys are still around, thank you to tell me what exactly are the differences between this two things.
Sorry for the necroposting but I read the last message and I realize i've always wonder what was the difference beteween the old "cliked" and the new "action" in the image map, image button etc.
It's important for me to understand because I have almost ten thousand line of code using the "clicked" fonction and it still works but I want to know if I absolutly need to modify every "cliked" fonction by "action".
If you guys are still around, thank you to tell me what exactly are the differences between this two things.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: "Clicked" actions
You can check it out in the renpy documentation, since this post is old, i think the new action is better and easier rather than a hard, old code.
-
- Veteran
- Posts: 312
- Joined: Fri Nov 17, 2017 6:40 pm
- Completed: Apocalypse Lovers
- Projects: Apocalypse Lovers
- Organization: Awake_Production
- Location: France
- Discord: https://discord.gg/apocalypse-lovers
- Contact:
Re: "Clicked" actions
Thank you for this advice but your answer is not really relevant since it's seem you don't know anything about it, like me, exept one is newer than the other, like i already said.isobellesophia wrote: ↑Thu Nov 28, 2019 8:31 am You can check it out in the renpy documentation, since this post is old, i think the new action is better and easier rather than a hard, old code.
As you don't post any link about the renpy documentation maybe than, like me, your didn't read anything about it. Beacause obviously, before posting here , i've searched in the documentation without any result.
I think the explanation I'am looking for is somewhere in a renpy changlog information about the changes between two renpy version but I can't find this anywhere in this : https://www.renpy.org/doc/html/changelog.html. So that's why I wrote this message.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: "Clicked" actions
There isn't a difference. At some point, clicked was renamed to action, as the action can be triggered in different ways (like using a keyboard key, touch screen, or game controller), other than clicking on it. It also makes the action argument to a button the same as other things that have actions (timers and events come to mind).
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 312
- Joined: Fri Nov 17, 2017 6:40 pm
- Completed: Apocalypse Lovers
- Projects: Apocalypse Lovers
- Organization: Awake_Production
- Location: France
- Discord: https://discord.gg/apocalypse-lovers
- Contact:
Re: "Clicked" actions
Thank you! That make sense! I was suspected something like this since I didn't find any difference in the changelog.
Sorry again for the necroposting ^^
Sorry again for the necroposting ^^
Who is online
Users browsing this forum: Andredron, Bing [Bot], Google [Bot]