Status
Not open for further replies.

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
130
Reaction score
94
First Language
English
Primarily Uses
RMMZ
Since I got MZ before getting MV, my plugins are written with MZ in mind, and the bigger the plugins get, the more likely that they CAN'T work with MV. Is there a good way to detect if a plugin is being used in one over the other? I figure the most obvious way is to try calling a function native to MZ, and deciding MV is being used if that fails... but I'd like something a bit less... random-looking? A dev who doesn't look at the code wouldn't notice or care, but a fellow code monkey might be wondering why a ColorManager call(for example) was being tried when there was nothing in the plugin dealing with colors.

Basically I'd like to make all my plugins compatible with both engines without having to code and release a separate version. Ideally I'd detect the engine at startup, have MV and MZ versions of functions with exclusive code, and call the right one based on the engine detected.

Kinda got inspired by reading up on FOSSIL, and thought about doing pretty much the reverse, "retro-proofing" my plugins.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,927
Reaction score
1,393
First Language
Portuguese - Br
Primarily Uses
RMMZ
I wish I had this approach before =/
Anyway, you can use the Utils for both: In one engine it will return "MV" in another "MZ".
JavaScript:
if(Utils.RPGMAKER_NAME === "MV"){
// Do MV code
}else{
// Do MZ code
}
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
130
Reaction score
94
First Language
English
Primarily Uses
RMMZ
I wish I had this approach before =/
Anyway, you can use the Utils for both: In one engine it will return "MV" in another "MZ".
JavaScript:
if(Utils.RPGMAKER_NAME === "MV"){
// Do MV code
}else{
// Do MZ code
}
Awesome, that is EXACTLY what I needed! I'd already gotten the "ColorManager" version working, and along the way discovered I was using try... catch... wrong. MZ didn't care, but MV threw an absolute fit over it. Oh well, I already needed to rewrite parts of my TP Control plugin if I was gonna retro-proof it, I just need to remember to update all the try... catch... code in there while I'm at it.

...also means I need to start studying MV's code as I work on retro-proofing what I have... and as I work on stuff in the future, since I DO eventually want to start working on scenes and such. And I had just started getting a glimmer of hope that I was figuring MZ out.... :dizzy:

Thanks!
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
636
Reaction score
552
First Language
English
Primarily Uses
RMMV
Awesome, that is EXACTLY what I needed! I'd already gotten the "ColorManager" version working, and along the way discovered I was using try... catch... wrong. MZ didn't care, but MV threw an absolute fit over it. Oh well, I already needed to rewrite parts of my TP Control plugin if I was gonna retro-proof it, I just need to remember to update all the try... catch... code in there while I'm at it.

...also means I need to start studying MV's code as I work on retro-proofing what I have... and as I work on stuff in the future, since I DO eventually want to start working on scenes and such. And I had just started getting a glimmer of hope that I was figuring MZ out.... :dizzy:

Thanks!

My advice is to open up notepad++, put the rmmv version on the left tab, the rmmz on the right tab, and cross your eyes so you look at both version at once :p
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
130
Reaction score
94
First Language
English
Primarily Uses
RMMZ
My advice is to open up notepad++, put the rmmv version on the left tab, the rmmz on the right tab, and cross your eyes so you look at both version at once :p
I use Visual Studio Code. Could potential still do it that way, but I think the easier option is to try to run my plugins in MV, see what breaks, and chase it down. Right now it's all simple stuff, and the only strict incompatibility I'm aware of in my plugins all involve ColorManager. So if I want to make a retro-proofing plugin like a reverse FOSSIL, that'd be the first place to start. Which I think I might start doing now... the idea has wormed into my brain. This is gonna be a long, hard, frustrating ride.... and I don't think I could come up with as creative a name as FOSSIL....
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,000
Reaction score
5,635
First Language
English
Primarily Uses
RMVXA

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.

Latest Threads

Latest Posts

Latest Profile Posts

Just finished my first Slip into Ruby since last July! It'll be up and added to the main post tomorrow, along with a new Jump into Javascript.
to pass the time.pngTesting out making boxes and packs of items. These things are always fun to do.
Rural Japan Tiles, Giant Dragon Sprite, Paint Icons? & Game Spicy Pixel Fonts | RPG Maker News #31

just hopped into project recruitment... hoping to maybe find some artists to help with parallax maps and whatnot. I could do them myself, but I'm not really good at it so I'd prefer to stick to my strengths which is character art and SOME UI elements.

Forum statistics

Threads
111,099
Messages
1,058,278
Members
144,304
Latest member
Wolfspace
Top