The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: shintashi on May 14, 2010, 03:59:54 AM

Title: text input?
Post by: shintashi on May 14, 2010, 03:59:54 AM
I'm trying to figure out a way to create a text input that displays, saves, and can be changed.

Basically, a variable i can stick text into, and then call up to display.

So far the closest I've gotten is something like this:

(inside Script window on page 3 of events)
$game_temp.message_text = "hi"
followed by a control self switch to move out of this loop. (otherwise it loops endlessly).

I tried using specific variables like
$game_temp.message_text = $data_actors[1].character_name

but it causes my icon to delete and calls me 'fighter 001" or some such.

I'm not sure if this can be done with pure eventing, eventing with script references, or if its pure scripting.
Title: Re: text input?
Post by: cozziekuns on May 14, 2010, 04:38:09 AM
I'm confused about something. Do you want the player to be able to actually input text, or do you just want some text stored in a variable?
Title: Re: text input?
Post by: shintashi on May 14, 2010, 04:50:13 AM
for what I'm doing, whichever is easier. I need to be able to save the names of maps/areas, either literally as they are saved in the map directory, or giving an option for players to describe them with a fill in the blank option similar to input number.
Title: Re: text input?
Post by: Mr_Wiggles on May 14, 2010, 10:09:01 PM
Can't you do this by using a name input then converting that into a variable?

example:

call a name impute for actor some ID (its temp) after that is over use a script command:

$game_variables[id] = $game_actor[same id as before].name

i know there there is probably more that your asking, but this is how to set a variable to a string that the player sets.
Title: Re: text input?
Post by: cozziekuns on May 14, 2010, 10:32:06 PM
Name input has a max of 12 characters, so I don't really think it's what he wants  :-\
Title: Re: text input?
Post by: shintashi on May 15, 2010, 03:35:27 PM
i want something like this, but working:

conditional branch...[something]
Script: $game_variables[1] = map_id
Else
Branch End


conditional branch...[something else]
Script: $game_temp.message_text = $game_variables[1]
Else
Branch End

Basically, a way of saving the name of the map you are currently on, and calling it later in a message text.





Title: Re: text input?
Post by: cozziekuns on May 15, 2010, 03:40:05 PM
Couldn't you just write the name of the map that the player is currently in, in the text box?

So say the character is in Grassy Plain. You could just go Show Text: Grassy Plain.

Or do you want something more complicated then that?
Title: Re: text input?
Post by: Mr_Wiggles on May 15, 2010, 04:02:14 PM
data_maps = load_data("Data/MapInfos.rxdata")
$game_variables[ID] = data_maps[$game_map.map_id].name

that work?

also to show this in a message just use \v[ID].
Title: Re: text input?
Post by: shintashi on May 15, 2010, 04:17:25 PM
Quote from: Mr_Wiggles on May 15, 2010, 04:02:14 PM
data_maps = load_data("Data/MapInfos.rxdata")
$game_variables[ID] = data_maps[$game_map.map_id].name

that work?

also to show this in a message just use \v[ID].

tried this:

$game_variables[36] = $data_maps[$game_map.map_id].name
$game_temp.message_text = $game_variables[36]

got an error. I'm guessing[$game_map.map_id] is supposed to be specific. I want it to query what the current map is and save it.
Title: Re: text input?
Post by: modern algebra on May 15, 2010, 04:27:37 PM
That's not what he asked you to do - what he was suggesting is correct. Do what he told you to do and access it in a message by \v[id].

The reason you are getting an error is because you put a $ in front of data_maps - Map Info is not saved in a global variable though - you have to load it first, which is what the first line Wiggles used was for and which you omitted.

So, do what Wiggles told you to do exactly, and it should work.
Title: Re: text input?
Post by: cozziekuns on May 15, 2010, 04:33:47 PM
Lol Modern, Mr. Wiggles edited his script around a bit. So Shin was just following commands.

PROOF:

« Reply #7 on: Today at 11:02:14 AM »
« Last Edit: Today at 11:05:56 AM by Mr_Wiggles »


Title: Re: text input?
Post by: modern algebra on May 15, 2010, 04:57:43 PM
Well, what Shintashi quoted from Wiggles in his post is correct, so assumedly he must have seen the modified post prior to posting. Anyway, it's not a big deal either way.
Title: Re: text input?
Post by: shintashi on May 15, 2010, 05:32:17 PM
still doesn't work. Tried it four or five different ways, with a number in ID and without.


QuoteScript:data_maps = load_data
("Data/MapInfos.rxdata")
$game_variables[1] = data_maps
[$game_map.map_id].name
Script:\v[ID]
causes an "undefined local variable or method 'data maps' for #<Interpreter..." error






Quotedata_maps = load_data
("Data/MapInfos.rxdata")
$game_variables[ID] = data_maps
[$game_map.map_id].name
causes a 0 for 1 error

Quotedata_maps = load_data
("Data/MapInfos.rxdata")
by itself causes an error

even

Quotedata_maps = load_data
crashes..

they all end up saying the same thing: wrong number of arguments (0 for 1)


Title: Re: text input?
Post by: cozziekuns on May 15, 2010, 05:36:39 PM
a = load_data("Data/MapInfos.rxdata")
$game_variables[1] =
a[$game_map.map_id].name

Text: \v[1]


Works...

EDIT: Lol, the script box wasn't big enough to hold the code data_maps = load_data("Data/MapInfos.rxdata").
Title: Re: text input?
Post by: Mr_Wiggles on May 15, 2010, 06:01:06 PM
lol...

Yea i find that problem allot, if the code doesn't fit on the line, and is cut up then you get a syntax.  You have to make it fit on one line some how. or carry over by a space where you can ( = > < all those things)
Title: Re: text input?
Post by: modern algebra on May 15, 2010, 06:18:18 PM
Yeah, cozzie is right - it needs to fit on one line.

Also, you put it in an in-game message, not in a script line, so:
Text: This map's name is \v[1].

Not

Script: \v[1]
Title: Re: text input?
Post by: shintashi on May 15, 2010, 08:11:00 PM
well it looks like it works, but only for what it does. How do I get the computer to remember the map name as a variable, and call that variable as text later?

For example, if I walk south and want the NPC to say "You came from the northern forest"

Right now it just says "You came from 0" because the v[1] sets back to 0, I'm guessing.
Title: Re: text input?
Post by: cozziekuns on May 15, 2010, 08:17:38 PM
Serious? It worked for me.

Are you sure you put in the call script:

a = load_data("Data/MapInfos.rxdata")
$game_variables[1] =
a[$game_map.map_id].name

And then you used the Show Text command with:

This map is \v[1].

Title: Re: text input?
Post by: shintashi on May 15, 2010, 09:06:29 PM
Quote from: cozziekuns on May 15, 2010, 08:17:38 PM
Serious? It worked for me.

Are you sure you put in the call script:

a = load_data("Data/MapInfos.rxdata")
$game_variables[1] =
a[$game_map.map_id].name

And then you used the Show Text command with:

This map is \v[1].



totally. Now make a second map and link them with transfer player events.
talk to the first sprite with the above code, then place

That map was \v[1].

inside a new sprite on the new map. The computer does not remember what v[1] is.
Title: Re: text input?
Post by: Mr_Wiggles on May 15, 2010, 09:14:06 PM
How are you setting the variable?

cause if the script command is not run it wont set the variable.  You can make it set it in the transfer player, or a corner event that is set to parallel.
Title: Re: text input?
Post by: cozziekuns on May 15, 2010, 09:22:54 PM
a = load_data("Data/MapInfos.rxdata")
$game_variables[1] =
a[$game_map.map_id].name

Text: \v[1]

Returned MAP001.

Transfered player to MAP002.

Text: \v[1]

Returned MAP001. You're probably doing something wrong...
Title: Re: text input?
Post by: Mr_Wiggles on May 15, 2010, 09:24:47 PM
Demo attached.
Title: Re: text input?
Post by: shintashi on May 15, 2010, 09:37:18 PM
yep, typo on my part ^^ i had v[2] instead of v[1]