Show Image User Cannot Interrupt
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.
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Show Image User Cannot Interrupt
Sorry if I'm asking too many questions lol, just a beginner here.
Wanted to ask: how can you handle a situation like this. Suppose I want to show an image (it's a pop-up that indicates a user's score is up). But I don't want this image to interrupt the user's actual progression of the game. I don't want the user's mouse clicking to affect the appearance of this image.
I want this immage to appear, be on-screen for a certain length of time, and then hide. But none of this process affects the progression of the game. The game still flows just as normal and the user's clicking on the mouse does not affect how long the image stays on screen.
Basically, I want to, in a way that is non-intrusive with regards to game progression, display an image for a certain amount of time and hide it.
Any ideas?
Wanted to ask: how can you handle a situation like this. Suppose I want to show an image (it's a pop-up that indicates a user's score is up). But I don't want this image to interrupt the user's actual progression of the game. I don't want the user's mouse clicking to affect the appearance of this image.
I want this immage to appear, be on-screen for a certain length of time, and then hide. But none of this process affects the progression of the game. The game still flows just as normal and the user's clicking on the mouse does not affect how long the image stays on screen.
Basically, I want to, in a way that is non-intrusive with regards to game progression, display an image for a certain amount of time and hide it.
Any ideas?
- warmsundae
- Regular
- Posts: 61
- Joined: Tue Feb 24, 2015 9:51 pm
- Skype: electriclan
- Soundcloud: lanterny
- Location: korea
- Contact:
Re: Show Image User Cannot Interrupt
What if you just handled it like a character sprite, but in a different location?
edit: adding to what Imperf3kt said: the above doesn't work in cases where you want a time limit on the image independent of the player's clicks.
edit: adding to what Imperf3kt said: the above doesn't work in cases where you want a time limit on the image independent of the player's clicks.
Last edited by warmsundae on Tue Jan 10, 2017 10:20 am, edited 1 time in total.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Show Image User Cannot Interrupt
warmsundae's suggestion should work in most situations unless you have a transition, or want a user to be able to call the score at will.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- Ocelot
- Lemma-Class Veteran
- Posts: 2405
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Show Image User Cannot Interrupt
Check how notify screen works (in screens.rpy).
In short, there is a timer on screen, which hides it after several seconds after it was shown.
https://www.renpy.org/doc/html/screens.html#timer
In short, there is a timer on screen, which hides it after several seconds after it was shown.
https://www.renpy.org/doc/html/screens.html#timer
< < insert Rick Cook quote here > >
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: Show Image User Cannot Interrupt
On mobile now and will be away for next while so I can't test this. Asking this for now so if anyone gets an idea I can see their reply when I get back
So what would go where here?
Code: Select all
screen timer_test():
vbox:
textbutton "Yes." action Jump("yes")
textbutton "No." action Jump("no")
timer 3.0 action Jump("too_slow")
Re: Show Image User Cannot Interrupt
- Ok so what I understand it you want a popup image to appear for a specific amount of time then disappear without it hindering the player actions in any way. So here's how I would do it.SuperbowserX wrote:On mobile now and will be away for next while so I can't test this. Asking this for now so if anyone gets an idea I can see their reply when I get back
So what would go where here?Code: Select all
screen timer_test(): vbox: textbutton "Yes." action Jump("yes") textbutton "No." action Jump("no") timer 3.0 action Jump("too_slow")
First method
* You could put this anywhere, but I'd put this above in your script.rpy
Code: Select all
init:
$ time = 0
screen popup:
modal False
add 'nameofimage.png' xalign 0.5 yalign 0.5
timer 1.0 action If(time <= 0, Hide('popup'))
modal not really necessary but this is just to answer your question of not hindering player action
add - this part is responsible for adding the image. Change the name of image to the image you want to popup. xalign and yalign is the position of your image. From left to right is 0.0 => 1.0 and from top to bottom its 0.0 => 1.0; so example like the center position would be xalign .05 and yalign .05 and the top left of the screen would be xalign 0.0 yalign 0.0 Here's an image to help you out
timer - the 1.0 would be the time of the popup and its in seconds so if you want it 5 seconds then you'll change it to timer 5.0
* Now, to make the screen appear you need to go to the part of your code where the popup image is used. Then type show screen popup
Code: Select all
label start:
"This is the part of my code where player does something and popup shows"
$ affection =+ 1
show screen popup
Second method
- You can create a screen that calls the popup and sets the variable. That way when example a player increase their affection ,then it will show popup as well as change the variable affection's number.
* You could put this anywhere, but I'd put this above in your script.rpy
Code: Select all
init:
$ time = 0
$ affection = 0
screen popup:
python:
global affection
affection =+ 1
modal False
add 'try.png' xalign 0.5 yalign 0.5
timer 1.0 action If(time <= 0, Hide('popup'))
* * Now, to make the screen appear you need to go to the part of your code where YOU increase the variable.
Code: Select all
label start:
"I love you"
show screen popup
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: Show Image User Cannot Interrupt
Thanks. The first method is what I'm looking for as the variable increase is context-sensitive.
Anyway, let me ask: is there anyway I can portray the image with a dissolve or fade effect using the first method?
I tried adding "with fade" to the end of the first line of label correct but that doesn't compile.
Any idea how I can add a fade effect?
Anyway, let me ask: is there anyway I can portray the image with a dissolve or fade effect using the first method?
Code: Select all
init:
$ time = 0
screen popup:
modal False
add 'sleuth.png' xalign 0.25 yalign 0.5
timer 1.0 action If(time <= 0, Hide('popup'))
label correct:
show screen popup
play sound "SFX/right.wav"
return
Any idea how I can add a fade effect?
Re: Show Image User Cannot Interrupt
** For that you would use atl and transform, her is a basic fade for ya Just copy and paste the transform pop_fade above screen popup and in the screen popup, add a at pop_fade at the end of the add statment or just replace the entire thing with the code below.SuperbowserX wrote:Thanks. The first method is what I'm looking for as the variable increase is context-sensitive.
Anyway, let me ask: is there anyway I can portray the image with a dissolve or fade effect using the first method?
I tried adding "with fade" to the end of the first line of label correct but that doesn't compile.Code: Select all
init: $ time = 0 screen popup: modal False add 'sleuth.png' xalign 0.25 yalign 0.5 timer 1.0 action If(time <= 0, Hide('popup')) label correct: show screen popup play sound "SFX/right.wav" return
Any idea how I can add a fade effect?
Code: Select all
init:
$ time = 0
transform pop_fade:
on hide:
linear 1.0 alpha 0
screen popup:
modal False
add 'nameofimage.png' xalign 0.5 yalign 0.5 at pop_fade
timer 1.0 action If(time <= 0, Hide('popup'))
alpha it's like the degree of fade but just keep it at 0
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: Show Image User Cannot Interrupt
Thank you! This is exactly what I was looking for!
- 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: Show Image User Cannot Interrupt
The timer can be simpler. The variable "time" is not needed, neither the If() action:
Code: Select all
screen popup():
modal False
add 'nameofimage.png' xalign 0.5 yalign 0.5 at pop_fade
timer 1.0 action Hide('popup')
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)
Who is online
Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot], snotwurm