- Pokémon Essentials Version
- v17.2 ➖
Text Area Input for Essentials v17.2
What is this resource?
This code allows the player to enter a text, on an actual text area. It was designed to write free-hand notes and expanded to be usable for other purposes. The code is written in a way, that you can influence most of the parameters without needing to understand the whole code.
Features:
Demo Video
How to install
1) Create a new script section called "Text_Area_Input"
2) Copy and paste the contents of "Textarea_Input.txt" into that script section
3) Copy and paste the provided image file into your Graphics/Pictures/Naming folder
Optional:
4) Create a new script section called "Text_Area_Mail_Presets"
5) Copy and paste the content of "Textarea_Mail_Presets.txt" into that script secton
The game will then automatically use the new script for mails.
How to use Text Area Input
Depending on where you want to use it, you need to put the code in different places. I'll just show you the neccassary lines on different examples.
Basic explanation
Examples
Please give credit.
For questions and bug reports visit our Discord channel https://discord.gg/7msDPaN or post them here.
Change Log
- none
What is this resource?
This code allows the player to enter a text, on an actual text area. It was designed to write free-hand notes and expanded to be usable for other purposes. The code is written in a way, that you can influence most of the parameters without needing to understand the whole code.
Features:
- Custom background for area input, in the style of vanilla Essentials
- Write messages, that are limited by the actual remaining spaces and lines
- Jump to the beginning/end of a line with Pos1/Home or End key
- Let player edit title/helptext
- Navigation with up/down/left/right arrow
- Show icon of the player, an NPC, an item or a Pokemon, just like with the naming screen
- Text color is determined by the brightness of the background image
- Change background image
- Modify avaiable lines and their height/width as well as position on the screen
- Set help text and/or initial text
- Start in read mode to disable the input and just show the text
- Using the Mail Presets: Write the message on the actual mail background
- Some more things, that you can discover by looking at the top part of the code
Demo Video
How to install
1) Create a new script section called "Text_Area_Input"
2) Copy and paste the contents of "Textarea_Input.txt" into that script section
3) Copy and paste the provided image file into your Graphics/Pictures/Naming folder
Optional:
4) Create a new script section called "Text_Area_Mail_Presets"
5) Copy and paste the content of "Textarea_Mail_Presets.txt" into that script secton
The game will then automatically use the new script for mails.
How to use Text Area Input
Depending on where you want to use it, you need to put the code in different places. I'll just show you the neccassary lines on different examples.
Basic explanation
Use this line to initialize the Text Area Entry Class
This line always comes first
Use this line if you want to only return the message, that the player entered. All other setup needs to be done beforehand (if you wish to modify it). This line returns an array of strings and stores it in the given variable
Parameters are as follows:
- helptext: The text that will tell the player what to do (i.e. "Enter a text for your note book") It is a simple sring
- initialText: The text that will be shown when opening the screen. It usually is empty, so you put in [""] (see examples below). This argument must be given as an array of strings.
- minLength: The minimum amount of text that needs to be put in. If set to 0 the text input can be canceled, otherwise you can only exit if enough text
Use this line if you want to return the text and the title (which is te helptext). All other setup needs to be done beforehand (if you wish to modify it). It returns an array in the following format: [[array of text],"string of title"]
Use this line if you only want to display text. The minimum text input is always set to 0. The argument "mail" has to be an mail object. You usually don't need to set this by hand as it is only relevant for the mail presets.
This line always comes first
Ruby:
textEntryScreen = PokemonTextareaEntry.new
Use this line if you want to only return the message, that the player entered. All other setup needs to be done beforehand (if you wish to modify it). This line returns an array of strings and stores it in the given variable
Parameters are as follows:
- helptext: The text that will tell the player what to do (i.e. "Enter a text for your note book") It is a simple sring
- initialText: The text that will be shown when opening the screen. It usually is empty, so you put in [""] (see examples below). This argument must be given as an array of strings.
- minLength: The minimum amount of text that needs to be put in. If set to 0 the text input can be canceled, otherwise you can only exit if enough text
Ruby:
variable = textEntryScreen.pbTextOnly(helptext,initialText,minLength=0)
Use this line if you want to return the text and the title (which is te helptext). All other setup needs to be done beforehand (if you wish to modify it). It returns an array in the following format: [[array of text],"string of title"]
Ruby:
variable = textEntryScreen.pbTextWithTitle(helptext,initialText,minLength=0)
Use this line if you only want to display text. The minimum text input is always set to 0. The argument "mail" has to be an mail object. You usually don't need to set this by hand as it is only relevant for the mail presets.
Ruby:
textEntryScreen.pbShowTextArea(helptext,initialText,mail=nil)
Examples
Example 1:Use the default text area input with not changes, to prompt the player to enter a message for a note book:
Example 2: Use the default text area input, to let the player enter a message for a note book and a title:
Example 3: Use the default text area input, to show the player the message and title he entered previously (see Example 2):
Example 4: Same as Example 1 but with a custom background:
Example 5: Use the default text area input with not changes, to prompt the player to enter a message for a Pokemon, showing the Pokemon Icon:
Modifying the screen as shown in the examples requieres you to know exactly where you want to place things. I tried to comment the code as much as possible to provide an idea of what each bit does. For the most part though, you will only need to understand the first 130 lines. You can also create your own presets to reuse by putting them into a method like so:
In action it would look like this:
Ruby:
textEntryScreen = PokemonTextareaEntry.new
variable = textEntryScreen.pbTextOnly("What do you want to write down in your notebook?",[""])
Example 2: Use the default text area input, to let the player enter a message for a note book and a title:
Ruby:
textEntryScreen = PokemonTextareaEntry.new
textEntryScreen .editTitle = true
variable = textEntryScreen.pbTextWithTitle("",[""])
Example 3: Use the default text area input, to show the player the message and title he entered previously (see Example 2):
Ruby:
textEntryScreen = PokemonTextareaEntry.new
textEntryScreen.pbShowTextArea(variable[1],variable[0])
Example 4: Same as Example 1 but with a custom background:
Ruby:
textEntryScreen = PokemonTextareaEntry.new
textEntryScreen .bgImage = "Notes/noteBackground" # this has to always be a graphic somewhere in "Graphics/Pictures"
textEntryScreen .maxRows = 11
textEntryScreen .setHelpTextPosition(50,26) # set the position of the help tex
textEntryScreen .setHelpTextSize(464,40,35) # sets the size of the area of the help text (x,y,max title length)
textEntryScreen .setLineDimensions(440,24,2,4) # sets the dimensions of the lines (width,height,framesize,extraspace) framesize refers to the thickness of the line that is being drawn on, extra space is usually 4 and makes sure that lower case letters such as y,g,p are displayed fully
textEntryScreen .setLinePosition(50,46) # sets the position of the first line, the other positions are being calculated
variable = textEntryScreen.pbTextOnly("What do you want to write down in your notebook?",[""])
Example 5: Use the default text area input with not changes, to prompt the player to enter a message for a Pokemon, showing the Pokemon Icon:
Ruby:
textEntryScreen = PokemonTextareaEntry.new
textEntryScreen.subject = 2 # the subject codes are the same as with the normal naming screen
textEntryScreen.subjectValue = $Trainer.party[0] # subjectValue stores the info about the Pokemon that should be shown, in this case it's the first Pokemon in party
variable = textEntryScreen.pbTextOnly("What do you want to tell your Pokemon?",[""])
Modifying the screen as shown in the examples requieres you to know exactly where you want to place things. I tried to comment the code as much as possible to provide an idea of what each bit does. For the most part though, you will only need to understand the first 130 lines. You can also create your own presets to reuse by putting them into a method like so:
Ruby:
def setCustomPresets(scene)
# scene has to be the TexareaEntry class
scene.bgImage = "Custom/customImage"
scene.maxRows = 11
scene.subject = nil
scene.editTitle = true
scene.setHelpTextPosition(50,26)
scene.setHelpTextSize(464,40,35)
scene.setLineDimensions(440,24,2,4)
scene.setLinePosition(50,46)
end
In action it would look like this:
Ruby:
textEntryScreen = PokemonTextareaEntry.new
setCustomPresets(textEntryScreen)
variable = textEntryScreen.pbTextWithTitle("",[""])
Please give credit.
For questions and bug reports visit our Discord channel https://discord.gg/7msDPaN or post them here.
Change Log
- none
- Credits
- Hollow_Ego a.k.a ego13 for the code
Droid779 for the background image
Destryer/Lucifer Morningstar for the inspiration to even think about to code this