How to implement an unlock code input field
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.
- thirstyoctopus
- Regular
- Posts: 72
- Joined: Mon Aug 27, 2018 12:04 pm
- Projects: Romance Visual Novel story
- Organization: Thirsty Octopus
- Contact:
How to implement an unlock code input field
Hey guys
I'm currently in the middle of producing a game that was funded on Kickstarter, and I want to be able to add a menu option called Bonus Codes or Unlock Codes or something similiar which would open a new screen or page that simply has an input field and a button - when a user enters a specific code I want it to unlock an option in preferences (I'll do the conditional using a global variable) but how do I actually implement this kind of functionality? Is it possible?
The reason I need to do this is due to the tier rewards in Kickstarter, I need to issue bonus codes to unlock a certain modes for different backers.
Any help is much apprecated - or any suggestions on how it could be acheieved a different way? Like maybe sending my backers a specific DLC file that installs it instead??
I'm currently in the middle of producing a game that was funded on Kickstarter, and I want to be able to add a menu option called Bonus Codes or Unlock Codes or something similiar which would open a new screen or page that simply has an input field and a button - when a user enters a specific code I want it to unlock an option in preferences (I'll do the conditional using a global variable) but how do I actually implement this kind of functionality? Is it possible?
The reason I need to do this is due to the tier rewards in Kickstarter, I need to issue bonus codes to unlock a certain modes for different backers.
Any help is much apprecated - or any suggestions on how it could be acheieved a different way? Like maybe sending my backers a specific DLC file that installs it instead??
- Kia
- Eileen-Class Veteran
- Posts: 1039
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: How to implement an unlock code input field
there are many different approaches to do this, but to put it simple you have conditions to check and actions to perform if they are true.
the easiest route is storing the user's input and comparing it to a list of strings in an "if, elif, else" sequence.
the easiest route is storing the user's input and comparing it to a list of strings in an "if, elif, else" sequence.
- thirstyoctopus
- Regular
- Posts: 72
- Joined: Mon Aug 27, 2018 12:04 pm
- Projects: Romance Visual Novel story
- Organization: Thirsty Octopus
- Contact:
Re: How to implement an unlock code input field
Yes, I understand that part, it's just I can't find documentation on how to actually place a submittable form field in a menu screen. I know you can have a name input in the dialogue text box within the game - is it pretty much the same deal?
- thirstyoctopus
- Regular
- Posts: 72
- Joined: Mon Aug 27, 2018 12:04 pm
- Projects: Romance Visual Novel story
- Organization: Thirsty Octopus
- Contact:
Re: How to implement an unlock code input field
Thank you!Kia wrote: ↑Fri Mar 22, 2019 6:59 am ah you need screens then: https://www.renpy.org/doc/html/screens.html#input
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: How to implement an unlock code input field
Input can also be used within dialogue.
I haven't got an example on hand, but I'll post one later.
I haven't got an example on hand, but I'll post one later.
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
- thirstyoctopus
- Regular
- Posts: 72
- Joined: Mon Aug 27, 2018 12:04 pm
- Projects: Romance Visual Novel story
- Organization: Thirsty Octopus
- Contact:
Re: How to implement an unlock code input field
I'm afraid I'm still stumped. I've added some code to display an input box but I see no feasible way of recording what the user has entered. This is what I have (based on the documentation):Kia wrote: ↑Fri Mar 22, 2019 6:59 am ah you need screens then: https://www.renpy.org/doc/html/screens.html#input
Code: Select all
screen bonus_content():
tag menu
use game_menu(_("Bonus Content"), scroll="viewport"):
style_prefix "bonus_content"
vbox:
label _("Bonus Content\n")
text _("Have an unlock code? Type it below and hit Submit.")
input default ""
textbutton "Submit" action Return(True)
Further help on this would be much appreciated.
- Kia
- Eileen-Class Veteran
- Posts: 1039
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: How to implement an unlock code input field
sorry for the delay, had some guest to entertain.
here's the general idea and as simple as I can make it. if you have a big list of conditions, you might want to put them in a list and check them in a loop.
here's the general idea and as simple as I can make it. if you have a big list of conditions, you might want to put them in a list and check them in a loop.
Code: Select all
screen input_scr:
default inp = ""
vbox:
frame:
xsize 300
input:
value ScreenVariableInputValue("inp")
button:
text "Enter"
action If(inp == "good", Jump("somewhere"))
if inp == "ano":
text "another"
elif inp == "more":
text "even more"
Re: How to implement an unlock code input field
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive.
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive.
- thirstyoctopus
- Regular
- Posts: 72
- Joined: Mon Aug 27, 2018 12:04 pm
- Projects: Romance Visual Novel story
- Organization: Thirsty Octopus
- Contact:
Re: How to implement an unlock code input field
Thanks for your help - I'll give this a try when I next get to working on my project.Kia wrote: ↑Sat Mar 23, 2019 1:34 pm sorry for the delay, had some guest to entertain.
here's the general idea and as simple as I can make it. if you have a big list of conditions, you might want to put them in a list and check them in a loop.Code: Select all
screen input_scr: default inp = "" vbox: frame: xsize 300 input: value ScreenVariableInputValue("inp") button: text "Enter" action If(inp == "good", Jump("somewhere")) if inp == "ano": text "another" elif inp == "more": text "even more"
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]