How do I set a script parameter to a variable?

I've had some trouble with this, and I've come to ask about how I should go about it.

For context: I am using ICF-Soft's Parameter scripts to add a stat to the standard stat menu, this "stat" is supposed to be a dynamic level cap, since in the game I am creating, the level cap will increase from time to time.

To try to achieve this, I specifically used a simple script that set a level cap to a variable. If needed, here is the script (if you could even call it one):
Spoiler
Game_Actor.prototype.maLevel = function() {
return $gameVariables.value(20);
};

When I use an NPC to externally set my cap to an arbitrary number such as 1, the script seems to work.

The problem here is that no matter what I tried, whenever I set my variable to a number, the level cap stat did not update. I tried everything I know, even the script call sheet.

Here are some images to (hopefully) show what is happening. Thank's in advance, even if this is probably another thread that has been done before.

imgPARAM.png

Image: ICF-Soft's parameter table, it is supposed to check variable 20's value.

imgGUYLV1NOCAP.png

Image: Character, Level Cap stat is set to 0, this is natural because the variable hasn't been set at all.

imgCAPIS1.png

Image: Using an npc, I changed the level cap variable to 1.


imgLVCAPSTATDIDNTUPD.png

Image: same character, cap has been set to level 1. It had worked due to next level XP being crossed out. But the level cap stat hadn't changed one bit,

or this could be really simple, but i have no clue how to code in javascript lol.
Unless the plugin author coded the parameter to accept a game variable, it won't. You basically have to modify the plugin code to bypass the parameter setting and use $gameVariables.value(x) instead to the function that the value normally gets passed to.
Unless the plugin author coded the parameter to accept a game variable
In this case they actually did - this plugin seems to run eval on all of its numerical parameters.

I've had some trouble with this, and I've come to ask about how I should go about it.

For context: I am using ICF-Soft's Parameter scripts to add a stat to the standard stat menu, this "stat" is supposed to be a dynamic level cap, since in the game I am creating, the level cap will increase from time to time.

To try to achieve this, I specifically used a simple script that set a level cap to a variable. If needed, here is the script (if you could even call it one):
Spoiler
Game_Actor.prototype.maLevel = function() {
return $gameVariables.value(20);
};

When I use an NPC to externally set my cap to an arbitrary number such as 1, the script seems to work.

The problem here is that no matter what I tried, whenever I set my variable to a number, the level cap stat did not update. I tried everything I know, even the script call sheet.

Here are some images to (hopefully) show what is happening. Thank's in advance, even if this is probably another thread that has been done before.

View attachment 284586
Image: ICF-Soft's parameter table, it is supposed to check variable 20's value.

View attachment 284587
Image: Character, Level Cap stat is set to 0, this is natural because the variable hasn't been set at all.

View attachment 284588
Image: Using an npc, I changed the level cap variable to 1.


View attachment 284591
Image: same character, cap has been set to level 1. It had worked due to next level XP being crossed out. But the level cap stat hadn't changed one bit,

or this could be really simple, but i have no clue how to code in javascript lol.
You might want to post this in the plugin's thread, where you're more likely to get the creator's attention. From a cursory glance of the plugin it looks like what you're doing probably should work (though you might want to change 0020 to just 20).
t is supposed to check variable 20's value.
But it doesn't, you told it to use ID 16, or Octal 20

NEVER use leading zeroes in code, because 00 is the programmer's way to switch to octal numbers
and 0020 or octal 20 is decimal 16.

delete the leading zeroes from the code and it should work
I'm surprised no one else noticed this - your first, simple plugin doesn't work because you've misspelled it.

It's maxLevel, not maLevel.
I'm surprised no one else noticed this - your first, simple plugin doesn't work because you've misspelled it.

It's maxLevel, not maLevel.
Oh, that's my mistake. I reviewed the code, and the script had no spelling mistake. Stuff like that happens, sorry.

delete the leading zeroes from the code and it should work
I did what you said to do, but no. It did not work, here's some attached images for reference:

imgCHANGEDSCRIPT.png


imgLV5CAP.png


You basically have to modify the plugin code to bypass the parameter setting and use $gameVariables.value(x) instead to the function that the value normally gets passed to.
Quick question, how would I go about bypassing parameter settings in the code? I have no clue what I'm doing, since I have no prior experience with JavaScript.

Thank's for all the help, though!


EDIT:
I have made the desicion to scrap trying to show the level cap via the status menu. I'll just stick with dialogue menus accessed via key item calling common events. thank you for your help.
but no. It did not work,
then there were two reasons for it not to work - which would explain why it is difficult to find.

basically you would have to repeat the entire bughunt with all options again after removing the teroes, to find what other fix might have done the trick if that second cause wasn't there.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-set-a-script-parameter-to-a-variable.163126/