[Help] .split() Method Confusion

Status
Not open for further replies.

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
(( Solved ))
-> Turns out I'm either blind or dumb: had 2x versions of the plugin running and forgot to remove the old one.


For some reason I can't convert a parameter into an array, and I'm wondering what I'm doing wrong. So to keep it condense I have the parameter in the comments, (and filled in, in the Plugin Manager in-game), and even confirmed with plugins.js that it does indeed have the contents, when I try something like this:
EDIT: Added screenshots of the header and the function as well for clearer visual than my example below (since it was not meant to be the actual code)

JavaScript:
/*
* @param Currencies
* @default Copper Silver
*/
(function($) {
    $.Param = PluginManager.parameters('LordV_Plugin');
    $.currencies = $.Param['Currencies'].split(" "); 
})(LordV.Plugin)
The log gives me a TypeError can't 'split' from undefined or something like that. So I try putting "String($.Param['Currencies']).split(',');

While that does not give me an error, it also doesn't define anything either. I get:
-> Length = 1
-> $.currencies[0] = undefined
-> $.currencies[1] = undefined

This is confusing to me as to why it's not working... I would appreciate help in this matter since this parameter is required for a function I'm trying to create and test
 

Attachments

Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Is 'LordV_Plugin' definitely what the plugin is called?
 

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
Is 'LordV_Plugin' definitely what the plugin is called?
Well no, and that was just a pseudo-template I whipped up. I'll post some images of the actual plugin
EDIT: Main post updated with the screenshots
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Where are you setting $.currencies?
 

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
Where are you setting $.currencies?
How do you mean? It's set right there in the header (bottom of screenshot) in between:
JavaScript:
(function($) {

})(LordV_EventStorage);
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Ah, sorry. The thumbnail bit covered up part of the screenshot. Let me have a look.

If you put $.Params in the console what does it output?
 
Last edited:

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
with: console.log($.Params)
-> output "[Object]"

with: console.log(JSON.stringify($.Params));
-> output {}

so... it's not getting the parameters at all then. Hmm

EDIT: These are the parameters in the "plugins.js" file for "LordV_EventStorage.js":
{"== Currency Settings ==":"","Currencies":"Copper Silver","Exchange Rate":"100"}
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
What if you just open the console (F8) while in test play and then just type "$.Params"?
 

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
says "undefined"

I tried typing: PluginManager.parameters('LordV_DynamicActors')
// another plugin of mine

and that listed the parameters just fine.. I'm going to try to remove EventStorage; Apply; Save; Save Project; Close project; re-open, and add in the plugin.See if that refreshes it or something

EDIT: Still didn't work.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Is the console showing any errors at all?
 

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
No errors. Just... nothing. It returns as "undefined" if I type it in, and in the stringify version it returns as a blank array {}.

Something curious though.. I renamed the plugin (both the .js file, and inside the script to reflect that). Ran the game... and it's still trying to load the old plugin? (but I confirmed plugins.js had the updated info)
 

Attachments

lordvalinar

Lord of the Damned
Veteran
Joined
Mar 31, 2013
Messages
259
Reaction score
117
First Language
English
Primarily Uses
RMMZ
>_>

Oh. My. God. I'm a moron. Wanna know what it was? lol

I had 2x version of the plugin running (1 was at the top of the order list) *facepalm*
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Haha, it's always the simple things. Is that it working now then?
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,377
Reaction score
8,536
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top