Screen, Input and Statement trouble[Solved]

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
PoisionLullaby
Regular
Posts: 44
Joined: Wed Jan 10, 2018 9:11 pm
Projects: Derp Crew VN, It was all a dream
Deviantart: PoisionLullaby
Contact:

Screen, Input and Statement trouble[Solved]

#1 Post by PoisionLullaby » Wed Jul 29, 2020 7:45 am

So I am currently trying to make a new screen to pop up when the player gets the prompt to type in there own name. I am still new to coding so this may be an easy fix but I just cant get it to stop giving me errors. I fix the "unexpected statement" issue but then it says "expected statement". Then there's the "end of line expected error". What am I doing wrong? Any help is appreciated!

Code: Select all

screen enterName:
      vbox:
           xalign 0.5
           yalign 0.5
           text "What is your name?":
                size 20

input default:"Type Name Here"
       pixel_width(500)
       value VariableInputValue("player_name")

textbutton "OK":
       action Jump("continue")
       keysym('K_RETURN', 'K_KP_ENTER')

        "Now, what is my name?"
        $ quick_menu = False
        $ _skipping = False
        $ player_name = ""
        show screen enterName
        $ _preferences.afm_enable = False
        $ renpy.pause(hard=True)

label continue:
     $ player_name = player_name.strip()

     if player_name == "":
         $ player_name="Josh"

     hide screen enterName

     $ quick_menu = True
     $ _skipping = True
Last edited by PoisionLullaby on Thu Jul 30, 2020 7:36 am, edited 1 time in total.
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 617
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Screen, Input and Statement trouble

#2 Post by hell_oh_world » Wed Jul 29, 2020 8:34 am

There are a lot of errors in here. If you're not very familiar with the screen language, i suggest watching some tutorials first about `renpy screens` on youtube or referring to the documentation: https://www.renpy.org/dev-doc/html/screens.html

this is fairly easy to do, and very common, you can either call or show the custom screen or use the built-in function `renpy.input`, the easiest way would be using the built-in function but if you want more control with the screen then calling it would be what you're looking for.

Code: Select all

default p_name = ""
define p = Character("p_name", dynamic=True)

screen name_input():
  vbox:
    align (0.5, 0.5)
  
    input:
      default "ENTER YOUR NAME"
      value VariableInputValue("p_name")
    
    textbutton "PROCEED" action Return()

label start:
  call screen name_input
  $ p_name = p_name.strip() or "John"

  p "My name is [p]"

User avatar
PoisionLullaby
Regular
Posts: 44
Joined: Wed Jan 10, 2018 9:11 pm
Projects: Derp Crew VN, It was all a dream
Deviantart: PoisionLullaby
Contact:

Re: Screen, Input and Statement trouble[Solved]

#3 Post by PoisionLullaby » Thu Jul 30, 2020 7:37 am

Yeah I am not familiar ^^' I have been but clearly I didn't quite understand it. Back to watching and researching it is. Thank you for the help!
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

Post Reply

Who is online

Users browsing this forum: Bing [Bot]