wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
657
Reaction score
185
First Language
English
Primarily Uses
RMMZ
Here is a question for this plugin:

Would it be at all possible to have some type of script call in a plugin's code that could check a certain switch id's value saved within the "Persistent" File?

The reason I ask is because I am using another plugin that plays a video before the Title Screen, and I want that video to change ever so slightly based on what characters have been seen through any of the saves.

For instance, The intro video plays but all the Party Members you could meet are blacked out, to remove spoilers. However, after Chapter X on any save file, now all 4 party members you have will actually be shown in the intro video.

The problem is that the Intro Video is played before loading a save...
 

DarkWolfInsanity

Retro RPG Recreator
Member
Joined
Mar 26, 2014
Messages
26
Reaction score
7
First Language
English
Here is a question for this plugin:

Would it be at all possible to have some type of script call in a plugin's code that could check a certain switch id's value saved within the "Persistent" File?

The reason I ask is because I am using another plugin that plays a video before the Title Screen, and I want that video to change ever so slightly based on what characters have been seen through any of the saves.

For instance, The intro video plays but all the Party Members you could meet are blacked out, to remove spoilers. However, after Chapter X on any save file, now all 4 party members you have will actually be shown in the intro video.

The problem is that the Intro Video is played before loading a save...
If the video is added due to an event, you can have it play a certain video based on these switches. Set an event page to one of the persistent flags when true and have it play the certain video. Do the same with the other videos.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
Here is a question for this plugin:


Would it be at all possible to have some type of script call in a plugin's code that could check a certain switch id's value saved within the "Persistent" File?


The reason I ask is because I am using another plugin that plays a video before the Title Screen, and I want that video to change ever so slightly based on what characters have been seen through any of the saves.


For instance, The intro video plays but all the Party Members you could meet are blacked out, to remove spoilers. However, after Chapter X on any save file, now all 4 party members you have will actually be shown in the intro video.


The problem is that the Intro Video is played before loading a save...
Sorry for the late reply, I was unaware there were more posts in this thread.


For the most part, you can get the switch/variable's contents from any script by using the standard $gameSwitches.value(id) or $gameVariables.value(id) calls. If you're working in a script that runs before DataManager.createGameObjects() is called, you can try using PersistManager.load(), but there might be other things that won't be initialized yet at that point if DataManager.createGameObjects() hasn't been called.


Simple version: Use $gameSwitches.value(id) or $gameVariables.value(id) to get any switch/variable, persistent or not. If it's not getting the correct values from the persistent data file, putting PersistManager.load() before the line where you check the value might work.
 

cdaz

Villager
Member
Joined
Nov 4, 2015
Messages
22
Reaction score
2
First Language
Thai
I just waiting for this. Than you very much.
 

Firgof

Artist / Designer
Veteran
Joined
Jul 29, 2012
Messages
236
Reaction score
214
First Language
English
Primarily Uses
@Jackkel Dragon Will you update the OP to include formatting with your JS files?  If copy-pasted from the OP the code is one long uninterrupted line and I'm having a lot of trouble re-formatting it.  Couldn't you just attach the JS file to your post instead of putting them in spoiler-tag'd code snippets?


Edit: Seems I've got it functional.  I think; I haven't fully tested it yet.


Right click the link and do a 'save as' to save it to your rig.


View attachment JKL_PersistentData.js
 
Last edited by a moderator:

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I had the code for the JS files in code tags because that would preserve the proper line breaks without needing to find a place to host the file, but it looks like the recent change to how the forums work broke the formatting for the code.


I went and re-copied my base file's code to the v5 code section, so hopefully the line breaks are working again. Unfortunately, anyone who actually wants the older versions might have to mess with the line breaks themselves, as I no longer have a clean version of those JS files.
 

CupcakeValkyrie

Villager
Member
Joined
Nov 7, 2015
Messages
5
Reaction score
0
First Language
English
Every time I try to test my game, I get  "Type Error: undefined is not a function."


I've verified that I copied the code correctly.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
@CupcakeValkyrie Did you make sure the plugin uses the same filename as the one used in the header of the code? If that's not the problem, I'll need more information to know what might be the problem. (Console log of the error, any edits to the base RM .js code, any other plugins in use.)
 

CupcakeValkyrie

Villager
Member
Joined
Nov 7, 2015
Messages
5
Reaction score
0
First Language
English
Code:
TypeError: undefined is not a function
    
    at DataManager.createGameObjects 
 (/C:/Users/CupcakeValkyrie/Documents/Games/Project1/js/plugins/YEP_ItemCore.js:372)
    
    at Function.DataManager.createGameObjects 
 (/C:/Users/CupcakeValkyrie/Documents/Games/Project1/js/plugins/JKL_PersistentData.js:52)
    
    at Function.DataManager.setupNewGame (rpg_managers.js:211)
    
    at Function.DataManager.setupNewGame 
 (/C:/Users/CupcakeValkyrie/Documents/Games/Project1/js/plugins/Kaus_Ultimate_Overlay.js:265)
    
    at Scene_Boot.start (rpg_scenes.js:211)
    
    at Function.SceneManager.updateScene (rpg_managers.js:1668)
    
    at Function.SceneManager.updateMain (rpg_managers.js:1641)
    
    at Function.SceneManager.update (rpg_managers.js:1576)
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
Do you have any more information? Maybe at least a list of plugins and their version numbers? I can't see what the problem would be from the functions mentioned in the log.
 

CupcakeValkyrie

Villager
Member
Joined
Nov 7, 2015
Messages
5
Reaction score
0
First Language
English
jWWWmvi.png



There is a list of all of my plugins and versions.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I have no idea what the problem might be, but putting this plugin (JKL_PersistentData) above the Yanfly Item Core (JKL_ItemCore) in the manager seems to at least let the game run. I'm not sure if everything works properly yet, but it will at least launch the game properly.
 

CupcakeValkyrie

Villager
Member
Joined
Nov 7, 2015
Messages
5
Reaction score
0
First Language
English
Ugh....it works for me too, it seems. Damn...I've been finishing up testing in hopes of releasing a beta of this game next week. Now I have to do a bunch of retesting to see if it's going to cause problems. Here's hoping it doesn't!


Thanks for the help.
 

Jonnah

Villager
Member
Joined
Apr 23, 2016
Messages
9
Reaction score
0
Primarily Uses
N/A
The 'undefined is not a function' still hasn't been fixed yet? I'd love to use this plugin but I can't put it over Yanfly's plugins as this might cause issues.
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
After some testing, it may be possible to make it work by changing this line like so:


var _DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
_DataManager_createGameObjects();
PersistManager.load();
};

// Changed to:

var _DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
_DataManager_createGameObjects.call(this);
PersistManager.load();
};


As far as I can tell, the problem is that the item core and my plugin try to overwrite the same function, and so Yanfly's plugin is trying to make mine do something it doesn't understand (or vice versa? Not sure which way it is, it's just not both since it could be fixed by repositioning the plugin priority.) Not sure why making a call to the overwritten function rather than just executing it would fix the problem, but it worked for me.


If this works, I'll probably update the main code to v6 and modify this line in the codedump. Let me know how it goes.
 

Tr4sh-C4n

The garbage of love
Veteran
Joined
Jun 12, 2016
Messages
48
Reaction score
15
First Language
French
Primarily Uses
N/A
Heya Jackkel. Your plugin is helping me alot though my project, but somehow I'm having troubles with your plugin, especially the V5, whenever I turn it on, it makes my game lag like hell... I don't know what else I can do to describe my problem so here is all the plugins i'm using at the time :


Plugins.png
 

Jackkel Dragon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
48
Reaction score
24
First Language
English
Primarily Uses
RMMV
I'm not sure what the problem might be at the moment, though maybe I can see if I can replicate it when I have some time. Off the top of my head, does this problem occur even if persistent data is the only active plugin (aside from ones needed to make custom code run)? Do you have any parallel process events or plugins that change switches/variables constantly? If you have a lot of variable/switch changes in a short period of time, you may want to turn off the "Save when Set" parameters and use the plugin commands to manually save the persistent data when desired. Otherwise, your game may be trying to run a bunch of redundant persistent save functions, which could end up slowing the framerate on processors not ready for that kind of load. (If you know how to use the console, adding a line to the save function for the persistent data manager to output to the log could help you track when it gets called.) Example code:


PersistManager.save = function() {
console.log ( 'Saving persisent data.' );
StorageManager.save("Persistent", JSON.stringify(this.makeData()));
};


If the line pops up in the log a whole lot in a short span of time (sometimes log messages stack, so check the number next to it too), the auto-saving is probably the problem and you'll want to turn off the "Save when Set" parameters.
 

Zephyrim

Villager
Member
Joined
Dec 23, 2016
Messages
8
Reaction score
0
First Language
English
Primarily Uses
Hiya! I've had this problem with a previous project of mine (Which I tried to use this in), and now it's reappeared when I've tried to run a new project with this plugin also. I get the "TypeError: undefined is not a function" thingy at the loading screen, but it goes away as soon as I turn this plugin off... I'm using V5 and have a bunch of other plugins, too. It says there are errors with some other plugins, but I never get a TypeError popping up when they're on without your one... Any ideas what's going wrong? I can provide extra info if needed :)

Edit: Okay, so I was experimenting, and it works fine when ONLY YEP_ItemCore is off, so I'm assuming that this one and that clash somehow...?


Plugins.PNG


Capture.PNG
 
Last edited by a moderator:

Hikitsune-Red

火狐 - Red =^~^=
Veteran
Joined
Mar 22, 2015
Messages
157
Reaction score
107
First Language
English
Primarily Uses
Hiya! I've had this problem with a previous project of mine (Which I tried to use this in), and now it's reappeared when I've tried to run a new project with this plugin also. I get the "TypeError: undefined is not a function" thingy at the loading screen, but it goes away as soon as I turn this plugin off... I'm using V5 and have a bunch of other plugins, too. It says there are errors with some other plugins, but I never get a TypeError popping up when they're on without your one... Any ideas what's going wrong? I can provide extra info if needed :)


View attachment 56363


View attachment 56364



Hey, @Zephyrim, I'm going to point you to Yanfly's Plug-In list first.


I happened to pass this thread and noticed your post here, but before you start investigating what may be wrong with this Plug-In, it would be beneficial for you to first fix your Plug-In order with Yanfly's things.


Yanfly's Plug-Ins do need to be in a specific order in order for them to work, the order in which they show up on this page here is the order all of those YEP Plug-Ins need to be in. You'd be surprised how many issues this can fix.


Then, make sure all Plug-Ins that are not YEP are loaded either before, or after the YEP Plug-Ins (preferably after, but some only work if placed higher on the list), unless their documentation says otherwise.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Our water started to work again, now i don't have to fill up our toilet with water again.
Finally able to return to work after months of lockdown. My poor feet are hurting :( I need to get used to working again haha
My birthday was yesterday and tomorrow marks the day my grandpa died around 5-6 years ago. I think about him a lot, and surprisingly had grown to become interested in programming- something he'd done for a living among other things. Funny how life works. I'm just glad I was able to enjoy yesterday with my immediate family. Anyway- guess who's 9 + 10?
Sometimes I don't understand my life LOL :3

Forum statistics

Threads
108,874
Messages
1,040,212
Members
141,310
Latest member
Lee117
Top