I'm trying to set and get game variables in MZ, simply trying this:
$gameVariables.setValue(1, 1);
And getting this error:
TypeError
Cannot read property 'match' of undefined
Posting screenshots of the screen and error
How do I do this?
That command should work - how are you calling the common event? Though I don't know why you don't just use the Control Variables command ...
I don't think that error is coming from that command. Please trigger the error again, then hit F8, find the Console tab, and give us a screenshot.
My guess is you've installed a plugin and are missing some notetags or something.
I second what Shaz said. We'll need to see a screenshot of the console in order to get a better idea of what's going on. $gameVariables.setValue doesn't even try to read a match property of anything, so that's not likely your culprit. If $gameVariables.setValue is even related to the problem at all, then it would have to be due to a plugin overwriting the original method with some funny business or another. We can know more once we see the stack trace.
unless you're using a plugin that does something with variables ... like a 'self variables' things.
I figured out the problem. I hadn't first declared the variables in RPG Maker - I was trying to cast and reference a variable that, according to RMMZ didn't exist.
Fixed it - thanks for your help guys.