Weird behavior with high stock amountsFixed

this keeps locking up the machine with out of stock and stays like that its set to 1000000 amount and low pop server shouldnt be a problem.

just wont change off out of stock tried re loading its just doing nothing i cant fix it im normally good with this but this wont do anything.

Which vending machine(s) and item(s) are you seeing this issue with?

Can you share the oxide/data/CustomVendingSetup.json data file so that I can try to reproduce the issue?

its the oupost wood and stone sale machine. lets say i set the max stock to 10000 then it will show out of stock on the whole vending exept the top one even if i only edit 1 item. if i the change it to 100000 it fixes it. then if i add another 0 making it 1000000 it brakes it again showing out of stock bit the top one is fine the whole time. this is only happening to thew other 5

Thanks for the info. I will try to reproduce some time in the next 8 hours.

From the sound of it, this might have something to do with the fact that multiple items have the same currency type in that vending machine. The logic for that case is buggy in vanilla so the plugin works slightly differently for that case, which might be contributing to this issue (or maybe it's due to the vanilla logic but never manifests since these amounts do not appear in vanilla). Depending on what the root cause turns out to be, I might alter the initial stocking logic to match vanilla exactly.

Merged post

I just tested and could not reproduce the issue you described. I tried changing the "500 wood for 150 stone" Max Stock to 10000, clicked save, and none of the sale orders showed out of stock. I tried many other values such as 100, 1000, and 100000. I tried this for various other sale orders in the same machine, individually and in combination. I also checked the vending map marker to see how much was stocked, and the amounts were as I had configured them.

i have 1000 stone 50 scrap, 1000 wood 20 scrap, 250 metal 25, 15k stone 10k wood, 50k wood 10k stone, 20 lgf 10 scrap, 100 diesel 300 lgf i should have said befor im sorry.

Merged post

ok if i edit 50k wood 10kstone from 100000 to 1000000 it happenes

Thanks for the info. I reproduced this issue. It happens due to integer overflow. That means, the computer cannot handle that large of a number, so it rolls over to a negative number, and then the plugin logic doesn't add the item because it's specifically coded not to add negative amounts of items. 10k times 1mil equals 10 billion, which is higher than a 32-bit integer can hold (roughly 2 billion).

I doubt you intended to stock billions of items, so I think the misunderstanding here is how the Max Stock value works. The max stock is not the actual amount of the item that will be stocked, it's the max number of purchases to stock. If you sell a stack of 10k, setting max stock to 10 will stock up to 100k items. This design is intentional because it's how vanilla works and it reduces the likelihood that server owners need to edit the max stock value after simply changing the stack amount sold.

I realized that people might misunderstand this setting while I was developing the feature, but ultimately I did not come up with a more intuitive name to convey the meaning. Instead, I simply hoped that people would either think about it or test it and realize how it works. For example, if you notice that the default wood is 500, and the default max stock is 10, you might wonder how more than 10 wood is being stocked, but once you see that 5000 is stocked on the map marker, it would become pretty obvious.

im lost i just want it not to run out i set mine to 1 and can still but lots of stone the standard outpost purchase is 1000 stone  for 50 scrap so i can but 1000 stone and it should lock but it doesnt. also i can see 2116524 in the map stock but ive set both to 1 and can but lots but players keep getting out of stock i have no mod or any idea where the 2116524 is coming from. im  so sorry to be a pain

If you want to globally make everything have unlimited stock, install the VendingInStock plugin. It has no config and just works. If you want to selectively increase the stock for only certain items or vending machines, or if you want to increase the amount that people can buy at once by typing the number in, then you will need to edit the settings per item, as you have been doing.

As a start, I suggest these settings:

Max Stock: 1000
Seconds between refills: 1
Refill Amount: 1000

awesome thanks a lot

Locked automatically