Stopping the enter and space buttons from activating a turbo

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.
Post Reply
Message
Author
User avatar
Zet
Regular
Posts: 26
Joined: Wed Feb 13, 2013 12:48 am
Completed: Max's Big Bust
Organization: Lached Up Games
Contact:

Stopping the enter and space buttons from activating a turbo

#1 Post by Zet » Sat Jun 29, 2013 4:59 am

Hey, I've got more last question.

With Ren'Py, if you press Ctrl it activates skip mode, which is perfect as it doesn't skip read text. However, if you hold down enter or space it triggers a super mode where it skips through everything as well. I can see where this would come in handy, but I'd like to turn it off. Is there an easy way to do so, or is it built in to Ren'Py?

No idea where to edit the code for this one.

Cheers
Zet :)

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Stopping the enter and space buttons from activating a t

#2 Post by pwisaguacate » Sat Jun 29, 2013 5:27 am

It's like spamming clicks quickly, not really a "super skip" mode. (Nice catch, most people wouldn't have thought of that unless they're skipping due to lost persistent data / different computer or don't want to read anything at all.)

As for coding to stop autorepeating... I don't know how to but I'm sure it's simple.

You could disable the keymapping, but then clicking without the mouse will be removed, so I don't recommend this way:

Code: Select all

init:
    $ config.keymap['dismiss'].remove('K_RETURN')
    $ config.keymap['dismiss'].remove('K_SPACE')

User avatar
Zet
Regular
Posts: 26
Joined: Wed Feb 13, 2013 12:48 am
Completed: Max's Big Bust
Organization: Lached Up Games
Contact:

Re: Stopping the enter and space buttons from activating a t

#3 Post by Zet » Sat Jun 29, 2013 6:36 am

Yeah, I definitely don't want to remove those buttons. If there was a way to slow down the spacebar/enter skipping to a quarter of the speed then it'd be fine, but I have no idea how to do it.

Thanks for the response pwisaduacate, hopefully someone else who knows how to fix this sees this post :3
Check out Max's Big Bust on Steam - http://store.steampowered.com/app/416360

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Stopping the enter and space buttons from activating a t

#4 Post by nyaatrap » Sat Jun 29, 2013 7:33 am

It's config.key_repeat which controlls key press repeatedly.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Stopping the enter and space buttons from activating a t

#5 Post by trooper6 » Sat Jun 29, 2013 10:37 am

pwisaguacate wrote: You could disable the keymapping, but then clicking without the mouse will be removed, so I don't recommend this way:

Code: Select all

init:
    $ config.keymap['dismiss'].remove('K_RETURN')
    $ config.keymap['dismiss'].remove('K_SPACE')
Hi! For my "learn Ren'py" game The Reckoning, I have disabled the keymap so that the only way to move forward is to click either a continue button or an interrupt button. But here you are saying that that may not be so good of a strategy because people without a mouse would have problems. Are there lots of people without mice?

If it really is a problem not to have a keyboard option...this leads to a question. How do I selectively turn on or off the keymap during the course of the game?

The way my game works is that sometimes you can click continue.
But other times, when the barber is talking slowly...the continue button is disabled...and an Interrupt button is enabled. If you want to skip forward without reading what he has to say in order to save time (the game has a time pressure) you can only click the interrupt button (which has game consequences). *After* the barber has finished speaking, the interrupt button is disabled and the continue button is enabled again.

Right now, this game mechanic works perfectly--I'm really happy with it and proud of myself for getting the callback coding to work...but again, no keyboard control options.

So...if it is really important to add keyboard control back into the game, how do I selectively turn it on and off? I also imagine I should make the "I" key the interrupt key...so how do I make sure that is only a valid thing to press while the barber is talking?

Because the main thing is, that while the barber is slow talking and the clock gets closer to the deadline...I don't want the player to be able to skip the barber's text without having to trigger the interrupt consequences.
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

User avatar
Zet
Regular
Posts: 26
Joined: Wed Feb 13, 2013 12:48 am
Completed: Max's Big Bust
Organization: Lached Up Games
Contact:

Re: Stopping the enter and space buttons from activating a t

#6 Post by Zet » Sat Jun 29, 2013 2:20 pm

trooper6 wrote:
pwisaguacate wrote: You could disable the keymapping, but then clicking without the mouse will be removed, so I don't recommend this way:

Code: Select all

init:
    $ config.keymap['dismiss'].remove('K_RETURN')
    $ config.keymap['dismiss'].remove('K_SPACE')
Hi! For my "learn Ren'py" game The Reckoning, I have disabled the keymap so that the only way to move forward is to click either a continue button or an interrupt button. But here you are saying that that may not be so good of a strategy because people without a mouse would have problems. Are there lots of people without mice?

If it really is a problem not to have a keyboard option...this leads to a question. How do I selectively turn on or off the keymap during the course of the game?

The way my game works is that sometimes you can click continue.
But other times, when the barber is talking slowly...the continue button is disabled...and an Interrupt button is enabled. If you want to skip forward without reading what he has to say in order to save time (the game has a time pressure) you can only click the interrupt button (which has game consequences). *After* the barber has finished speaking, the interrupt button is disabled and the continue button is enabled again.

Right now, this game mechanic works perfectly--I'm really happy with it and proud of myself for getting the callback coding to work...but again, no keyboard control options.

So...if it is really important to add keyboard control back into the game, how do I selectively turn it on and off? I also imagine I should make the "I" key the interrupt key...so how do I make sure that is only a valid thing to press while the barber is talking?

Because the main thing is, that while the barber is slow talking and the clock gets closer to the deadline...I don't want the player to be able to skip the barber's text without having to trigger the interrupt consequences.
That's a pretty cool feature trooper6, gratz for figuring out the code. However, it's not super helpful here. I don't want people to interrupt the NPCs as they're talking though, I just want to control the speed at which the enter button advances through the game. Is there a way to attach a cooldown to these buttons?

e.g on keypress enter, if cooldown < 0, text_advance += 1 and cooldown = 30, and on each second of the game cooldown -= 1

I know how I'd code this in another coding language, but I have no idea how to do it in Ren'Py.
Check out Max's Big Bust on Steam - http://store.steampowered.com/app/416360


pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Stopping the enter and space buttons from activating a t

#8 Post by pwisaguacate » Sat Jun 29, 2013 9:28 pm

trooper6 wrote:Hi! For my "learn Ren'py" game The Reckoning, I have disabled the keymap so that the only way to move forward is to click either a continue button or an interrupt button. But here you are saying that that may not be so good of a strategy because people without a mouse would have problems. Are there lots of people without mice?

If it really is a problem not to have a keyboard option...this leads to a question. How do I selectively turn on or off the keymap during the course of the game?
I was just kidding about the "not having a keyboard option" part... If you want to, you can keep the main keymap disabled; then somehow attach keypresses [link] to your continue and interrupt buttons (since arrow keys can be used to select buttons). I can't figure out how to cleanly do so to individual buttons instead of the screen itself:

Code: Select all

screen testscreen:
    button:
        text "Test Button"
        action Blah()
        key "K_RETURN" action Blah() # This screws up screen!
Zet wrote:I just want to control the speed at which the enter button advances through the game.
This will delay repeat for 1.0 second and then repeat every 0.5 second:

Code: Select all

init:
    $ config.key_repeat = (1.0, 0.5)
The function you described, though... I don't know.

I went away for a few hours, so he posted first.

Post Reply

Who is online

Users browsing this forum: Google [Bot]