Enter name window when pressing Start button
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
-
- Newbie
- Posts: 8
- Joined: Wed Mar 06, 2019 11:10 am
- Contact:
Enter name window when pressing Start button
Can you guys help me show a pop up when pressing the Start button?
What I want is when the player presses Start, a window asking for the player's name would pop up and once the player has entered a name, the game will begin.
I've been trying to use the Special Screen Names in the Ren'Py Documentation but I just can't make it work.
Please help T_T I'm going bald because of this
What I want is when the player presses Start, a window asking for the player's name would pop up and once the player has entered a name, the game will begin.
I've been trying to use the Special Screen Names in the Ren'Py Documentation but I just can't make it work.
Please help T_T I'm going bald because of this
-
- Veteran
- Posts: 344
- Joined: Tue Nov 21, 2017 2:23 am
- Completed: Eidolon, Minion!, Love Furever, Epilogue
- Contact:
Re: Enter name window when pressing Start button
You can always import CYTPES or another Python package. (Screens will only work within Renpy. I don't believe there's a way to have it pop up new frames, but it's doable with a Python call.)
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue
-
- Newbie
- Posts: 8
- Joined: Wed Mar 06, 2019 11:10 am
- Contact:
Re: Enter name window when pressing Start button
I'm sorry but I'm a beginner both in python and renpy.
Is what I'm asking a bit too advanced for me? Is it completely impossible to do it with just Ren'Py?
Re: Enter name window when pressing Start button
Are you sure you don't just want to use renpy.input()? I did for my games and although it doesn't open a separate window, it worked like a charm.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3784
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Enter name window when pressing Start button
The easiest way in my opinion would be to make a screen that includes renpy.input and a button for confirmation.
renpy.input sets the player name using the usual methods, and the button has an action of
Then you just need to make the screen appear when a player clicks start.
By using "call", you can ensure you will return here once a player clicks the confirmation button within the screen that has the action "Return()"
I could give a full coded example later if required. It'll be about 12 hours before I can though.
renpy.input sets the player name using the usual methods, and the button has an action of
Code: Select all
Return()
Code: Select all
label start;
call screen your_screen
I could give a full coded example later if required. It'll be about 12 hours before I can though.
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
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3784
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Enter name window when pressing Start button
Okay, here's a super simple version. There's no styling or images at all, you'll just get an input box in the middle of the screen
It was not necessary to include any buttons or Return() actions as input has "returnable" which does everything for us.
To style this, I'd suggest looking into Ren'Py screen language
Code: Select all
default player_name = ""
define e = Character('[player_name]')
# The game starts here.
label start:
call screen set_name
e "Test"
return
screen set_name():
vbox:
xalign 0.5
yalign 0.5
text _("Please input your name")
input:
value VariableInputValue('player_name', returnable=True)
To style this, I'd suggest looking into Ren'Py screen language
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
-
- Newbie
- Posts: 8
- Joined: Wed Mar 06, 2019 11:10 am
- Contact:
Re: Enter name window when pressing Start button
I already managed to use renpy.input(), thankfully...
What I wanted was to put renpy.input() on a window that will show up when the player presses Start. I've been racking my mind but I just can't make it work.
Many thanks! I'll be sure to try this ASAP.Imperf3kt wrote: ↑Tue Mar 19, 2019 2:58 am Okay, here's a super simple version. There's no styling or images at all, you'll just get an input box in the middle of the screen
It was not necessary to include any buttons or Return() actions as input has "returnable" which does everything for us.Code: Select all
default player_name = "" define e = Character('[player_name]') # The game starts here. label start: call screen set_name e "Test" return screen set_name(): vbox: xalign 0.5 yalign 0.5 text _("Please input your name") input: value VariableInputValue('player_name', returnable=True)
To style this, I'd suggest looking into Ren'Py screen language
-
- Veteran
- Posts: 344
- Joined: Tue Nov 21, 2017 2:23 am
- Completed: Eidolon, Minion!, Love Furever, Epilogue
- Contact:
Re: Enter name window when pressing Start button
This is the documentation for ctypes:
https://docs.python.org/3/library/ctypes.html
I used this to create pop up windows in my game (for which the user can take action that's then recorded in the game). It's probably not the easiest for someone not reasonably familiar with Python, though, and the code will need to be modified for Windows, Linux, and Mac.
My guess is that you're best off using Imperf3kt's method. If you're dead set on a pop up, though, I can share the code I used to create the boxes (and probably even figure out how to add an input field. Mine currently just asks "yes" and "no".)
https://docs.python.org/3/library/ctypes.html
I used this to create pop up windows in my game (for which the user can take action that's then recorded in the game). It's probably not the easiest for someone not reasonably familiar with Python, though, and the code will need to be modified for Windows, Linux, and Mac.
My guess is that you're best off using Imperf3kt's method. If you're dead set on a pop up, though, I can share the code I used to create the boxes (and probably even figure out how to add an input field. Mine currently just asks "yes" and "no".)
Enjoy Eidolon, my free to play game at: https://mutive.itch.io/eidolon, Minion! at: https://mutive.itch.io/minion or Epilogue at: https://mutive.itch.io/epilogue
Who is online
Users browsing this forum: No registered users