Question with text input

Niqck

Rookie
Member
Joined
Sep 7, 2018
Posts
4
I am trying to make some kind of a quiz that you have to answer correctly before you are allowed to enter the gym.
But instead of having it that you have a few options I wanted to make it like that you have a screen where you enter your own answer and that the game checks if your answer is correct.
What I tried is making a new actor and giving the player the possibility to give that actor a custom name and if that name is the same as the answer wanted you can enter.
(https://gyazo.com/29fbb34d746c37874c1fc3c6f3d7be9f)
But when I give this actor a name it changes the players name and whatever I name it it always gives me: test failed.
Does anyone know how to fix this? Or is this impossible with Pokemon Essentials?
 

Dragonite

Have they found the One Piece yet?
Member
Joined
Mar 24, 2017
Posts
254
Ah, this would be so much easier if the wiki was still up.

There may be a more elegant solution, but I do something like this in an "execute script" event thing:
Ruby:
Kernel.pbMessage("tell me something!")
variable=pbEnterText("", 0, 10, "") # pbEnterText(helptext,minlength,maxlength,initialText="",mode=0,pokemon=nil,nofadeout=false)
Kernel.pbMessage("echo: "+variable)
Obviously, you can do whatever you want with the return value.


 

Niqck

Rookie
Member
Joined
Sep 7, 2018
Posts
4
Ah, this would be so much easier if the wiki was still up.

There may be a more elegant solution, but I do something like this in an "execute script" event thing:
Ruby:
Kernel.pbMessage("tell me something!")
variable=pbEnterText("", 0, 10, "") # pbEnterText(helptext,minlength,maxlength,initialText="",mode=0,pokemon=nil,nofadeout=false)
Kernel.pbMessage("echo: "+variable)
Obviously, you can do whatever you want with the return value.

Thanks for your reply, but when I try using the script it gives me this error.... xD
 
Last edited:

chikorita

Novice
Member
Joined
Apr 2, 2017
Posts
43
Thanks for your reply, but when I try using the script it gives me this error.... xD
It's working fine. You just didn't remove the commented part of the script. Every comment in Ruby (programing language of RMXP) starts with # symbol which also changes the color of the text after that. In the case of this forum it's brown, but inside the script editor (not event command) it changes to green text. Everything written after # will be commented and not have any effect in the script, but it only works for the line the # is written.


Also Dragonite just show you how to display a text written by the player. For use in a password, you need this:
Code:
Kernel.pbMessage("tell me something!")
password=pbEnterText("", 0, 10, "")
if password=="AAA"
return $game_switches[XX]=true
else
return $game_switches[XX]=false
end

beeing XX a switch you are NOT using.

After that you can use it normally in a conditional branch from the event commands. The == checks what is the input from the player and the =true turns the switch ON while =false turn the switch OFF.
In addition to that I highly suggest, when you are using the script command, that you use the "extendtext" from the project root folder. It makes the text box bigger and you will avoid having troubles with some scripts. Don't worry if nothing show up, it works just like that. You can check the task manager and see that it's working just fine in the process tab (I don't really know how it's in english, sorry).
 

Niqck

Rookie
Member
Joined
Sep 7, 2018
Posts
4
The comment was there for your benefit. Don't use it in the actual script box, it'll break things when it line breaks (unless you use extendtext).
Oke, I am not very familiar with Ruby so didn't know that xD

It's working fine. You just didn't remove the commented part of the script. Every comment in Ruby (programing language of RMXP) starts with # symbol which also changes the color of the text after that. In the case of this forum it's brown, but inside the script editor (not event command) it changes to green text. Everything written after # will be commented and not have any effect in the script, but it only works for the line the # is written.


Also Dragonite just show you how to display a text written by the player. For use in a password, you need this:
Code:
Kernel.pbMessage("tell me something!")
password=pbEnterText("", 0, 10, "")
if password=="AAA"
return $game_switches[XX]=true
else
return $game_switches[XX]=false
end

beeing XX a switch you are NOT using.

After that you can use it normally in a conditional branch from the event commands. The == checks what is the input from the player and the =true turns the switch ON while =false turn the switch OFF.
In addition to that I highly suggest, when you are using the script command, that you use the "extendtext" from the project root folder. It makes the text box bigger and you will avoid having troubles with some scripts. Don't worry if nothing show up, it works just like that. You can check the task manager and see that it's working just fine in the process tab (I don't really know how it's in english, sorry).
Ah, oke thank you too!

Both helped me out a lot!
 
Top