Randomized Words?

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
So i'm looking for a plugin that randomizes words in text. Basically, you make dictionaries (txt files filled with words placed in a dictionaries folder) it pulls words from, and then to add them in text, you use a text code like \ra[x], with the x being the dictionary's file name. And before you tell me to use variables, i tried. It's just hard and really impractical to make up like 50 conditonal branches for every single word that i want randomized.
 
Last edited:

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
50 Conditional Branches? Why would you need a single one?
Iam just curious, because Variables in combination with Hidden Key Items and their description would have been the things i suggest.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,218
Reaction score
1,191
First Language
Spanish
Primarily Uses
RMVXA
I'm pretty sure you can do it without a plugin, by using script calls to the string object.
IDK about the "reading from a txt file" part, tho.
would those be just random words without any structure?
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
I'm pretty sure you can do it without a plugin, by using script calls to the string object.
IDK about the "reading from a txt file" part, tho.
would those be just random words without any structure?
yeah, totally random words specified in the txt file. and i have no idea how to use script calls.
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
Yoo-hoo, anyone?
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
I also wanted to read data from an external text file. I found this plugin by Ozubon that seems to work well for what I need. Note that Ozubon clearly states the plugin won't work with mobile/android devices. And, because it uses Node J.S., I'm not even sure it will work on a Mac. But it works just fine on my PC. I only tested the read. ATM, I have no interest in the other file manipulations (write, append, erase, verify, etc.).

Is your dictionary just a word list? Or does it also contain definitions? If it's just a word list, you can transfer it from your in game variable to a javascript array, then do an array shuffle and just keep selecting words from the array one-by-one. If your word list also contains definitions, which may be the case since you called it a dictionary, you'll need to put some type of a special character between the word and the definition and then just parse the word out once it's chosen. I know next to nothing about javascript (I could do it in BASIC in minutes), but there are plenty of examples in this forum to help you. Search for keywords 'array,' and 'splice.'
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
I have no idea what a javascript array is, though.
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
A variable is a labelled virtual box that you use to store something in. So, in the game, you have a bunch of control values you can use to store data. The data can either be numerical or a string. Basically, a numerical is anything that can be used in a math equation, for instance 3 or 139425835. A string is anything else, and it might even contain numbers. Your zip code, for example, but typically words or letter/number combinations.

An array is a list of like values (numerical or string) that you can store within one variable. So, let's look at your list of words. You can assign each word to variable using the native game engine Event -> Control Variable. Example

Control Value 0001: dog
Control Value 0002: cat
Control Value 0003: bird
Control Value 0004: mouse
and so on.

But you can also use the script command to put all of those words into one variable
Control Value 0001 <using Script>: [dog, cat, bird, mouse]

Why would you want to do that? Because then you can extract just one word out of that list, like the first or the last or the second or even a random one. You'd use more javascript to do that and then take that one word, place it into another ingame Control Value and you'd be able to display that word in text using \v[n].

So.... you're asking for some help with random words, but you're not being very explicit in what exactly you want to do. I can use javascript to put variables in and out of javascript variables / ingame variables using $gameVariables. I can use the above mentioned plugin to read an external textfile and put all the words into one variable and make that variable an array. But I don't know exactly what you want to do with those words. I also don't know what else your dictionary contains besides a word list. Are there definitions that are assigned to each word? Do you need a way to display those definitions inside a text box? In that case, my guess is you'd need another plugin for wraparound.

But these are just guesses. I am hoping that once someone with more expertise than me (probably 99% of the people on this forum) will see this and, once you've explained exactly what you are trying to accomplish, will attempt a plugin. I have a selfish interest in this hope, as I can do all this with individual scripts in each event, but, boy, it would be nice to just have a plugin. :)

I'm really interested in hearing just what exactly you want to do with your dictionary.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,218
Reaction score
1,191
First Language
Spanish
Primarily Uses
RMVXA
my idea was that you can probably split the original text into an array, and then turn each word into an index, which is a number and can be randomized.
but, that depends on how complex you want it to be, if you don't know how to use script calls.
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
I just want an easy and fast way to randomize words, without having to do any of that fancy stuff because that seems like it'll take a long time to do for every word i need randomized.
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
Okay, since you're not very good at explaining what you DO want to do, maybe you are better at explaining what you DO NOT want to do. Start with this

1595358728776.png

It puts an array of words in variable 0001, selects a random number in variable 0002, and pulls out that random word, then stores that random word in variable 0003. It's not fancy by any means and I don't know of a simpler way to do it. Is this close to what you are asking for?
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
And then i just do that for the 100+ words i want randomized?
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
And then i just do that for the 100+ words i want randomized?
I used this block of text
Code:
["word001","word002","word003","word004","word005","word006","word007","word008","word009","word010","word011","word012","word013","word014","word015","word016","word017","word018","word019","word020","word021","word022","word023","word024","word025","word026","word027","word028","word029","word030","word031","word032","word033","word034","word035","word036","word037","word038","word039","word040","word041","word042","word043","word044","word045","word046","word047","word048","word049","word050","word051","word052","word053","word054","word055","word056","word057","word058","word059","word060","word061","word062","word063","word064","word065","word066","word067","word068","word069","word070","word071","word072","word073","word074","word075","word076","word077","word078","word079","word080","word081","word082","word083","word084","word085","word086","word087","word088","word089","word090","word091","word092","word093","word094","word095","word096","word097","word098","word099","word100"]
Set up an event using the example I gave in the screenshot above. Copy and paste this block of dummy text into your Command Variable textbox. Then change your random number range to 0-99. I ran it without any problem, but there was little else going on to eat up memory. If you find that putting 100 words into one variable becomes unmanageable, you can break it up to say 25 words per variable. But then you'd need 2 randoms. The first to randomly select which array to choose from and the second to select the element from that chosen array. That might be more manageable, especially if you thought you wanted to add more words along the way. Whichever you decide, I'd definitely not try to type directly into the textbox. Make sure you type in Notepad or something and then copy and paste. Also, be sure the formatting is correct. Open bracket, quotes around each word, comma separating each word, closing bracket.

Do you think this will work for you?

Ideally, it would be best to use a plugin like @ozubon 's and then you would only have to deal with the text file. Unfortunately, you'd need someone to help you who has a lot more knowledge and expertise than I have. I have been trying all day with the data retrieved from a textfile and then inputted into the command variable using Ozbon's plugin (which works great by the way), but I can't get the javascript variable to recognize it as an array. I can only get this event to work if the data is typed directly into the command variable input box. If someone else could jump in, I'd sure appreciate it.
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
but then this happens.
Screenshot from 2020-07-21 20-25-18.pngScreenshot from 2020-07-21 20-25-28.png
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
That's because you are displaying variable 0001 instead of variable 0003. Change to
Good, good. That means you are \v[3] and the marketing can begin.

Variable 0001 is holding the entire array (list of words). When you select one word, then that one word goes in to variable 0003. Make that change and let me know how it works.
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
now how do i randomize multiple words in a sentence? Marketing is supposed to be randomized too, and later in the scene, 4 words get randomized in the same sentence.
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
Unless you can give a clearcut example of what 'randomize multiple words in a sentence means,' I'm afraid I'm fresh out of ideas. Use different variables, same concept.
 

Mooshry

BTS has consumed my very existence help.
Veteran
Joined
May 30, 2016
Messages
395
Reaction score
145
First Language
English
Primarily Uses
RMMV
Never mind, i found out how. But now how do i randomize item names?
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
60
Reaction score
31
First Language
English
Primarily Uses
RMMV
Put all your item names in an array and do the same as you did for words.
Q #1 - What items have you already included in your game?
Q #2 - Will you be adding an item to the player's inventory?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I just like this website:
lol
I streamed Moonfall on 9/25/20
and have started a page to showcase my vids/stream :kaoluv:

Please subscribe and follow, it's free, it's quick and one sub means so much to me, it would really make my day~ :wub

And now to face my worst enemy... adding color :kaocry:

Forum statistics

Threads
103,234
Messages
998,244
Members
134,721
Latest member
isaton
Top