Lauriel Posted July 17, 2020 Share Posted July 17, 2020 (edited) I'd like to move a unique item from one store and add it to another. I know how to remove and add items to stores, but I don't know how to check for an item's existence in the store. Basically, I want a IF ITEM-IN-STORE THEN check. I'm sure there's a way to traverse the store's inventory, but was hoping someone already wrote that so I'd not have to reinvent the wheel. Edited July 17, 2020 by Lauriel Quote Link to comment
DavidW Posted July 17, 2020 Share Posted July 17, 2020 You can iterate through the items in the store fairly easily... but to be honest, in most circumstances you might as well just use FILE_CONTAINS to see if the resource name for the item occurs inside the store file. Unless your item has a weirdly short name, so that other item names contain it, or unless its name coincides with the name of a rumor dialog or a healing spell, that will be reliable. (And those are exceptionally weird edge cases.) That said, if all you want to do is remove it from whatever store it occurs in (and you don't care which store it actually does occur in), you might as well just use REMOVE_STORE_ITEM on every store. Unless I'm mistaken (it's been known), REMOVE_STORE_ITEM doesn't care if the item wasn't there to begin with. Quote Link to comment
Lauriel Posted July 17, 2020 Author Share Posted July 17, 2020 @DavidW, both of your suggestions will be very handy. Exactly what I was looking for. Thank you! Quote Link to comment
Lauriel Posted July 17, 2020 Author Share Posted July 17, 2020 7 hours ago, qwerty1234567 said: Here I had no idea this even existed. Awesome! Thank you! @qwerty1234567 Quote Link to comment
Lauriel Posted February 13, 2021 Author Share Posted February 13, 2021 On 7/16/2020 at 6:10 PM, DavidW said: in most circumstances you might as well just use FILE_CONTAINS to see if the resource name for the item occurs inside the store file Tested this. Does work. Just an FYI in case anyone else is looking for a quick solution. ... unless I'm completely unable to read the docs...which, ya know, is entirely possible. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.