Page 1 of 1

Screen, Input and Statement trouble[Solved]

Posted: Wed Jul 29, 2020 7:45 am
by PoisionLullaby
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

Re: Screen, Input and Statement trouble

Posted: Wed Jul 29, 2020 8:34 am
by hell_oh_world
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]"

Re: Screen, Input and Statement trouble[Solved]

Posted: Thu Jul 30, 2020 7:37 am
by PoisionLullaby
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!