[REOPEN] Prevent (text)button from being activated by enter
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.
Re: Preventing (text)button from being activated with enter
I've never had reason to do it so I don't know off the top of my head. But I would assume that whatever you're using for the randomizer button is keying in on that text anyway?
- mobychan
- Veteran
- Posts: 275
- Joined: Fri Apr 24, 2015 6:31 am
- Projects: The Chosen - Sakura Pink & Gentian Blue
- Organization: Foresoft
- Location: Germany
- Contact:
Re: Preventing (text)button from being activated with enter
I just save the random name in a variable and reload the screen, using the content of the variable as default ^^''
Re: Preventing (text)button from being activated with enter
Well, in that case isn't there no reason not to use use Return() without the If() part?
- mobychan
- Veteran
- Posts: 275
- Joined: Fri Apr 24, 2015 6:31 am
- Projects: The Chosen - Sakura Pink & Gentian Blue
- Organization: Foresoft
- Location: Germany
- Contact:
Re: Preventing (text)button from being activated with enter
You're right, it works^^philat wrote:Well, in that case isn't there no reason not to use use Return() without the If() part?
BUT I had to switch the order around, since it only works if the Key is defined AFTER the Random button^^
Thank you to all of you ^^
- mobychan
- Veteran
- Posts: 275
- Joined: Fri Apr 24, 2015 6:31 am
- Projects: The Chosen - Sakura Pink & Gentian Blue
- Organization: Foresoft
- Location: Germany
- Contact:
Re: [SOLVED] Prevent (text)button from being activated by en
After retesting I realised the "Return()" action won't return any inputted names, so I'm back to square one...
Basically I need a possibility to return the input's value in a custom keymapping
Basically I need a possibility to return the input's value in a custom keymapping
Re: [REOPEN] Prevent (text)button from being activated by en
I believe I ran a quick test on this last time, and the variable was stored in _return just fine from what I recall.
- mobychan
- Veteran
- Posts: 275
- Joined: Fri Apr 24, 2015 6:31 am
- Projects: The Chosen - Sakura Pink & Gentian Blue
- Organization: Foresoft
- Location: Germany
- Contact:
Re: [REOPEN] Prevent (text)button from being activated by en
if it reacts on the key
I only get True in _return, even though I inserted something ^^''
my full screen:
and I call it like this:
Code: Select all
key "K_RETURN" action Return()
my full screen:
Code: Select all
textbutton _("Random"):
xpos 1018
ypos 607
background None
text_style "ribbon_name_choosing_text_big"
action [SetVariable("first_name", ""),
Return()]
keyboard_focus False
vbox:
at ribbon_name_choosing_movein
xpos 400
ypos 510
text "Please select a first name for the main character then press\nenter.":
style "ribbon_name_choosing_text_big"
input id "input_name":
default first_name
length 12
style "ribbon_name_choosing_text_big"
key "K_RETURN" action Return()
Code: Select all
call screen ribbon_name_choosing("first_name_choosing")
$ renpy.log("first: %s" % _return)
if isinstance(_return, basestring):
$ first_name = _return
- jesusalva
- Regular
- Posts: 88
- Joined: Mon Jul 22, 2013 5:05 pm
- Organization: Software in Public Interest, Inc.
- IRC Nick: jesusalva
- Github: pazkero
- itch: tmw2
- Location: Brazil
- Discord: Jesusalva#4449
- Contact:
Re: [REOPEN] Prevent (text)button from being activated by enter
EDIT: You may want to look at viewtopic.php?f=51&t=38080#p412055 to don't need to use _return at all.
I used a couple of magic codes '-'
Would appreciate if someone used anti-magic on them >.>
Remember to replace the textbutton with the key command (you only care about the action part)
And then, when handling the code, I use this magic code I've found out by coincidence while trying to use ui.input some time ago:
Purely magic, a hack, likely to break depending on version, but got the work done.
I have no idea why wrote this code, and I do not advice anyone using it.
But then, I was not working with commission, I was just writing code for fun, as a hobby... Just thought I would share it.
I used a couple of magic codes '-'
Would appreciate if someone used anti-magic on them >.>
Code: Select all
## Returns the input widget with ID 'input_name' on screen 'screen_name'.
textbutton "Submit" action Return(renpy.get_widget("screen_name","input_name"))
And then, when handling the code, I use this magic code I've found out by coincidence while trying to use ui.input some time ago:
Code: Select all
## Gets second arg from Text() object
$ _return=str(_return.text[1]) # This is magic, don't ask.
I have no idea why wrote this code, and I do not advice anyone using it.
But then, I was not working with commission, I was just writing code for fun, as a hobby... Just thought I would share it.
Jesusaves/Jesusalva
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Ocelot