Jump to content

[LE] Collect inventory information then send or save them somewhere


Recommended Posts

Hello! I'm totally new to modding Skyrim, so I would like some advice :smile:

 

I started to create an app, which helps you with alchemy information. But I thought why not collect some inventory data from my game? Then I could see what kinds of potions I can create from the currently available ingredients. And that's where my problem begins.

 

Google led me to the direction of creating a mod with Creation Kit. What I would like to achieve is everytime my character adds an ingredient to its inventory, then call an outside API / update a file where information is stored and can be read from outside. This also needs to work for removing ingredient from the inventory.

 

I don't know it it's a good approach for my problem... or is it even possible to call an outside API / save info into a file from the Creation Kit?

 

Thanks for the help! :smile:

Link to comment
Share on other sites

I really don't mean to burst your bubble, but if you're new to modding Skyrim, I'd suggest you learn to work your way inside the CK and Papyrus first before you use an outside API, if only to make sure your external code doesn't conflict with the game system.

 

If you're a coder, Papyrus is pretty easy to get used to, you may start with DarkFox127's tutorials (here on the Nexus) if you're interested. What you have in mind can actually be done with Papyrus and skse, it'd probably be a very long script, considering the many ingredients combinations the game offers, but it is feasable I'd think...

 

Good luck to you!

Link to comment
Share on other sites

There is FileAccess Interface for Skyrim (FISS) and PapyrusUtil both of which allows one to save data to an external file. How you access that data outside the game is up to you. FISS stores it in a XML file whereas PapyrusUtil uses a JSON file.

 

Instead of trying to track in real time as items are added or removed, I would setup a hotkey that when pressed will walk over the player's inventory and save to file using one of the aforementioned "mods". This would allow obtaining an accurate listing of target items should your "mod" be added mid-game when there could already be lots of target items in the inventory.

 

I suggest against using the OnItemAdded and OnItemRemoved events for the following reason(s):

Without a proper inventory filter set up, every item will trigger it. This wastes processing and can cause stack dumps if a lot of items are added or removed in quick succession.

Link to comment
Share on other sites

Thanks so much for the help! :smile:

 

I really don't mean to burst your bubble, but if you're new to modding Skyrim, I'd suggest you learn to work your way inside the CK and Papyrus first before you use an outside API, if only to make sure your external code doesn't conflict with the game system.

 

If you're a coder, Papyrus is pretty easy to get used to, you may start with DarkFox127's tutorials (here on the Nexus) if you're interested. What you have in mind can actually be done with Papyrus and skse, it'd probably be a very long script, considering the many ingredients combinations the game offers, but it is feasable I'd think...

 

Good luck to you!

 

Yepp, I know it will take time to do what I want that's why I wanted to ask for help which path to take. So I don't have to start the whole thing again and again...

 

By calling an API I meant making an HTTP request, sorry I wasn't clear about it. But I will start with the tutorial you mentioned, thanks! :)

 

There is FileAccess Interface for Skyrim (FISS) and PapyrusUtil both of which allows one to save data to an external file. How you access that data outside the game is up to you. FISS stores it in a XML file whereas PapyrusUtil uses a JSON file.

 

Instead of trying to track in real time as items are added or removed, I would setup a hotkey that when pressed will walk over the player's inventory and save to file using one of the aforementioned "mods". This would allow obtaining an accurate listing of target items should your "mod" be added mid-game when there could already be lots of target items in the inventory.

 

I suggest against using the OnItemAdded and OnItemRemoved events for the following reason(s):

Without a proper inventory filter set up, every item will trigger it. This wastes processing and can cause stack dumps if a lot of items are added or removed in quick succession.

 

Thanks for the info about the utils!

 

I read about OnItemAdded and OnItemRemoved and I thought about using it, but as you mentioned I also have to consider how it impacts the game so thanks for the tip!

 

I thought about the concept: when do I need the ingredient list, when will I use the app for help? I want to check which potions the character is able to craft, so if it's possible, I need to update the list only when I interact with an alchemy table.

Link to comment
Share on other sites

There are ways to try and do it when an alchemy station is accessed but, honestly, that is more hassle than it is worth. Especially when it ventures into the realm of compatibility with other mods. An SKSE hotkey would be my recommendation but casting a spell, reading a book or equipping an object could all be used with minimal impact on the game and other mods.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...