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).
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).
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()}
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).
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).
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()}