• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
    10
    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.
     

    Minokun

    The Rival in Space
  • 107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    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?
     
  • 1,224
    Posts
    10
    Years
    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:

    Minokun

    The Rival in Space
  • 107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    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?
     
  • 1,748
    Posts
    14
    Years
    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
     
  • 12
    Posts
    9
    Years
    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
     
  • 1,224
    Posts
    10
    Years
    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.
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    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.
     
  • 12
    Posts
    9
    Years
    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 ?
     
  • 95
    Posts
    10
    Years
    • Seen Jun 18, 2016
    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)
     
  • 12
    Posts
    9
    Years
    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?
     
  • 95
    Posts
    10
    Years
    • Seen Jun 18, 2016
    Try this:

    Code:
    pbAddPokemon(:DARKRAI,25)

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

    FL

    Pokémon Island Creator
  • 2,454
    Posts
    13
    Years
    • Seen yesterday
    Post your exact code (including line breaks) here or, better, print screen here.

    Oh yes, the text is case and space sensitive, you must have the exact match. Before adding the pokémon, try the command 'p "1"' for testing if the text check is working.
     
    Back
    Top