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: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Passwords

#1 Post by isobellesophia »

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.


Image

Image


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

Re: Passwords

#2 Post by XxrenxX »

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: 882
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-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Passwords

#3 Post by Per K Grok »

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



User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Passwords

#4 Post by isobellesophia »

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


Image

Image


Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]