Simple Question: Can the actor name be stored in a Variable as a string?

Maybe I am doing something wrong and I am continuing with my experiments...I gave up last night.

I am trying to use $dataParty.member()[id].name() to save a party member's name in a Variable after using Name Input Processing to change the party member's name.

But when I do that, it seems like the Variable isn't behaving like a string value.

For instance, when I declare a Variable with a string value ("ZombieKidzRule") and I use the Java Script .includes to compare Variable strings, things seem to work fine.

But when I try to use Name Input Processing and then save the $dataParty.members()[id].name() to a Variable, that value of that Variable doesn't seem to behave like a string value.

I could be doing something wrong and I will post an example after more experiments unless someone can just confirm that this IS or IS NOT stored as a string.

I hope that makes sense.
Could you post a screenshot of what you tried? There are ways to store strings in gameVariables, and I'm not sure if you are trying with scripts or with event commands.

In any case, you can simply use the script
$gameVariables.setValue(ID,"blabla") to store any string.

E.g.:

JavaScript:
const PartyMemName = $dataParty.member()[id].name();
$gameVariables.setValue(ID,PartyMemName);
@werzaque I can store a string in a Variable without any problem.

The problem I am experiencing is with taking the actual name of the actor/party member and storing that in a Variable.

Maybe I am approaching it all wrong and I am continuing to experiment this morning.

What I want to do is allow the player to input their own name (I am using Name Input Processing for that).

Then I want to compare what the player input for the name with specific strings to make sure that the player input isn't in the name.

Like let's say the player input "Zombie" as part of the name and I didn't want them to use that string.

I am using a script with .includes to check.

So I am trying to find a way to check what the player input using the Name Input Processing Event command with specific strings stored in Variables.

Again, I will post screenshots of my Event later, but my experiments lead me to believe that the value taken for the actor's name is not being stored as a string.
but my experiments lead me to believe that the value taken for the actor's name is not being stored as a string.
and that is why you were asked how you store the variable - the exact commands you used.

because you need to override the variable for the computer to understand that it is now holding a string - that happens automatically when using a direct string, but not always if transfering between variables due to differences in referencing
@Andar Thanks for that explanation! I remember trying 2 or 3 ways.

I will go back, double check, and then post screenshots of each to see what I am doing wrong.
If you use this function around the javascript reference it should do the trick:

$dataParty isn't a thing. It will probably work if you use $gameParty instead.
I am trying to use $dataParty.member()[id].name() to save a party member's name in a Variable after using Name Input Processing to change the party member's name.
As @Trihan mentioned, there's no such thing as $dataParty. You also wouldn't want to use $data-anything for this, because inputting an actor's name does not modify it in the database.

If you do Name Input Processing on, say, actor ID 5, you can then do:
Conditional Branch -> Script -> $gameActors.actor(5).name().toLowerCase().includes("zombie")

I used toLowerCase() so you don't have to worry about checking for all different cases, and the player typing "ZoMbiE" will still register as true.
@Andar Thanks for that! Your previous response pointed me to the path of looking for how to convert a variable value to a string value, but I hadn't had a chance to look for that yet.

@Trihan Thanks and sorry about that. I was typing from memory, which is bad, and I used the wrong reference. I did, in fact, use $gameParty.members in my experiments. I didn't want to use anything data related because when I tried doing that, it appears to only take the name that is in the database at the start of the game and not what you change the name to. Which I think was part of what @ATT_Turan was saying.

@ATT_Turan THANKS for mentioning that last part! I was planning on doing different .includes checks to try different variations but doing that toLowerCase() will be so much more efficient and effective!

I will post back here after I finish my experiments so anyone who might look for this same issue will have an example.
If you use $gameParty, then memberneeds to be plural.

JavaScript:
$gameParty.members()[position].name()
If you use $gamePary
If you use $gamePary, then your code won't work 😉

(I know, we all have little typos, it was just too good to pass up!)
I didn't actually notice he'd used member instead of members, or I'd have pointed that out at the time. XD
I actually used it correctly in my experiments, but that is why posting screenshots is more helpful, I know. So you can see exactly what I did instead of what I typed in my explanation and typed it wrong.

Thanks to everyone for helping! @werzaque @Arthran @Trihan @ATT_Turan

Here is what I just tested and it works! I didn't even have to do the JS string conversion thingy.

I will keep experimenting to implement this for the reason I want and not just the test example. I'm not really trying to check for my user name or parts of my user name or anything. That was just a practical example.

It is the concept I am testing. Can I check a Name Input for specific strings? And, with your help, the answer is "YES"!

And I am doing that last conditional branch check because I don't know how to do Show Text using the Script option. So it is easier to just assign a value to a variable and then check that variable value using the Conditional Branch event command I do know how to use.

It took me a bit to figure out how to do the multiple || or checks, but I eventually figured it out.

If you notice any other problems, please point them out!
NameInputCheck.png
And I am doing that last conditional branch check because I don't know how to do Show Text using the Script option.
You could do what I said in Post #8 and put it into the Script field of Conditional Branch instead of a freestanding Script box.

Then you don't need to set a variable and check it separately.

Edit: You can also condense your code a bit, instead of having all the ORs to do the same operation:
Code:
["zombie", "kidz", "rule"].some(word => $gameActors.actor(1).name().toLowerCase().includes(word))
will be true if any of the words listed in the array are in the actor's name.
@ATT_Turan My only reason for not wanting to use the script field in the Conditional Branch event command is because the script is all on one line and it gets hard to see. Unlike using the freestanding script box that allows me to do line returns to see all the text. For this particular concept, I am planning on having quite a few "||" or statements.

I wish the Script Field in the Conditional Branch event command would have a box to make it easier to see. Using that option is my preference.
Well...um...I mean...shrug? 🤣

You could type it out in a text editor then copy and paste it into the Script field.

Or you could type it out as a full JavaScript function, include it as a plugin, then just call that function in the Conditional Branch script field.

Or do it your way and accept that it's a bit less efficient. Whatever pleases you!
If you use $gamePary, then your code won't work 😉

(I know, we all have little typos, it was just too good to pass up!)
Oopsie. I was typing from mobile, and since I use the dark theme, I was able to see my reflection in the screen a little bit. I became momentarily distracted by my own overwhelming handsomeness, and it caused my typing finger to skip a beat.

@ZombieKidzRule
Just to make sure you know, using .includes to test a string will yield true if that combination of characters is present *anywhere* in the string. So testing for "rule" would return true on the name "Macruley". You might already know that, but I just figured that I should mention it, in case it's a bit more aggressive of a testing method than you intended. Even testing for profanity that way could flag some fairly innocuous words.
@Arthran Thanks for that point. I did know that and it was part of what I was testing and experimenting with. And your last statement is spot on because I am planning on using it as a token profanity gauge.

My Game Jam game is not so much a game (yes there is a small story involving Krampus and naughty children) as it is a proof of concept filled with mini games, mini puzzles, and whatnot.

So I am testing and experimenting with a bunch of stuff I might want to use later on and seeing where it goes.

This whole piece started with the simple question of can you put some parameters around allowing the player to input their own name and how does that actually work through Events.

Thanks again! This thread has been incredibly helpful and my ending solution was different from what I thought it would be. But every time I learn something new, it adds value for the future.

Original thread: https://forums.rpgmakerweb.com/threads/simple-question-can-the-actor-name-be-stored-in-a-variable-as-a-string.163392/