padZero of undefined

Hello, I just want to ask why every time i run a test in event editor (ctrl + r) "Cannot read property 'padZero' of undefined" is always the output.


I'm using the plugin MOG_TimeSystem link: https://atelierrgss.wordpress.com/rmv-time-system/ , Can anyone help me to fix this? Thank you so much 😀


Screen Shot of the output:
3sHyDM.jpg



Here's also the error in console: 
T91acw.jpg



Here i want to test: 
bKlhLg.jpg
First of all is Ctrl+R different from normal playtest? i never used this shortcut


Anyway, apparently the code is tryng to call the property padZero of something but that something is undefined so it has no properties.


I gave a look at the plugin you are using and basically it calls $gameSystem.minute().padZero(2) and $gameSystem.month().padZero(2) and things like that.


So it's calling the function padZero() of the returning value of the function minute() of $gameSystem. Problem is $gameSystem exists (is a basic class of the basic code), but his functions minute() or month() don't. What that probably means is that whoever created the plugin created those functions aswell and put them in another file/plugin, this is also very likely cause you can't download the plugin alone but instead you get a whole pack of files.


What you can do? You can either check the code of every plugin of the pack (i dont' recommend it) or install all the plugin of the pack in you project.


After you installed them you can try to enable one of them one by one (remember if one plugin doesnt' work to disable it before testing anothe one).


Eventually (if the problem is that u miss one of the pack plugins) the problem will go away or it will give a different error, in that case it will mean that the now you have the reference you were looking for but now another one is missing, either from the starting plaugin or the last pluging you enabled. If this happens you have to keep the time plugin and the last plugin u tried both enable and then redo the process of trying to add another pluging testing them one by one. 


If all the needed components are inside that pack, as it should be, eventually the code will work.


This is thorugh though if the Ctrl+R is different from pressing the play button in the editor or is just a shortcut for that, because i have to know the code acts differently
@orcomarcio: CTRL-R is the test event function (right-click on an event command to test that without launching the entire game), it is not a complete playtest - which is why there are problems


@Linard: MOG's time system appearently includes itself into the event commands in a way that it is checked even on simple show text commands, and it requires its data to be set by newgame. Since you didn't even start the game with Ctrl-R there is no wonder that it fails.


The solution is to either disable the plugin for event tests, or start a full playtest. Or request a rewrite from Moghunter for the script to handle itself correctly on event test.
@orcomarcio: For me it's a Quick Test. If you want to Run Quick Test (ctrl + r or right click the specific command and select test), By highlighting what command will you test, Is it good to use aside from a Normal Test IF you want to test the command very quick.


I think the MogTimeSystem plugin is the cause of that error because i try what @Andar said that disable first the plugin if i want to run a test and it works. but any way thanks for your response sir @orcomarcio  😀

@Andar:Thanks 🙂  instead of requesting a new script to Moghunter i will choose disabling the plugin because it has no big affect to my project.  🤘   

Original thread: https://forums.rpgmakerweb.com/threads/padzero-of-undefined.64631/