Saving variables?

Hello. I am not sure of how to do this. I am trying to have a defined variable to be saved so it can be remember throughout the game.

I am not talking about the RPG Maker variables, but about JavaScript-defined variables.

I am trying to have a prompt for the player to input a certain string, but said string is erased after the event runs.

var doorpass1=prompt ("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT:");

How can I save the "doorpass1" variable for later use in the game?
Thanks in advance!
You can use Game_System class to this. Something as:
Code:
$gameSystem.doorpass1 = prompt ("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT:");
Or you can use a classic game variable, too:
Code:
$gameVariables._data[n] = prompt("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT;");
You can use Game_System class to this. Something as:
Code:
$gameSystem.doorpass1 = prompt ("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT:");
Thanks! I guess this should help! Now my other question would be, how do I make the text box display the value in said variable?

Or you can use a classic game variable, too:
Code:
$gameVariables._data[n] = prompt("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT;");
It would work, except RPG Maker variables store only numeric values. I want to store a string in it, so it wouldn't work if I use these in this case.
I made a test and game variables can store strings as well. If you make a test through show text command:
$gameVariables._data[5] = 'Test';
And in show text you use the escape code \v[5], you will see your string 🙂
Thanks! I guess this should help! Now my other question would be, how do I make the text box display the value in said variable?
Using this:
Code:
$gameMessage.add($gameSystem.doorpass1);

Original thread: https://forums.rpgmakerweb.com/threads/saving-variables.78554/