MV Script breaks after title is changed...

Hey, all!
So, I'm having a bit of a problem- while making a script using one of SRD's scripts as a base, when I try to change the name plugin name within the code to match the new filename, the whole script breaks, and gives me a 'cannot read property 'match' of undefined' error. I'm aware that the obvious answer here is 'well then just don't do that', but I want to be able to differentiate between this code and the original variant. It shows up just fine in the plugin manager. Any suggestions?

var p = PluginManager.parameters("SRD_PKM_TrainerSprite"); <this works just fine in the original file, but not in this variant
var p = PluginManager.parameters("Enby_PKM_Trainer_Select"); <This is with the edited filename, but it doesn't work
\\ var p = PluginManager.parameters("Enby_PKM_Trainer_Select"); <neither does this but it at least doesn't crash the game
the cause of the problem is that the plugin filename becomes part of the variable name for the properties and data structure. So you'll find the plugin name used inside the script file as well.
It is possible to change that, but that would require you to be able to read and adapt the code - and from the way you're asking I'm assuming that you are rather inexperienced in the programming area.
And SRD's plugins are using rather advanced programming techniques in several areas, so I doubt you'll be able to change them without causing other errors.

Your best bet would be to publish your changes (and the changes only, SRD forbids plugin reposting) together with a link to SRD's plugin page for that plugin into the javascript section, explaining what you want to change and asking help for doing it.
I'm not sure what you're talking about regarding not changing the script file, that's what's I'm doing here. If the line containing the call to PluginManager is commented out, then the script does not crash. Unmodified it works, and I have tried just changing the file name and reference in the code with no success.

I am assuming that there's somewhere else besides the plugin.js file (named Enby_PKM_Trainer_Select.js in this case, with that name referenced to the PluginManager.parameters function) that the names aren't matching up. The error suggests that it's undefined, so it doesn't seem like it can find Enby_PKM_Trainer_Select to pull the parameters despite it existing in the plugin manager and as a file in the js/plugins folder.

I've checked everything in the plugin js file, there isn't anywhere else that it's using the filename after assigning it to var p.
Moved to: Learning Javascript


Is your plugin called Trainer_Select or TrainerSelect?

Please show a screenshot of the console when the error occurs. The error does not come from the line you've highlighted, and because that's all you've given us, we can't tell whether the plugin name has anything to do with the error at all. I assume you have made significant changes to the plugin and not just changed the name.
I found the problem and resolved it, it was being picky on what data type parameters were being passed in as.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/script-breaks-after-title-is-changed.133339/