• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to add an input answer system?

Minokun

The Rival in Space
  • 107
    Posts
    11
    Years
    • Seen Sep 18, 2019
    When an NPC asks the Protagonist a certain question, instead of answering it with choices, is there a way to show the screen that normally pops up for naming your character or Pokémon to come up and then you can input the answer that way. Is there a way to do this? An example of using this screen without naming something is like when you have to tell the reporters in Pokémon games a random word, then they'll show it on TV; the Mystery Gift is another example.
     
    You can use the same thing that the name entry uses.

    pbEnterText(helptext,0,10)

    How do I make sure certain things happen depending on what the player puts into the box?
     
    How do I make sure certain things happen depending on what the player puts into the box?

    Depends on what you want to happen

    Code:
    playerinput=pbEnterText(helptext,0,10)
    if playerinput=="Text you want"
    #do thing here
    elsif playerinput=="Other text you want"
    #do other thing here
    else
    Kernel.pbMessage(_INTL("I'm afraid I can't do that {1}",$Trainer.name))
    end
     
    Last edited:
    Depends on what you want to happen

    Code:
    playerinput=pbEnterText(helptext,0,10)
    if playerinput=="Text you want"
    #do thing here
    elsif playerinput=="Other text you want"
    #do other thing here
    else
    Kernel.pbMessage(_INTL("I'm afraid I can't do that {1}",$Trainer.name))
    end

    2 more questions.

    1 (noob). Umm.. Where would I put this? :3c
    2. Can this be repeated?
     
    2 more questions.

    1 (noob). Umm.. Where would I put this? :3c
    2. Can this be repeated?

    1. You can create a new method for it.
    2. Yes, it could easily be repeated.

    Example of 1:
    Code:
    def pbProcessPlayerInput
      playerinput=pbEnterText(helptext,0,10)
      if playerinput=="Text you want"
        #do thing here
      elsif playerinput=="Other text you want"
        #do other thing here
      else
        Kernel.pbMessage(_INTL("I'm afraid I can't do that {1}",$Trainer.name))
      end
    end
     
    How do i add the Methode of this event?
    I just get this error if i use the Script: pbEnterText(helptext,0,10)

    Message: (eval) : 1:in `pbExecuteScript'undefined local variable or method `helptext' for #<Interpreter:0xb3c2018>
    ***Full script:
    pbEnterText(helptext,1,20)

    Interpreter:243:in `pbExecuteScript'
    Interpreter:1600:in `eval'
    Interpreter:243:in `pbExecuteScript'
    Interpreter:1600:in `command_355'
    Interpreter:494:in `execute_command'
    Interpreter:193:in `update'
    Interpreter:106:in `loop'
    Interpreter:198:in `update'
    Scene_Map:103:in `update'
    Scene_Map:101:in `loop'

    Interpreter:276:in `pbExecuteScript'
    Interpreter:1600:in `command_355'
    Interpreter:494:in `execute_command'
    Interpreter:193:in `update'
    Interpreter:106:in `loop'
    Interpreter:198:in `update'
    Scene_Map:103:in `update'
    Scene_Map:101:in `loop'
    Scene_Map:114:in `update'
    Scene_Map:68:in `main'
    Exception: RuntimeError
    Message: Script error within event 34, map 4 (MAP004):
    Exception: NameError
     
    How do i add the Methode of this event?
    I just get this error if i use the Script: pbEnterText(helptext,0,10)

    Message: (eval) : 1:in `pbExecuteScript'undefined local variable or method `helptext' for #<Interpreter:0xb3c2018>
    ***Full script:
    pbEnterText(helptext,1,20)

    Interpreter:243:in `pbExecuteScript'
    Interpreter:1600:in `eval'
    Interpreter:243:in `pbExecuteScript'
    Interpreter:1600:in `command_355'
    Interpreter:494:in `execute_command'
    Interpreter:193:in `update'
    Interpreter:106:in `loop'
    Interpreter:198:in `update'
    Scene_Map:103:in `update'
    Scene_Map:101:in `loop'

    Interpreter:276:in `pbExecuteScript'
    Interpreter:1600:in `command_355'
    Interpreter:494:in `execute_command'
    Interpreter:193:in `update'
    Interpreter:106:in `loop'
    Interpreter:198:in `update'
    Scene_Map:103:in `update'
    Scene_Map:101:in `loop'
    Scene_Map:114:in `update'
    Scene_Map:68:in `main'
    Exception: RuntimeError
    Message: Script error within event 34, map 4 (MAP004):
    Exception: NameError

    Add it into the actual scripts, not an event command. This is a method, so it's not going to be able to interpret it as a command. You could make a new section for it.
     
    What? Of course you can put this code in an event command (the Script one, obviously).

    The error was caused because helptext should be some text (i.e. "be in between quote marks"). Just try pbEnterText("helptext",1,20) and see where that gets you, and go from there.
     
    Ah ok now it worked. But i dont receive any pkmn or item if i write the right "password"
    def pbProcessPlayerInput
    playerinput=pbEnterText(Passwort eingeben,0,10)
    if playerinput=="KHS"
    #do thing here
    pbAddPokemon(PBSpecies::DARKRAI,25)
    elsif playerinput=="Other text you want"
    #do other thing here
    pbAddPokemon(PBSpecies::MEOWTH,25)
    else
    Kernel.pbMessage(_INTL("I'm afraid I can't do that {1}",$Trainer.name))
    end
    end

    did i forget something ?
     
    Ah ok now it worked. But i dont receive any pkmn or item if i write the right "password"
    def pbProcessPlayerInput
    playerinput=pbEnterText(Passwort eingeben,0,10)
    if playerinput=="KHS"
    #do thing here
    pbAddPokemon(PBSpecies::DARKRAI,25)
    elsif playerinput=="Other text you want"
    #do other thing here
    pbAddPokemon(PBSpecies::MEOWTH,25)
    else
    Kernel.pbMessage(_INTL("I'm afraid I can't do that {1}",$Trainer.name))
    end
    end

    did i forget something ?

    Yeah, you didn't correct this:

    Code:
    playerinput=pbEnterText(Passwort eingeben,0,10)

    You have to add this:

    Code:
    playerinput=pbEnterText([COLOR="Red"]"[/COLOR]Passwort eingeben[COLOR="Red"]"[/COLOR],0,10)
     
    I change it but nothing happens anyways. I use the pbEnterText("Passwort eingeben",0,10)
    as Script on an "PC". I can tip in my Password but nothing happens again. Can u show me an example "script" for it?
     
    Try this:

    Code:
    pbAddPokemon(:DARKRAI,25)

    I don't think that it's the problem, but i don't know.
     
    Back
    Top