Prevent clicking
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.
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Prevent clicking
Hi,
is it possible to prevent the player from clicking for a set amount of time in Ren'Py? It seems the pause command only pauses the script, but as soon the player clicks, the pause is skipped.
Why/how do i want to use it?
I want to show a series of pictures (think of credits in game with different screen arts popping up)
Thanks very much for any help on this!
is it possible to prevent the player from clicking for a set amount of time in Ren'Py? It seems the pause command only pauses the script, but as soon the player clicks, the pause is skipped.
Why/how do i want to use it?
I want to show a series of pictures (think of credits in game with different screen arts popping up)
Thanks very much for any help on this!
Last edited by Nobbelz on Thu Jul 06, 2017 1:08 pm, edited 1 time in total.
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Re: Prevent clicking
Looks good, but 2 questions:
Won't that statement pause the whole script? So if i have several pictures, wouldn't it stop playing them while preventing clicking?
And how exactly do i have to put this line into the script? I tried several ways now, which all got my an error crashing my game :/
Won't that statement pause the whole script? So if i have several pictures, wouldn't it stop playing them while preventing clicking?
And how exactly do i have to put this line into the script? I tried several ways now, which all got my an error crashing my game :/
Last edited by Nobbelz on Thu Jul 06, 2017 1:08 pm, edited 1 time in total.
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: Prevent clicking
It doesn't stop playing the pictures if you show them first then do the hard pause. For example:
The first argument (2 in the example), is the amount of time in seconds you want the pause to last,
and hard=True makes it so the player can't skip it. You should be careful though as like the documentation says it's hard to tell apart a hard pause from a game crash, unless you have some animation playing.
Code: Select all
label pause_test:
"Testing"
show my_image
window hide # if you don't want the textbox to be visible during the pause
$ renpy.pause(2, hard=True)
"The game continues"
and hard=True makes it so the player can't skip it. You should be careful though as like the documentation says it's hard to tell apart a hard pause from a game crash, unless you have some animation playing.
The silent voice within one's heart whispers the most profound wisdom.
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Re: Prevent clicking
Thank you for the fast reply, but i think the way i have scripted my scene, it wont work with the hard pause. What i try to make is some kind of jumpscare with the following code:
Which ingame leads to this:
Warning, reduce sound volume before opening the link...
Youtube
The problem i have is, that the whole part is skipped as soon the player clicks.
Code: Select all
scene y
with dissolve
scene x
with dissolve
scene c
with dissolve
scene v
with dissolve
play sound "scare.mp3"
scene b
with hpunch
scene v
pause 0.3
scene b
pause 0.1
scene v
pause 0.2
scene b
pause 0.1
scene v
pause 0.1
scene b
pause 0.1
scene v
with dissolve
pause 5
pause 0.1
scene gb_schwarz
Warning, reduce sound volume before opening the link...
Youtube
The problem i have is, that the whole part is skipped as soon the player clicks.
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: Prevent clicking
Ah, I see now. You may want to look into ATL in
general, specially here, and define the entire sequence as an image like the example in this last link, if the pause statement still doesn't work try the time statement https://www.renpy.org/doc/html/atl.html#time-statement
general, specially here, and define the entire sequence as an image like the example in this last link, if the pause statement still doesn't work try the time statement https://www.renpy.org/doc/html/atl.html#time-statement
The silent voice within one's heart whispers the most profound wisdom.
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Re: Prevent clicking
Ok, that will take some time till i understand this. But can i still include the soundeffect into it? How i understand the site you linked, thats for image manipulation only?
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: Prevent clicking
Yes, ATL is only for image manipulation, making the flashing images a transform would hopefully solve the prevent clicking problem, wich is was this thread's main objective (was it not?), playing the sound is a separate issue, but you could define two different sequences.
Code: Select all
show scare_intro #The first, slow sequence of images with dissolve
#Or you could alternatively show the separate scenes
play sound "scare.mp3"
show scary_lady #The fast jumpscare sequence, wich I suppose is the one you don't want to skip
Last edited by DannyGMaster on Thu Jul 06, 2017 1:59 pm, edited 2 times in total.
The silent voice within one's heart whispers the most profound wisdom.
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Re: Prevent clicking
Yes, the main objective was the hard pause. But that idea should solve the problem i quess. I will try around the next few days and post my result here thenDannyGMaster wrote:Code: Select all
show scare_intro #The first, slow sequence of images with dissolve #Or you could alternatively show the separate scenes play sound "scare.mp3" show scary_lady #The fast jumpscare sequence, wich I suppose is the one you don't want to skip
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Prevent clicking
A few notes and a bit of code to hopefully give you some options...
ATL does not support audio though it can run a python function inline (see code)
I am not certain if ATL displays scenes or if just images are ok for you.
Anyway, some sample code to get the audio working:
Note: The music will continue until file is done, the atl parts will continue with music playing if they are scheduled to run before the jump-scare stops.
Hope that snippet helps.
ATL does not support audio though it can run a python function inline (see code)
I am not certain if ATL displays scenes or if just images are ok for you.
Anyway, some sample code to get the audio working:
Code: Select all
define forest = Image("images/forest.png")
init python:
def play_audio_in_atl(trans, st, at):
# we ignore the vars and just use python to play
renpy.music.set_pause(True, channel='music')
# I had to test with something
renpy.play("Addams Family TV Theme Song.mp3")
renpy.music.set_pause(False, channel='music')
return None
label start:
"Hi"
show forest:
xalign 0.0
linear 1.0 xalign 1.0
1.0
linear 1.0 xalign 0.0
1.0
linear 1.0 xalign 1.0
1.0
parallel:
linear 1.0 xalign 0.0
function play_audio_in_atl
# The music starts here while the above 'parallel' atl runs
1.0
linear 1.0 xalign 1.0
1.0
linear 1.0 xalign 0.0
1.0
linear 1.0 xalign 1.0
# Finished the atl... continue story
"Next"
Hope that snippet helps.
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
- Nobbelz
- Newbie
- Posts: 12
- Joined: Mon Jul 03, 2017 6:26 pm
- Projects: Project: Heartbeat.
- Location: Portugal
- Contact:
Re: Prevent clicking
Just got an idea on my code. Would it be possible to bring something like that in? It doesn't work that way, but is there a possibility to make it run?
while $ renpy.pause(10, hard=True):#then my code
[/quote]
while $ renpy.pause(10, hard=True):#then my code
Code: Select all
scene y
with dissolve
scene x
with dissolve
scene c
with dissolve
scene v
with dissolve
play sound "scare.mp3"
scene b
with hpunch
scene v
pause 0.3
scene b
pause 0.1
scene v
pause 0.2
scene b
pause 0.1
scene v
pause 0.1
scene b
pause 0.1
scene v
with dissolve
pause 5
pause 0.1
scene gb_schwarz
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Prevent clicking
Theoretically, I suppose it should work if you use conditional statements, but unless you reuse this a lot, it will be more coding and more complex than just doing the previously mentioned suggestions.
Also, you could add a delay to the audio so it starts when the block of code does, but it won't start playing for x seconds.
Might be useful if other methods don't work as desired.
Also, you could add a delay to the audio so it starts when the block of code does, but it won't start playing for x seconds.
Might be useful if other methods don't work as desired.
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
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Prevent clicking
As Imperf3kt says, a delayed audio prior to some ATL might be one of the simplest ways, something like:
So saying, when I ran that mine wasn't too great with the transition durations and pauses.
You might be able to tweak it to your needs though.
Code: Select all
# 2 seconds of silence followed by scare
play sound ["<silence 2.0>", "scare.mp3"]
show y with Dissolve(0.5):
x with Dissolve(0.5)
c with Dissolve(0.5)
v with Dissolve(0.5)
b with hpunch
pos (0,0)
pause 0.25
v
0.3
b
0.1
v
0.2
b
0.1
v
0.1
b
0.1
v with dissolve
5
0.1
gb_schwarz
You might be able to tweak it to your needs though.
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Prevent clicking
Code: Select all
screen death():
button:
xysize(1280, 720) # the width and height of the screen
background "#0000"
action NullAction()
label start:
show screen death
scene y
with dissolve
scene x
with dissolve
scene c
with dissolve
scene v
with dissolve
play sound "scare.mp3"
scene b
with hpunch
scene v
pause 0.3
scene b
pause 0.1
scene v
pause 0.2
scene b
pause 0.1
scene v
pause 0.1
scene b
pause 0.1
scene v
with dissolve
pause 5
pause 0.1
scene gb_schwarz
hide screen death
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]