Changing parameters in plugin with a script call?

Hello! I was wondering if changing the parameters in the plugins command is possible?
I'll provide an example of "SumRndmDde's Picture Choice" plugin here http://sumrndm.site/picture-choices/

21dmz52.png


I want to know if it is possible to change the value within the red box via script call? Maybe I want to try making a separate picture choice with each having different Max Scale or something.

Thank you very much!
Hello! I was wondering if changing the parameters in the plugins command is possible?
Changing plugin parameters would be possible only if it was defined. There is no such thing though, however you can change the values of the variables these things are stored in.
In this particular case it is
_.min
_.max
_.speed
_.confirm
_.close
Set these to whatever you want through script command.
Changing plugin parameters would be possible only if it was defined. There is no such thing though, however you can change the values of the variables these things are stored in.
In this particular case it is
_.min
_.max
_.speed
_.confirm
_.close
Set these to whatever you want through script command.

Thank you for your help! By the ways, are you suggesting me to rewrite something like...
_.max = parseFloat(params['Max Scale']); to _.max = $gameVariables.setValue(var, value) or whatever

or

_.max = parseFloat(params['Max Scale']); to $gameVariables.setValue(var, value) = parseFloat(params['Max Scale']);

I tried both but it didn't work.
No wonder it doesn't work.
$gameVariables.setValue is a function that sets a variable x to value y. It has no return command, so saying _min = $gameVariables.setValue (x,y) will throw you nothing at all.
You could do $gameVariables.setValue (x,y) and on a new line _min = $gameVariables.value (x). But assigning setValue a non-returning function to a variable is useless.
Or you can just do
_min = 0.8

Wouldn't be a bad idea to learn some javascript 😛
Have you thought about the issues with this?

If you change the parameters of a plugin via a script call, that doesn't mean those parameters are going to be used - most plugins read the parameters when the game is loaded and not again. So you'd be modifying them after they've been used.

If the plugin reads the parameters into a variable and you change the variable, save and close the game, then open the game again, they're going to be back to their original values, as the variables don't get saved.

If you change the variables then start a new game, or load a saved game, those variables will remain at what you changed them to - it would be difficult to leave them as the original values for all games up to a certain point, and then change them to new values after that point, so any one game will have them set correctly based on whether that point has been reached or not.
There are no issues if you do it through changing the variable only. These parameters are used in a function whenever it is called, so you can feel the change.

Of course if you changed the file's params saved in plugins.js, that would mean issues.

EDIT: Ah yes, that is true, if you reload the game, you have to remake the changes. But if you make a change right in front of what you want to call, then no issues.
Oh! I forgot to mention about how it didn't work. When I used _.min = xxx via script call, I just got the message that said "_ is not defined"
And that applied to the new method you suggested as well.
Oh my bad 😀 I overlooked something.

It is inside an anonymous function. So these variables aren't defined outside of it. So it looks like without any changes to the code it won't be possible.
However, it shouldn't be too difficult to tinker with it.
You can try to replace
Code:
(function(_) {
   
"use strict";

var params = PluginManager.parameters('SRD_PictureChoices');

//-----------------------------------------------------------------------------
// SRD.PictureChoices
//-----------------------------------------------------------------------------

_.min = parseFloat(params['Min Scale']);
_.max = parseFloat(params['Max Scale']);
_.speed = parseFloat(params['Scaling Speed']);
_.confirm = parseFloat(params['Confirm Speed']);
_.close = parseFloat(params['Close Speed']);

with
Code:
srdPC = 0;
(function(_) {
   
"use strict";

var params = PluginManager.parameters('SRD_PictureChoices');

//-----------------------------------------------------------------------------
// SRD.PictureChoices
//-----------------------------------------------------------------------------

srdPC.min = parseFloat(params['Min Scale']);
srdPC.max = parseFloat(params['Max Scale']);
srdPC.speed = parseFloat(params['Scaling Speed']);
srdPC.confirm = parseFloat(params['Confirm Speed']);
srdPC.close = parseFloat(params['Close Speed']);
and replace the _.min, _.max etc. with srdPC.min, srdPC.max etc.
Use on your own danger, I'm not sure what kinds of bugs will this create. However, since srdPC is defined as a global variable, it should reduce risks of creating bugs that are impossible to deal with to a minimum due to accessibility from anywhere, even the script field.
Oh my bad 😀 I overlooked something.

It is inside an anonymous function. So these variables aren't defined outside of it. So it looks like without any changes to the code it won't be possible.
However, it shouldn't be too difficult to tinker with it.
You can try to replace
Code:
(function(_) {
  
"use strict";

var params = PluginManager.parameters('SRD_PictureChoices');

//-----------------------------------------------------------------------------
// SRD.PictureChoices
//-----------------------------------------------------------------------------

_.min = parseFloat(params['Min Scale']);
_.max = parseFloat(params['Max Scale']);
_.speed = parseFloat(params['Scaling Speed']);
_.confirm = parseFloat(params['Confirm Speed']);
_.close = parseFloat(params['Close Speed']);

with
Code:
srdPC = 0;
(function(_) {
  
"use strict";

var params = PluginManager.parameters('SRD_PictureChoices');

//-----------------------------------------------------------------------------
// SRD.PictureChoices
//-----------------------------------------------------------------------------

srdPC.min = parseFloat(params['Min Scale']);
srdPC.max = parseFloat(params['Max Scale']);
srdPC.speed = parseFloat(params['Scaling Speed']);
srdPC.confirm = parseFloat(params['Confirm Speed']);
srdPC.close = parseFloat(params['Close Speed']);
and replace the _.min, _.max etc. with srdPC.min, srdPC.max etc.
Use on your own danger, I'm not sure what kinds of bugs will this create. However, since srdPC is defined as a global variable, it should reduce risks of creating bugs that are impossible to deal with to a minimum due to accessibility from anywhere, even the script field.

Thank you very much for pointing this out! But, srdPC didn't work for some reason. It is still not defined. However, it guided me to blindly try to change the _ and srdPC to something else. And it just accidentally worked with SRD.PictureChoices.xxx (I just guessed it since it is the full name of your srdPC and I just saw the name below var params = PluginManager.parameters('SRD_PictureChoices');)

Thank you again for your help!
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/changing-parameters-in-plugin-with-a-script-call.88001/