Show picture with random variables but as a textpicture

RPGMZ_2023-12-21_05-34-44.png

Here is some context. If the main character is between level 1-9 (not 0-9 thats a mistake) when I call this event I want it to show a randomly chosen textpicture from 3 textpictures.

So from searching I came across this line of code where you could show a picture instead of a text.

$gameScreen.showPicture(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode)
$gameScreen.showPicture($gameVariables.value(1), 'picture_name', 0, x, y, 100, 100, 255, 0);

What I thought was to use the random variable command and if variable is 1, it shows (text)picture #41 and if variable is 2 it shows (text)picture#42 and so on.

Would this be the right way of doing it? Or could there be another hopefully a simpler way of doing by using arrays? I'm looking at way over 50 textpictures which'll show and change depending on the character's level at intervals of 10 levels up to say, level 50.
Based on the event that you posted, I'm having trouble making sense of what you're going for. But from your description, it sounds like you want to display one message using the TextPicture plugin, and you want the message to be randomly selected from a list of possible messages? If so, this would probably be the simplest way to go about it:
1703216461227.png


Or if you really want to use arrays, here is one way to go about it:
Spoiler: Using Arrays
Put something like this into a new .js file, and add it to your project through the plugin manager (but you'll probably want to replace my name with an identifier that is unique to you):
JavaScript:
var Arthran = Arthran || {};
Arthran.Thoughts = {};

// Thoughts for levels 0-9
Arthran.Thoughts.lv0to9 = [
    "Booties and butts",
    "Butts and booties",
    "Derrieres and posteriors"
];

// Thoughts for levels 10-19
Arthran.Thoughts.lv10to19 = [
    "I'm a little teapot",
    "Short and stout",
    "Here is my handle",
    "Here is my spout",
    "When I get all steamed up",
    "Hear me shout",
    "Tip me over",
    "And pour me out"
];

// Thoughts for levels 20-29
Arthran.Thoughts.lv20to29 = [
    "The quick brown fox",
    "Jumped over the lazy dog"
];

// etc.


Then the event could look something like this:
1703218261377.png


For the next level bracket, the event would look the same, except replace the two instances of lv0to9 with lv10to19.

*edit* Ignore the "Control Self Switch : A = ON" line. I was using that for testing purposes, and forgot to remove it afterward.

There are ways to make it fancier, but I don't want to overload you.
$gameScreen.showPicture(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode)
$gameScreen.showPicture($gameVariables.value(1), 'picture_name', 0, x, y, 100, 100, 255, 0);
I think you're misunderstanding this. The picture ID doesn't matter unless you have multiple pictures displayed (so you then have a point of reference for which one to move/erase/etc.).

If you're only displaying one of these options, there's no reason to use a variable to call it a different ID. All of your choices can be, for example, ID #42, the actual filename is the part that would be different.
Based on the event that you posted, I'm having trouble making sense of what you're going for. But from your description, it sounds like you want to display one message using the TextPicture plugin, and you want the message to be randomly selected from a list of possible messages? If so, this would probably be the simplest way to go about it:
View attachment 289076

Or if you really want to use arrays, here is one way to go about it:
Spoiler: Using Arrays
Put something like this into a new .js file, and add it to your project through the plugin manager (but you'll probably want to replace my name with an identifier that is unique to you):
JavaScript:
var Arthran = Arthran || {};
Arthran.Thoughts = {};

// Thoughts for levels 0-9
Arthran.Thoughts.lv0to9 = [
    "Booties and butts",
    "Butts and booties",
    "Derrieres and posteriors"
];

// Thoughts for levels 10-19
Arthran.Thoughts.lv10to19 = [
    "I'm a little teapot",
    "Short and stout",
    "Here is my handle",
    "Here is my spout",
    "When I get all steamed up",
    "Hear me shout",
    "Tip me over",
    "And pour me out"
];

// Thoughts for levels 20-29
Arthran.Thoughts.lv20to29 = [
    "The quick brown fox",
    "Jumped over the lazy dog"
];

// etc.


Then the event could look something like this:
View attachment 289079

For the next level bracket, the event would look the same, except replace the two instances of lv0to9 with lv10to19.

*edit* Ignore the "Control Self Switch : A = ON" line. I was using that for testing purposes, and forgot to remove it afterward.

There are ways to make it fancier, but I don't want to overload you.
So I'm using the Booties an Butts array method but every time i recall the event (by erase picture#10 and call picture10) the ingame text switches between the first line of thought
"Booties and butts"
and just a number "0"
What could be the problem?
RPGMZ_2023-12-24_17-45-32.png


atom_2023-12-24_18-02-42.png

Also, I'm trying to split thoughts into second lines because they cut out of the frame, but I think I'm getting syntax error because of that "for" How do I turn it into a string?
So I'm using the Booties an Butts array method but every time i recall the event (by erase picture#10 and call picture10) the ingame text switches between the first line of thought

and just a number "0"
What could be the problem?
View attachment 289480

View attachment 289485
Also, I'm trying to split thoughts into second lines because they cut out of the frame, but I think I'm getting syntax error because of that "for" How do I turn it into a string?
On your second Control Variables command, the part that says $gameVariables.value(36) needs to be $gameVariables.value(35) instead.

For your array, you can't put a line break in the middle of a regular string like that. Instead, put \n wherever you want linebreaks to occur:
JavaScript:
Heroa.Thoughts.lv0to9 = [
    "Butts and booties\nbooties for butts",
    "Booties and butts",
    "Derrieres and posteriors"
];

Original thread: https://forums.rpgmakerweb.com/threads/show-picture-with-random-variables-but-as-a-textpicture.164040/