Help with ideas for a script to add jewelry breakdown in IJ

Post » Mon Oct 26, 2015 5:47 pm

So Immersive Jewelry has been out for some time, and I've finished all parts of it that I'd wanted to except one. There needs to be some form of breakdown whereby players can extract gems and metals from unwanted pieces of jewelry.

What I would like to do is have a miscellaneous object called "pliers" that when clicked on, allows you to click on any piece of jewelry in your inventory. Once clicked, the jewelry will disappear and be replaced by X sized gems and portions of "hackmetal". The hackmetal can then be combined into ingots at the smelter.

Immersive Jewelry already has about 3600 unenchanted items that this would have to work for, however, so going in by hand and programming what each object breaks down into with this method would take months.

However, when I categorized each of the 3600 armor objects for jewelry as I made them, I followed a scheme wherein they were identified by mod author name, then the object slot, then metal, then race, and then the gem and its cut. For example "JohnSkyrimCircletSilverNordicDiamondCheckerboard".

Is it possible that I could write a script that would identify the proper breakdown components of any clicked on object immediately based on its editor ID? For example, just from the editor string, it would know to give diamonds, from "circletsilver" it would know to give 12 portions of hacksilver, and from "JohnSkyrim" it would know to give 7 diamonds, because the circlets by that author have 7 gems in them?

If so, what would the calls for that function and name string identification look like?

User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Tue Oct 27, 2015 12:57 am

There's probably a non-native function that would work. My understanding, non-native just means it's not part of the game's Papyrus code, but part of C++ which the code was written in. So far, C++ has seemed pretty similar to PHP for me, and I feel like there must be a way to run a non-native function similar to "strpos". I can't post links but maybe somestringvariable.find() would work? It looks like it lets you see if String1 contains String2. There's loads of StackOverflow questions & answers showing how it works if you google something like "C++ string contains". And there's a page on the wiki about non-native functions, I believe.

Then it would just be a matter of getting the EditorID of the jewelry object, storing it to a string, checking to see if that string contains, say "diamond", if so, give the player a diamond, etc.

I don't know how you plan to implement the breakdown process for that many items, my head spins just thinking about it, but I'm new at this. I know for SURE you could at least get it to work when the item is equipped, worst case scenario. It would be a pain to make the player equip the item first, but that would be easy to code. You probably already have a much better solution for this.

Sorry if my response is dumb/obvious/not helpful, I'm still getting the hang of this! But I like your idea, hope it works! :smile:

User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Mon Oct 26, 2015 10:57 pm

Well I wouldn't have it call "GetEquippedObject" or whatever it is, but rather I would use the mouse click on the item after clicking the pliers. So I probably have to "registerforclick" or something like that once the pliers are activated so that it knows which jewelry piece to break down. I am certain that some kind of "get editor id contains" function exists at least in SKSE, but I am unsure of the parameters for how to construct and parse such a script.

User avatar
louise hamilton
 
Posts: 3412
Joined: Wed Jun 07, 2006 9:16 am


Return to V - Skyrim