Saving variables?

Shin Kitsune

KITSUNE Game Design
Veteran
Joined
Oct 15, 2012
Messages
149
Reaction score
37
First Language
ENG/SPA
Primarily Uses
RMMV
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!
 

King Gerar

White Wolf
Veteran
Joined
May 15, 2012
Messages
165
Reaction score
212
First Language
Portuguese
Primarily Uses
RMMV
You can use Game_System class to this. Something as:
Code:
$gameSystem.doorpass1 = prompt ("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT:");
 

Gamefall Team

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
348
Reaction score
473
First Language
Italian
Primarily Uses
RMMZ
Or you can use a classic game variable, too:
Code:
$gameVariables._data[n] = prompt("PLEASE INPUT THE PASSWORD FOR ACCESSING THE VAULT;");
 

Shin Kitsune

KITSUNE Game Design
Veteran
Joined
Oct 15, 2012
Messages
149
Reaction score
37
First Language
ENG/SPA
Primarily Uses
RMMV
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.
 

Gamefall Team

Nebula Games Leader
Veteran
Joined
Jan 10, 2017
Messages
348
Reaction score
473
First Language
Italian
Primarily Uses
RMMZ
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 :)
 

King Gerar

White Wolf
Veteran
Joined
May 15, 2012
Messages
165
Reaction score
212
First Language
Portuguese
Primarily Uses
RMMV
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);
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

This is relevant so much I can't even!
Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect

Forum statistics

Threads
105,996
Messages
1,018,216
Members
137,777
Latest member
Bripah
Top