MV JS Calc & Plugin Help

Hey RMMV Community! Got a question for ya.

My JS isn't great, but I can usually muddle through whatever it is I'm trying to do... but this one is beyond me. (& yes, I've already searched these forums & have spent a good while pouring thru "Google searches").

I use Pheonix KageDesu's Map Inventory plugin for the game I'm currently working, bc it utilizes a handy inventory / wt management system, & also offers a nice client-side chest storage system (e.g. so players can store things someplace other than their on-person inventory). Anyway... I am also using SumRndmDde's HUD maker. With these 2 combined, I've added a nice little visual display of how much weight a player is hauling around (see the img below).
Inv Wt Demo.png


It all works great, except for when I start adding a bunch of items that have a 0.1 wt to them. Up to a point, the Inv system will calculate the wt values with a max decimal pt of 1, (as shown in the pic), but for some reason, some inv items cause the wt calc to add a ton of decimal points (see screenshot below).
Inv Wt Demo 2.png


The max wt has no affect on this occurrence, nor the item I assign a notebox-tag 0.1 wt on (e.g. I've tried changing the wt of diff items in my database to 0.1, & this phenomenon occurs randomly, regardless of the item). I know the "easy" solution is to just change my item database to use only whole numbers, but I'd really like to try & use decimals, if possible; no 1/100'ths stuff (e.g. 0.01), just 1/10ths (e.g. 0.1). Also, this doesn't seem to have anything to do with how much gold a player has, as I've tried it with both no gold & various amounts, but it still happens, so it isn't due to some screwy gold calc at least.

I know that I could keep this from happening with typical math calculations (e.g. ceil, round, floor, etc.), but since I'm using a plugin, & am using a script call to pull the wt calc info (see below), I'm not sure how to fix this, short of editing the plugin itself, which I don't think I have the skill for. Lastly as this is a paid plugin, I can't post the version of the plugin I have, but you can download KD's free plugin from his website (linked above) to see if you can find what I need to do to adjust this. TIA

If it helps, the script call I use to pull the player's current wt is: GetCurrentWeight()
And in SRD's HUD Maker, I have it entered as: ${GetCurrentWeight()} / ${GetMaxWeight()}
Hey,

Since you are using a script call anyway to get the weight in the HUD Maker, you probably should be able to add your rounding to that:
${Math.round(10 * GetCurrentWeight()) / 10}
or
${GetCurrentWeight().toFixed(1)}

A lot of fractions like 1/10 need rounding when stored as a binary decimal number, and adding many of them together can make the rounding error big enough to be visible in the output display.
Funny thing is I briefly thot about using the ".toFixed" option, but assumed it wouldn't work as most JS "shortcuts" I've tried in MV have not ended well for me, lol. That said, that was the first thing (first of your suggestions) I tried & it worked. Go fig (it was something simple). LOL
Thx for your suggestion @Another Fen. It is greatly appreciated.

**Edit**
I did try the rounding, but forgot to do the whole (10 * code()) / 10) thing. Instead, I just did (math.round(code()) & that didn't work, so I stopped pursuing that option. Maybe you could explain that. Why does it have to be formatted that way; e.g. having to add the math that is just taken away at the end, in order to work, vs just typing it up as (math.round(code())? Does the JS need more numbers to realize the inserted code is math? lol

Thx. (you can lock this thread Admins).

Original thread: https://forums.rpgmakerweb.com/threads/js-calc-plugin-help.150086/