Found this bit of code inside Rpg_windows. My little knowledge tells me I'm sniffing the right place.
Window_NumberInput.prototype.changeDigit = function(up) {
var index = this.index();
var place = Math.pow(10, this._maxDigits - 1 - index);
var n = Math.floor(this._number / place) % 10;
this._number -= n * place;
if (up) {
n = (n + 1) % 10;
} else {
n = (n + 9) % 10;
}
this._number += n * place;
this.refresh();
SoundManager.playCursor();
};
Maybe I could hard code the point into the window, in a fixed position and use the integer value for the comparisons later.
while that is only 1 bit of the full code I think, you need to place 10 to 11,
but also code a way to set the "comma" or "period" to be selected.
this can require some coding to read this though.
I use input form that can use any characters, so a conditional brach would be needed
to check either actor or string to see if it's correct, it uses a css file, but not yet been able
to recolor it or modify the look.
other than that, it works perfectly smoothly.
I realized the input comes as a string, so I tried messin about the plugin to have it as float but I haven't got enough knowledge to do that.
Then I tried making the decimal with the "correct answer" a string. Instead of
$gameVariables._data[1] = 0.04;
I used
$gameVariables._data[1] = '0.04';
To check and it works!
I still feel there's more to it, though.
I am, at this point, going to defer to the more incredibly talented js scriptors of this forum. But, essentially, I think you could use this clumsy approach-
Using page 3 script command
define one js variable, e.g. jsVar1, to be a random number between 0 and 1 using the math.random function, multiply that by 10 or 100 or however many integers you want, truncate the trailing digits to however many digits you want, using js num.toFixed(2) where 2 is the number of digits you want. Assign that number to the variable using $gameVariables._data[1]=jsVar1
define a second js variable, e.g. jsVar2, to be another random number between 0 and 1 and do the same things to get your desired second number, $gameVariables._data[2]=jsVar2
Continue the script by adding a third js variable, e.g. jsVar3 to be the correct answer
var jsVar1=$gameVariables.value(1);
varjsVar2=$gameVariables.value(2);
varjsVar3=jsVar1+jsVar2;
$gameVariables._data[3]=jsVar3;
$gameVariables.setValue(3,jsVar3);
Again using page 3 script command, but a second event,
For the inputted answer, you would extract the answer captured using Buid's js, which I'm pretty sure is stored as a string, so use the text to string js function parseFloat("X")
Assuming you are storing the user answer in variable 5, it would be
var jsVar=$gameVariables.value(5);
var jsVar5=parseFloat(jsVar);
$gameVariables.data[5]=jsVar4;
and finally, for the 3rd event, you would compare variable(5) with variable(3)
I haven't tested this, but I'll see if I can put together a working event page.
Truly, though, I am going to bet (and hope) that someone else is going to jump in with a much more elegant solution. My js knowledge is truly of the absolute novice level.
I think kids need to be able to see the original problem to see why their answer was right or wrong. Heck, even as an adult, I don't always trust my memory. A picture does persist, so I use pictures. MZ has a great plugin called textpicture which will show your text as a picture. I don't see an equivalent for MV, but I'm sure you could probably use one of the HUD plugins.
if you need testing, I can help you out 🙂