Split by long Parameter

Sajiki

Villager
Member
Joined
Jun 17, 2016
Messages
8
Reaction score
1
First Language
German
Primarily Uses
Hello :)


sry for my bad english!


I have a "Parameters" with this text "Hello, i'm a test text and i'm a loooooong text for testing the box."


* @param Description
* @desc test text
* @default Hello, i'm a test text and i'm a loooooong text for testing the box.



Code:
 var bpcpara = PluginManager.parameters("BPC_Difficulty");
 var txtcolord = String(bpcpara["Text Color Description"]);





so, i dont have a idea for Split the text.


i know i can to ths with that:


var names = bpcpara["Description"].split(",").filter(function(value) { return !!value; });




but i would change my text so:


Hello, i'm a test text and i'm a


loooooong text for testing the box.


How i can to this?


Mfg


Sajiki
 

sagebrushfire

Villager
Member
Joined
Jun 12, 2016
Messages
25
Reaction score
12
First Language
English
Primarily Uses
If you want to automate this then you need to count the parameter's characters and then decide on a maximum amount of characters per line. Then you need to cut the parameter value off and break it into a new line at that point. Unfortunately if it's meant to have words, you also need to search for the nearest space character that's under the max character per line limit and then break it off their instead. Honestly it's a bit of a pain and it will involve a few different operations and probably some regex. 


OR, you could just impose this onto the user. Have them add their own line break where they want it by using a delimiting character and then just split your parameter on that special character. You are kind of already doing this with the split function you're using and a comma. 


The split function is part of the string object in JavaScript. It returns an array of items from the string and uses the delimiter you provided to design how to place each bit of text in the array. 


var names = "Bob,Sally,Joe,Mark";

var nameArray = names.split(",");

// nameArray is now an array like this: ["Bob","Sally","Joe","Mark"]


But I can't tell if that really helps you. You appear to want to add a new line to your text, correct? If it's just text in an alert box you can insert \n wherever you want the new line. If it's HTML text on the page, you would need to insert something that would create a break like a <br/> tag. If it's a message box in RMMV then you'd need to use whatever mechanism RMMV uses for new lines or whatever plugin you're using ... there's no telling. I'd really need more details on how you're using this text to help you. 
 

Sajiki

Villager
Member
Joined
Jun 17, 2016
Messages
8
Reaction score
1
First Language
German
Primarily Uses
Thanks for answer :)


I have it done, your Split methode is a good idea.


i have give the Users breake the text with <br>.


Thanks for help :)
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top