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.
-
ConerNSFW
- Regular
- Posts: 40
- Joined: Sun Oct 23, 2016 5:08 pm
-
Contact:
#1
Post
by ConerNSFW » Thu Dec 15, 2016 2:18 pm
So I've disabled the left mouse button from dismiss (forward) because I don't want the game to progress when the player clicks anywhere, I only want it to progress when they click inside the textbox. So I'm trying to map the dismiss function to the textbox as an action.
I've tried:
Code: Select all
action renpy.curry(renpy.restart_interaction)
and
Code: Select all
action renpy.curry(renpy.end_interaction)(True)
and while they both work, they don't stop at choices and just keep moving forward.
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#2
Post
by trooper6 » Thu Dec 15, 2016 3:38 pm
So...let's talk.
I have a game where a person cannot progress unless they press a specific button. There are complicated ways and less complicated ways to do this. And there are a lot of things you are doing to have to take into account beyond just left click...because there is more that just the left mouse click that is bound to dismiss (the return key, the space bar, the enter key, there joystick dismiss button). And there are menus to think about.
But anyway, do answer your question, all you have to do do is
that will advance for you. That is what I use when the player is allowed to advance. (I have two different buttons--an advance button and an interrupt button. Which one is active depends on the situation).
But use the Return("smth") and that will put you on the road where you want to be.
Except for one thing...you said you don't want the game to progress unless they click inside the textbox...the text box isn't a button and so doesn't take actions. You are going to have to have an actual button in there somewhere that has the action function. Maybe you can modify the click-to-continue screen and give it a button instead of text.
https://www.renpy.org/doc/html/screen_s ... t=continue
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
-
ConerNSFW
- Regular
- Posts: 40
- Joined: Sun Oct 23, 2016 5:08 pm
-
Contact:
#3
Post
by ConerNSFW » Thu Dec 15, 2016 4:28 pm
Thanks for the reply, I've actually read several of your posts from a few years ago trying to figure this out. Anyway using
I managed to get the same functionality as the other two commands; the game would progress just fine until it gets to a choice. Now instead of just skipping forward the game comes up with an error.
Code: Select all
[code]
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 160, in script
menu:
TypeError: list indices must be integers, not str
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 160, in script
menu:
File "C:\Programfiles\Renpy\renpy-6.99.10-sdk\renpy\ast.py", line 1453, in execute
next_node(self.items[choice][2][0])
TypeError: list indices must be integers, not str
Ren'Py 6.99.11.1749
[/code]
Also I don't know if it's relevant but for the textbox I'm using a separate screen.
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#4
Post
by trooper6 » Thu Dec 15, 2016 4:34 pm
I mentioned there could be a problem when choice menus showed up.
What are you attaching that action Return("smth") to? Whatever that is, you need to disable it while the choice menu is up and then enable it when the menu is gone.
Can you show your code?
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
-
ConerNSFW
- Regular
- Posts: 40
- Joined: Sun Oct 23, 2016 5:08 pm
-
Contact:
#5
Post
by ConerNSFW » Thu Dec 15, 2016 5:09 pm
I removed the code but it was a really basic screen. I think it was just:
Code: Select all
imagebutton:
idle "gui/textbox.png"
focus_mask True
action Return("smth")
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#6
Post
by trooper6 » Thu Dec 15, 2016 6:47 pm
What is the relationship between that button and the actual textbox that is the say screen?
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
-
ConerNSFW
- Regular
- Posts: 40
- Joined: Sun Oct 23, 2016 5:08 pm
-
Contact:
#7
Post
by ConerNSFW » Fri Dec 16, 2016 8:54 am
There is no textbox on the say screen, the actual textbox is located on the a seperate screen named "textbox".
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#8
Post
by trooper6 » Fri Dec 16, 2016 5:38 pm
This is a tester I made with all the different ways to block the user from dismissing, from hard pauses, to functions, to screens. The last choice deals with having a dismiss button and the ways in which you'll want to deal with menus.
Check out the code while you run through the program.
-
Attachments
-
- Tester 2 Block Dismiss.zip
- (721.34 KiB) Downloaded 35 times
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
Users browsing this forum: Google [Bot], Hojoo