Passwords

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
isobellesophia
Miko-Class Veteran
Posts: 711
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Passwords

#1 Post by isobellesophia » Tue Nov 05, 2019 9:21 am

Hello evryone,

I would like to make a certain passwords in my novel, but i dont know how, and this is what i want..


A screen will appear and it will tell you to type the password, and there are like 5 of them to type.

I want each passwords to get a label, and if wrong, it will let the player to try again.
(I want the IF and ELSE statement when each password you'e been typed and jump from that label.

Thanks for who can help.
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
XxrenxX
Veteran
Posts: 265
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Passwords

#2 Post by XxrenxX » Tue Nov 05, 2019 1:41 pm

You could use input and just add different arguments

so an example for the screen could be like this: (I'm not a coder so if it doesn't work I'm sorry)

Code: Select all

python:
    password = renpy.input("Please input password")

    if password = "Aa54N2JL" #random example
         Jump chapter_3
And so on so forth. Idk how to set up a screen or in script but think this general idea you want?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 561
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: Passwords

#3 Post by Per K Grok » Tue Nov 05, 2019 2:06 pm

isobellesophia wrote:
Tue Nov 05, 2019 9:21 am
Hello evryone,

I would like to make a certain passwords in my novel, but i dont know how, and this is what i want..


A screen will appear and it will tell you to type the password, and there are like 5 of them to type.

I want each passwords to get a label, and if wrong, it will let the player to try again.
(I want the IF and ELSE statement when each password you'e been typed and jump from that label.

Thanks for who can help.
It is pretty much the same as setting up an input for the player to enter a playername and check that they are not taking a name that already is used in the game, and I think you have done that before. Or maybe I'm getting you mixed up with someone else.

Anyway this code would do the job.

Code: Select all

init python:
    def PaW_func(newstring):
        store.passW = newstring

default passW=""
default password="uncle"

screen loginpass():
    frame:

        vbox:
            xsize 200
            ysize 100
            text "Password:"
            frame:
                xsize 100
                input changed PaW_func length 5
            textbutton "Login" default passW action Jump("loginPassLabel")


label start:
    show screen loginpass

    $ renpy.pause(hard=True)

label loginPassLabel:
    hide screen loginpass
    if passW==password:
        "That is the correct password"
        jump somewhereelse
    else:
        "Incorrect password. Try again."
        jump start


Image Visual Story Telling, DeviantArt Group for animations, comics, games and illustrations https://www.deviantart.com/acgi

User avatar
isobellesophia
Miko-Class Veteran
Posts: 711
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Passwords

#4 Post by isobellesophia » Tue Nov 05, 2019 10:18 pm

Thanks both of you guys, all of them are working. :)
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]