How can I disable clicking past?
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:
How can I disable clicking past?
Am making a puzzle game and just had a question. What's a good way to disable the user from clicking to advance text? My plan is to make the only clickable objects premade (so a "Exit puzzle" button, a "Hints button", and of course the puzzle interaction buttons). How can I put the game in a state where simply clicking on a screen will not try to advance dialogue?
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: How can I disable clicking past?
There are many, many ways to do this. Discussed in many different threads.
Here is a tester project I made a while ago that ran through all the different ways of blocking input I researched...it also has a bit of testing of rollback blocking and some random things on the main screen.
There are hard pauses
screens
config variables
There is only one thing that doesn't work right aesthetically and that is slow text using NVL. Maybe someone will figure out how to get that to work.
But here is the project. You can just go through it and see what's there. It has some notes so you at least know what is what a little bit. Note: There are lots and lots of examples of the same thing over and over, just blocking in different ways.
Here is a tester project I made a while ago that ran through all the different ways of blocking input I researched...it also has a bit of testing of rollback blocking and some random things on the main screen.
There are hard pauses
screens
config variables
There is only one thing that doesn't work right aesthetically and that is slow text using NVL. Maybe someone will figure out how to get that to work.
But here is the project. You can just go through it and see what's there. It has some notes so you at least know what is what a little bit. Note: There are lots and lots of examples of the same thing over and over, just blocking in different ways.
- Attachments
-
- Test 18 Blocking User Input.zip
- (7.35 MiB) Downloaded 236 times
Last edited by trooper6 on Thu Apr 27, 2017 11:31 pm, edited 1 time in total.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: How can I disable clicking past?
Thanks, I'll look it over.
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: How can I disable clicking past?
It appears that you were using:
So could my general idea be:
And then, in any of the now-showing screens, whenever a clickable action is selected, do the following:
I am looking to make it so that the player has to click an area before proceeding. I am trying to code this rn with character selection where they have to pick either the male or female icon. Is this the best way? Thanks for helping,
Also, asking because I can't find it in the documentation; what exactly is "dismiss" and "key" in the context of the first line of code I sampled in this reply? And what does Return() do in the second one?
Code: Select all
key "dismiss" action NullAction()
textbutton "Cont..." action Return()
Code: Select all
screen pausenow():
key "dismiss" action NullAction()
Code: Select all
action Hide(pause), Jump(targetlabel)
Also, asking because I can't find it in the documentation; what exactly is "dismiss" and "key" in the context of the first line of code I sampled in this reply? And what does Return() do in the second one?
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: How can I disable clicking past?
I've been trying this for a while and getting a lot of trouble. Perhaps someone else can answer my question:
What is the best way for me to make the only thing the user can click a screen, and not proceed until that screen has been clicked (at which point procession is automatic)?
Right now, I am trying to make it so that the player must either click on a male icon or a female icon to continue. What is the best way to do this?
What is the best way for me to make the only thing the user can click a screen, and not proceed until that screen has been clicked (at which point procession is automatic)?
Right now, I am trying to make it so that the player must either click on a male icon or a female icon to continue. What is the best way to do this?
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: How can I disable clicking past?
If all you want is to make it so that the player has to click a button on a screen in order to progress, all you need to do is call the screen rather than show it.
Code: Select all
default gender = "female"
screen gender_screen():
vbox:
text "Choose Your Gender"
textbutton "Male" action [SetVariable("gender", "male"), Return()]
textbutton "Female" action [SetVariable("gender", "female"), Return()]
textbutton "Non Binary" action [SetVariable("gender", "nonbinary"), Return()]
# The game starts here.
label start:
"So the game starts."
call screen gender_screen()
"You are back and your gender is: [gender]"
"Game over"
return
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: How can I disable clicking past?
Can you help me here?
Code:
Traceback:
Code:
Code: Select all
image bg = "bg.png"
define gender = ""
image mcmale = "sprites/mcmale.png"
image mcfemale = "sprites/mcfemale.png"
screen characterselect():
imagebutton xalign 0.2 yalign 0.5 idle mcmale action [SetVariable(gender, "m"), Return()]
imagebutton xalign 0.8 yalign 0.5 idle mcfemale action [SetVariable(gender, "f"), Return()]
label start:
scene bg with fade
play music "dream.mp3" fadein 1.0 fadeout 1.0
"Hello!"
"Would you like to be a boy or a girl?"
call screen characterselect()
return
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 23, in script
call screen characterselect()
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "game/script.rpy", line 14, in execute
screen characterselect():
File "game/script.rpy", line 14, in execute
screen characterselect():
File "game/script.rpy", line 15, in execute
imagebutton xalign 0.2 yalign 0.5 idle mcmale action [SetVariable(gender, "m"), Return()]
Exception: Not a displayable: <Character: u''>
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 23, in script
call screen characterselect()
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ast.py", line 1706, in execute
self.call("execute")
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ast.py", line 1724, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\statements.py", line 145, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\exports.py", line 2526, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ui.py", line 285, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2538, in interact
scene_lists.replace_transient()
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 822, in replace_transient
self.remove(layer, tag)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 1107, in remove
self.hide_or_replace(layer, remove_index, "hide")
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 1031, in hide_or_replace
d = oldsle.displayable._hide(now - st, now - at, prefix)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 443, in _hide
self.update()
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 578, in update
self.screen.function(**self.scope)
File "game/script.rpy", line 14, in execute
screen characterselect():
File "game/script.rpy", line 14, in execute
screen characterselect():
File "game/script.rpy", line 15, in execute
imagebutton xalign 0.2 yalign 0.5 idle mcmale action [SetVariable(gender, "m"), Return()]
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ui.py", line 928, in _imagebutton
**properties)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 946, in __init__
idle_=renpy.easy.displayable(idle_image),
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\easy.py", line 108, in displayable
raise Exception("Not a displayable: %r" % (d,))
Exception: Not a displayable: <Character: u''>
Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Logic Heroes 1.0
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: How can I disable clicking past?
If these are standard imagebuttons you're using, mcmale and mcfemale need to be a string within the imagebuttons themself. You also require a hover state.
Code: Select all
screen characterselect():
imagebutton xalign 0.2 yalign 0.5 idle "sprites/mcmale.png" hover "sprites/female.png" action [SetVariable(gender, "m"), Return()]
imagebutton xalign 0.8 yalign 0.5 idle "sprites/mcfemale.png" hover "sprites/mcfemale.png" action [SetVariable(gender, "f"), Return()]
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
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: How can I disable clicking past?
I sincerely appreciate the help, but...
Literally changing nothing (from previous snippet) other than replacing my old screen with the example you provided gave me this error (I was also getting this error when I was fiddling with imagebutton before I made my previous reply):
Literally changing nothing (from previous snippet) other than replacing my old screen with the example you provided gave me this error (I was also getting this error when I was fiddling with imagebutton before I made my previous reply):
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 23, in script
call screen characterselect()
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "renpy/common/00action_data.rpy", line 50, in get_selected
return getattr(self.object, self.field) == self.value
AttributeError: 'StoreModule' object has no attribute ''
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 23, in script
call screen characterselect()
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ast.py", line 1706, in execute
self.call("execute")
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ast.py", line 1724, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\statements.py", line 145, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 471, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\exports.py", line 2526, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\ui.py", line 285, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2526, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2793, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 403, in visit_all
self.child.visit_all(callback)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 495, in visit_all
d.visit_all(callback)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 497, in visit_all
callback(self)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2793, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 788, in per_interact
if self.is_selected():
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 778, in is_selected
return is_selected(self.action)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 356, in is_selected
return any(is_selected(i) for i in action)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 356, in <genexpr>
return any(is_selected(i) for i in action)
File "C:\Users\A\Desktop\Games\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 359, in is_selected
return action.get_selected()
File "renpy/common/00action_data.rpy", line 50, in get_selected
return getattr(self.object, self.field) == self.value
AttributeError: 'StoreModule' object has no attribute ''
Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Logic Heroes 1.0
Who is online
Users browsing this forum: Google [Bot]