- 4
- Posts
- 3
- Years
- He/Him
- Seen Apr 7, 2023
I'm trying to make the player input text and then make the game check if what the player entered was a specific value, a bit like a password, can someone help me with that?
You should check here:
https://essentialsdocs.fandom.com/wiki/Messages#Entering_text
You can save the message as they say:
message = pbMessageFreeText(_INTL("Please enter a message."),
_INTL("Default message."),
false, 256, Graphics.width)
And then save it into a variable:
pbSet(variable_number, message)
Now, just use a conditional branch, and check if it matches.
This is a text, the function pbMessageFreeText should let the player enter free text.
Oh! I actually have two ways:
1. Store the wanted text on another variable, another temporary one (or not, if you want to keep this text on a specific variable). On the conditional branch option, you can compare a variable to another one, so this is one way.
2. Change the code we wrote earlier and use a temporary switch, for example, $game_switches[59] (or any other switch you can change). The next code lines should be:
wanted_message = "Hello, I'm the wanted message"
$game_switches[59] = (message == wanted_message)
And then, of course, the conditional branch should check if the switch is on (true= the same) or not (false= not the same).