MZ Using a variable in Hakuen Studios Self Variable Plugin Command

Okay, been banging my head against this for a couple hours now. All the get methods seem to work fine, but the set method is having a real hard time using my variable for the event ID:

1732433033172.png


I looked through the demo project and all of the documentation and I don't think there are any instances of a variable being use in this one place, though that may just be me not understanding what I was looking at. @Eliaquim any ideas?

Edit before anyone responds: I also tried doing it in script, and just like with the Plugin Command it seems to get the data just fine, and it can set with a static value, but this one thing doesn't want to work.
You can't normally put in script calls in plugin commands. There are plugins that let you do it like NRP Eval Plugin Command. Sometimes a plugin command will take an escape code like \V[1] depending on the programmer but I don't think Eli is one of them.
You can't normally put in script calls in plugin commands. There are plugins that let you do it like NRP Eval Plugin Command. Sometimes a plugin command will take an escape code like \V[1] depending on the programmer but I don't think Eli is one of them.
Yes, but as I said, I also tried to do it in a Script command, and the get method works if I use variables but the set method does not.
You're just restating the same thing. What script call are you using and what does it show in the console log when you call it?
1732472467460.png


Top one works, bottom one does not.
What happens if you copy and paste that second line into the console and hit enter?
What happens if you copy and paste that second line into the console and hit enter?
1732475391387.png

I did not know you could do that!
I can't look at the plugin file right now but are you sure setSelfValue is a method of $gameVariables objects and not of game events?
I can't look at the plugin file right now but are you sure setSelfValue is a method of $gameVariables objects and not of game events?
1732476166800.png


Yep, here's a shot of the readme if that helps.
View attachment 323772

Yep, here's a shot of the readme if that helps.
I would try running the second line in the console log again then the first line to check whether the second script worked or not. Sometimes the undefined error is a false negative and it did go through.
Top one works, bottom one does not.
I would check that variable 1 actually holds a value and holds the value you want to use, because that syntax is correct. Try console logging that.

Sometimes the undefined error is a false negative and it did go through.
That's not what undefined in the console like that means.

When you manually enter a function call, the console will respond with the return value of that function.

As this function (like many others) does not return a value, the response will be undefined.

You'd see the same thing with probably the majority of methods in RPG Maker.

1732486869544.png


If the function didn't exist, you'd see a syntax error, but there's often no way to know just from a console line whether you're passing in a valid argument. You'd have to look at the actual code.

(However, if this function is expecting an event ID, obviously a game variable that holds a numeric value will be a valid argument, so the problem isn't on that side)
I would check that variable 1 actually holds a value and holds the value you want to use
The OP's gameVariable 1 has to be holding an integer value because the first script worked. Whether or not it's the value the OP meant to use is another story entirely.

Also didn't know that about the "undefined" error, I always thought it was a weird quirk
The OP's gameVariable 1 has to be holding an integer value because the first script worked. Whether or not it's the value the OP meant to use is another story entirely.
Yes...my point is that once you're at the code level, the function you're calling doesn't know the difference between you doing
Code:
FunctionCall(5)
and
Code:
FunctionCall($gameVariables.value(22))

so the troubleshooting would not be "passing in a static value vs. a variable," but - as you say - that the variable contains the intended value. Especially since we've seen many cases of people having problems because a plugin is set to use variable 1 and they don't realize it.
Okay, been banging my head against this for a couple hours now. All the get methods seem to work fine, but the set method is having a real hard time using my variable for the event ID:

View attachment 323733

I looked through the demo project and all of the documentation and I don't think there are any instances of a variable being use in this one place, though that may just be me not understanding what I was looking at. @Eliaquim any ideas?

Edit before anyone responds: I also tried doing it in script, and just like with the Plugin Command it seems to get the data just fine, and it can set with a static value, but this one thing doesn't want to work.
Hi there!

The only argument that accepts formula or variable is the Value argument. That is why you are not being able to use this formula on the event id.
Also, the Operation Type is set to Sub. Which means it will subtract the Value of the Self Variable Id 5, and not exactly Set it to 20.
Hi there!

The only argument that accepts formula or variable is the Value argument. That is why you are not being able to use this formula on the event id.
Also, the Operation Type is set to Sub. Which means it will subtract the Value of the Self Variable Id 5, and not exactly Set it to 20.
I figured it simply wasn't compatible, seeing as how I felt like I tried everything. Good to know though, thanks for responding!

Original thread: https://forums.rpgmakerweb.com/threads/using-a-variable-in-hakuen-studios-self-variable-plugin-command.173429/