Jump to content
Tsukihime

Simple text input

Recommended Posts

Simple text input

Author: Tsukihime

 

Overview

 

This is a very simple text input that only uses the default scripts (and is pretty much the default scripts)

 

It allows you to ask the user to enter some text (using the text input window) and then do something with the given input.

 

I imagine a script that does this is already around though.

 

Usage

 

Make a script call

 

enter_text(title, variable, max_chars)
"title" is a string that will be displayed. Sort of like reminding the user what the question was.

 

Variable is the variable that the text will be stored in. Default 1.

 

Max chars is the maximum number of characters they can enter

 

aSNry.jpg

 

Download

 

Script: Download here

 

Notes

 

Improve upon it and release a better script smile.png

 

I would prefer if it were available directly on Scene_Map so you could display both a game message as well as the text input. Sort of like the number input.

 

I would also like to see an input system that allows users to directly type it in with their keyboard.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I tried What is another name for Corn Chex? ' enter_text("What is another name for Corn

Chex?",1,6) '

 

and I got this

 

cc2_zps7ecffd1d.png

 

.

 

Where is the English, why this Japanese?!

Share this post


Link to post
Share on other sites

@Nightgazer Starlight, I had that problem as well once. I think it was because I had the japanese trial installed before I bought the english version.

 

If you go to Game_System in the Scripts theres this code on lines 38 - 40:

def japanese?
$data_system.japanese
end

 

change that to this...

def japanese?
return false
end

 

That should hopefully work for you. If not, then I have no clue.

 

And Tsukihime, very nice script. I have some ideas for this. Not sure if I can implement them how I imagine, but I am going to try.

Share this post


Link to post
Share on other sites

@Nightgazer Starlight, I had that problem as well once. I think it was because I had the japanese trial installed before I bought the english version.

 

If you go to Game_System in the Scripts theres this code on lines 38 - 40:

def japanese?
$data_system.japanese
end

 

change that to this...

def japanese?
return false
end

 

That should hopefully work for you. If not, then I have no clue.

 

And Tsukihime, very nice script. I have some ideas for this. Not sure if I can implement them how I imagine, but I am going to try.

 

Thanks!^_^

 

That seems to have done the trick.

 

Didn't realize the trial would mess with the install of the version I paid for.

Share this post


Link to post
Share on other sites

Nice script man I am gonna use it all time at my proj :)

but I have some quest

how did you "read" the text (variable) for example to show it or to make an if statement that works when specific text/s  is/are  written
and finally if you have max 10 and you write for example a message with 4 chars does the 6 empty chars count as letters (spaces)

 

thanks beforehand i hope for a quick reply :/

 

 

edit:

actually the big prob i have is that the variable is string so how can i read a string variable??? :/

and also how to show it on a text like you did... 

Edited by winnerspiros

Share this post


Link to post
Share on other sites

You would use a script in the conditional branch.

Assuming I stored it in variable 12...

 

Compare using

$game_variables[12].downcase == "blah"
Showing up in text should be a matter of \v[12]

 

really thx man! thank you for fast reply too :)

Share this post


Link to post
Share on other sites

@Nightgazer Starlight, I had that problem as well once. I think it was because I had the japanese trial installed before I bought the english version.

 

If you go to Game_System in the Scripts theres this code on lines 38 - 40:

def japanese?
$data_system.japanese
end

change that to this...

def japanese?
return false
end

That should hopefully work for you. If not, then I have no clue.

 

And Tsukihime, very nice script. I have some ideas for this. Not sure if I can implement them how I imagine, but I am going to try.

Hey dude thanks it really helped when i had the Japanese version

Share this post


Link to post
Share on other sites

Hey what do you do with the variables? 

 

yeah, just what must we do with the variable ? because the variable only allow us to insert number, not text

i mean, i want to make something like a quiz, and the way are like this :

 

quiz : when my mother bought some juices ?

if he answer " september " it comes the right value. and if he answer the wrong value, nothing will happened.

how to make that ?

Share this post


Link to post
Share on other sites

@nyxzryu: you can insert anything to variables.

just select change variable. and in "operand" choose Script.

then you could add any text (and even object).

 

and hime script store what you input TO a variable (you set in config). thus you can compare it with the 'answer'

 

 

quiz : when my mother bought some juices ?

if he answer " september " it comes the right value. and if he answer the wrong value, nothing will happened.

how to make that ?

 

using hime script.

1) show text: when my mother bought some juices ? (optional)

2) script call: enter_text("when my mother bought some juices ?", 1,12)

above translate to:

show input window with title: "when my mother bought some juices ?"

and when you enter the answer it will store it to variable: 1

and max char you can inputted is: 12 character

3) the user will input the answer.

4) conditional branch: 4th tab: Script: $game_variables[1].downcase == "september"

    if true show message "you're right..."

    else show message "you're wrong"

5) profit :D.

Edited by estriole

Share this post


Link to post
Share on other sites

@nyxzryu: you can insert anything to variables.

just select change variable. and in "operand" choose Script.

then you could add any text (and even object).

 

and hime script store what you input TO a variable (you set in config). thus you can compare it with the 'answer'

 

 

quiz : when my mother bought some juices ?

if he answer " september " it comes the right value. and if he answer the wrong value, nothing will happened.

how to make that ?

 

using hime script.

1) show text: when my mother bought some juices ? (optional)

2) script call: enter_text("when my mother bought some juices ?", 1,12)

above translate to:

show input window with title: "when my mother bought some juices ?"

and when you enter the answer it will store it to variable: 1

and max char you can inputted is: 12 character

3) the user will input the answer.

4) conditional branch: 4th tab: Script: $game_variables[1].downcase == "september"

    if true show message "you're right..."

    else show message "you're wrong"

5) profit :D.

 

wow your methods really works, thank you so much :D

i get it now, so the variables are changeable isn't it ?

 

but i still confused about ( downcase == "september" ), what is downcase means ? i changed it to uppercase, it always comes with the right answer when i filled the answer with both uppercase and lowercase letter.

Share this post


Link to post
Share on other sites

.downcase and .uppercase is method for string.

It convert string to downcase or upper case.

Ex:

"My NAme iS bOboY"

Downcase: "my name is boboy"

Uppercase: "MY NAME IS BOBOY"

 

The downcase and uppercase is used so the answer doesn't need to be case sensitive.

Ex: answer is "September"

"SEPtember" will still correct.

"september" will still correct.

"SEPTEMBER" will still correct.

You don't want your player to angry because they got wrong capitalization.

Share this post


Link to post
Share on other sites

.downcase and .uppercase is method for string.

It convert string to downcase or upper case.

Ex:

"My NAme iS bOboY"

Downcase: "my name is boboy"

Uppercase: "MY NAME IS BOBOY"

 

The downcase and uppercase is used so the answer doesn't need to be case sensitive.

Ex: answer is "September"

"SEPtember" will still correct.

"september" will still correct.

"SEPTEMBER" will still correct.

You don't want your player to angry because they got wrong capitalization.

so that's how it works, anyway thanks for the help :D

Share this post


Link to post
Share on other sites

 

.downcase and .uppercase is method for string.

It convert string to downcase or upper case.

Ex:

"My NAme iS bOboY"

Downcase: "my name is boboy"

Uppercase: "MY NAME IS BOBOY"

 

The downcase and uppercase is used so the answer doesn't need to be case sensitive.

Ex: answer is "September"

"SEPtember" will still correct.

"september" will still correct.

"SEPTEMBER" will still correct.

You don't want your player to angry because they got wrong capitalization.

so that's how it works, anyway thanks for the help :D

hey, i had some problems again :(

i can;t enter long text for the "title".

i want to make somekind of quiz just like i said before, but when i input not-too-long "title", it's not shown up.

ex :

enter_text("how and why some animals can fly while some again not ? can you answer it with 2 little words ? ",

2,15)

 

 

2AgwHpm.jpg

 

 

any solution for this ?

Share this post


Link to post
Share on other sites

I've been just using the name input to do stuff like this in my games but I have been limited to the 16 character max for the input. Is there a limit on how many characters can be typed in?

 

Also, it's looking like people are having trouble with text that exceeds the window size, it runs off the screen. Is there a way to alter the script to make it so that it wraps into a second third and maybe fourth line when it gets too long?

 

 

Awesome script Tsukihime! As usual :)

Share this post


Link to post
Share on other sites

I have not taken the time to look at multiple lines but the easiest way would be to have a fixed number of characters per line and then check how many characters have been entered to determine where the cursor should be placed.

Share this post


Link to post
Share on other sites

I've been just using the name input to do stuff like this in my games but I have been limited to the 16 character max for the input. Is there a limit on how many characters can be typed in?

 

Also, it's looking like people are having trouble with text that exceeds the window size, it runs off the screen. Is there a way to alter the script to make it so that it wraps into a second third and maybe fourth line when it gets too long?

 

 

Awesome script Tsukihime! As usual :)

 

 

I have not taken the time to look at multiple lines but the easiest way would be to have a fixed number of characters per line and then check how many characters have been entered to determine where the cursor should be placed.

 

yeah i agree with kevin, is there a way to doing so ?

it would be nice :D

Share this post


Link to post
Share on other sites

A few questions.
1. What are the conditions to use this, if any.
2. I get the script call, but where do i actuall put the script itself? I tried putting it Materials (Insert Here) section of the script editor, but I just keep getting errors whenever a script call for this is reached. What am I doing wrong?

But all in all this sounds so awesome, I really can't wait to get this working. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×