Having trouble using variables with custom commands and database records.

MysteryMan23

Veteran
Veteran
Joined
Apr 2, 2012
Messages
121
Reaction score
34
First Language
English
Primarily Uses
RMMV
Hi! I've created a new database record, and a custom command that uses it. Everything works when I do a direct assignment; however, when I use a variable to assign the custom record, it crashes the game.

My code for assigning the value in question is: value = RecordManager.newDataType[@interpreter.stringValueOf(@params.name)]
I have a feeling this is where the mistake lies, as the crash happens when "value" is referenced, and it is referred to as "undefined" by the error message. In other words, the code is failing to assign "value" when I use a variable. So I know I'm doing something wrong here. The question is, what do I do instead to get what I want?

UPDATE: So, I'm having what seems to be a rather similar problem here with backgrounds. I try to update a background with a direct assignment, it works. Do it with a variable, and it fails. You can even get the resource name of the current background, and try to change to that background, and the background will disappear! If these two problems are related, that's a pretty nasty bug.

UPDATE 2: Okay, so I discovered that the variable button is sending an object into the script that contains the name of the variable rather than it's value. Since the name of the variable doesn't match anything in the gam (or if it does, it's most likely the wrong object), the resulting is an undefined item rather than the expected object. It's pretty clear that this is a bug. It affects, backgrounds, pictures, music, and presumably anything that uses a string to determine what to use. I don't know if there's a workaround yet, unfortunately; this seems like an editor-level bug.
 
Last edited:

MysteryMan23

Veteran
Veteran
Joined
Apr 2, 2012
Messages
121
Reaction score
34
First Language
English
Primarily Uses
RMMV
Okay, so normally, I wouldn't consider bumping this, but this bug is a real problem for my project. I have multiple points at which the game should reference a variable to determine which resource to use, and this bug keeps me from doing that. Unless I can find a workaround, this project's on hold until this bug is fixed.

UPDATE: Okay, I found something. It seems that when I assign the value directly, it gets sent in as a uid, which is what the game actually expects. When I assign via a string variable, though, it gets sent in as an object of some sort instead, throwing the whole thing out of whack. So, if I can find a way to send the uid properly, this bug might actually be fixable!

UPDATE 2: So, um, apparently this bug doesn't affect pictures. It does affect backgrounds, though. And music. And, apparently, my custom data records. In all three cases, the variable button sends something different than direct assignment would, and thus causes undefined results. If a way could be found to trap said bad data, and use it to find the expected value, a workaround for this bug could definitely be found! Any insights on this front, now's the time!

FINAL UPDATE: Okay, so I finally managed to find a workaround in regards to my custom records. Basically, I made it so that if the normal search-by-parameter failed to find anything, I'd implement an alternative method that worked with the data that actually got sent in. I might be able to patch backgrounds and music using similar methods, so yay!

Sorry for making so many topics. I must be like, the guy who cried bug here. :rswt Thanks for putting up with me!
 
Last edited:

Latest Threads

Latest Profile Posts

Fire-Emblem Style Level Up System, Boost on Class Change, And Animated Arrows | RPG Maker News #115

Why keyboards don't sleep? Because they have two shifts.
I realized a while ago my game was toooo big in scope. even now I wonder am I trying to do too much by myself. and that's after completely changing the format of the game.
Last week at SLC. Cali awaits. TBH I love SLC more than SF.
Back home now. I had a good time, but I had a checkup this morning so I had to come home for that. Now I'm just waiting for my therapist meeting tomorrow...
Decided to work on Wishful Wanda today. Since it's a BFB spinoff game, I decided to make the Huang brothers
Easter eggs! I'm actually pitching this to the BFDI team, btw.

Forum statistics

Threads
113,932
Messages
1,078,513
Members
148,044
Latest member
Sernyx
Top