This is less of a complaint and more of a heads up for others using the mod operator when adjusting variables.
I was playing around with some ideas the other day and one of them was to have a dial of numbers you could select from, the dials starts at 0 and as you hit the 'right' key, it would continue to add to the value until you reach 8 and then it would go back to 0.
This happened because:
If: Button Right is pressed down
Control Variables: X +=1
Control Variables: X %=8
If: Button Left is pressed down
Control Variables: X -=1
Control Variables: X %=8
With the mod function subtract 1, mod 8 should produce 7 but does not in RPG maker MV because of JS.
There is a difference between the Mod operator and the Remainder operator, if I had to make this into a request rather than a helpful heads up, I would ask the the game creators add the bit of code at the bottom of my post into RPGMMV to make Mod actually Mod.(Alternatively, they could just change the operator name to 'Rem' for remainder).
This isn't really the fault of anything except for JS, it handles mod as remainder even though they call it Mod.
Here is the code to make it work like mod
I am aware that we can add this in as script, but it would sure be nice if it was just built in.
Thanks!
Kanoonoo(TGK)
(As an alternative solution for those wanting the same functionality as what I was trying to achieve but don't want to mess with code, you can just say:
If: Button Left is pressed down
Control Variables: X -=1
Control Variables: X %=8
If: X = -1
Control Variables: X +=8(Or whatever number you decided to mod by)
I was playing around with some ideas the other day and one of them was to have a dial of numbers you could select from, the dials starts at 0 and as you hit the 'right' key, it would continue to add to the value until you reach 8 and then it would go back to 0.
This happened because:
If: Button Right is pressed down
Control Variables: X +=1
Control Variables: X %=8
If: Button Left is pressed down
Control Variables: X -=1
Control Variables: X %=8
With the mod function subtract 1, mod 8 should produce 7 but does not in RPG maker MV because of JS.
There is a difference between the Mod operator and the Remainder operator, if I had to make this into a request rather than a helpful heads up, I would ask the the game creators add the bit of code at the bottom of my post into RPGMMV to make Mod actually Mod.(Alternatively, they could just change the operator name to 'Rem' for remainder).
This isn't really the fault of anything except for JS, it handles mod as remainder even though they call it Mod.
Here is the code to make it work like mod
I am aware that we can add this in as script, but it would sure be nice if it was just built in.
Thanks!
Kanoonoo(TGK)
(As an alternative solution for those wanting the same functionality as what I was trying to achieve but don't want to mess with code, you can just say:
If: Button Left is pressed down
Control Variables: X -=1
Control Variables: X %=8
If: X = -1
Control Variables: X +=8(Or whatever number you decided to mod by)






