View Single Post in: [Script Mod] Mechanical Stitching Machine by Antique Artifacts - ALPHA

Virtual gardener
staff: administrator
Original Poster
#2 Old 3rd May 2020 at 5:37 PM
Default How to add yours (or someone else's) CC for the sewing table
Here's a quick and dirty tutorial that should make it for anyone possible to make it compatible with my sewing table! I've worked on a custom importer that checks the group id of your object and from there, knows whether it's a hard, easy or medium project. I've also overhauled the way of getting settings for an object, so you can always create your own XML file without needing to edit any existing one (this is the issue with a lot of other script mods that have similar functionality).

Without further ado, let's get to it!

The groupId and their difficulties:
Easy: 0x1001A575
Medium: 0x74031C5A
Hard: 0x86C8D040
Hardest: 0x74322790
MagicHardest: 0x21BC2F49

What you'll need:
- S3PE
- Notepad or even Notepad++ (any text editor really, just don't use word please :p)

The workflow
This workflow assumes that you've completed your object and have packaged it. Therefore, the current state should be pretty much 'releasable'. You can still, of course, go in and edit all sorts of things later on (Think, meshes, catalogues, textures, etc). But just so there aren't any dangers the OBJD file changes. 

1. Open the package in S3PE
2. Find the 'OBJD' inside your package.
3. Double click on the OBJD. There should be a modal here now.
4. The GroupID is where we define the difficulty, so please check out the section 'The groupId and their difficulties:'. I'll change mine to 0x74031C5A (the medium level). 



5. paste in the group id in the 'Group' input field, Then Copy RK (We need the RK in a bit, hence why we're copying it ) and then click OK. 
6. Paste the RK somewhere in a notepad, we'll need this in a second
7. On the top, go to 'Resource > Add..'



8. Make sure that the Type is as stated in the image, and the group for the XML is 0x7354C1FC. The code actually filters the XMLs based on a static groupID, which is 0x7354C1FC (This GroupID should NEVER include the sewing project's difficulty level! You should ALWAYS define that one in the OBJD. Currently we're working on an XML resource type)
9. To prevent people overwriting their own XML files, let's grab that RK that we pasted in notepad



10. That last bit, that's the instance ID. Let's copy that into the Instance field. If you want, you can also name it! But that's all up to you (As long as you DON'T click FNV64 when you do) Then click OK.
11. If we highlight the XML we just created and right-click on it, we should see all the way down the button 'notepad'



12. Now notepad will open!  It's a white page, but we'll change that! Currently we're creating the 'settings' that your object needs. We'll get into that a bit more right now:

Each entry looks like this:

Code:
----
0x319E4F1D-0x74031C5A-0x63D747A952981432
Knitted, Cotton, Denim, Satin, Leather, Synthetic
isMagicProject=False
isDiscoverableOnly=False
amountOfFabricToRemove=10
  • the ' ---- ' Tells the code, 'there's a new entry upcoming!'. This is even the case when it's your very first object in the XML list.
  • The ' 0x319E4F1D-0x74031C5A-0x51D747A9529819C8 ' is the ResourceKey. (or the term RK that we've used in this tutorial). ALWAYS change this to the OBJD key you just copy/pasted. Else you'll overwrite someone else's stuff.
  • The 'Knitted, Cotton, Denim, Satin, Leather, Denim, Synthetic' bits are ALL the fabrics that exists within this mod. In our settings, we basically say ' use this and that fabric piece!'. In that case, you might only want 'Cotton' and 'Satin', 
  • The 'isMagicProject' basically means 'do you want your pro0ject only to be craftable by witches, imaginary friends, genies and fairies?' (keep in mind that this will also turn it into a level 9 piece).True = yes, False = no.
  • The 'isDiscoverableOnly' this will be removed later, so this doesn't do much currently. 
  • The 'amountofFabricToRemove' means PER fabric piece, how many should we remove? So say, you got 'Knitted' and 'Cotton' set in your settings, and the amount to remove is 2, it will remove 2 Knitted pieces and 2 Cotton piece. 
13. In my case, we're working with a teddy bear!  Copy paste the settings I posted above into the notepad. Then tweak the settings to your liking.

14. Here are my settings for the bear:
Code:
----
0x319E4F1D-0x74031C5A-0x63D747A952981432
Knitted, Cotton, Denim
isMagicProject=False
isDiscoverableOnly=False
amountOfFabricToRemove=2
Easy peasy right?!  All we need to fix now is the ResourceKey! (RK)

15. Get the notepad with the RK on it. 
16. Copy paste that line and replace it with the default one.


17. So now that line should be the same resourceKey as your OBJD!

That's all! I'd say, test it and see what happens!  I included some 'Creator debugging' message errors in case you did something wrong, though you can always ask in the comments/here what you did wrong. 

But what do I do if I have 2 or more?!

You basically do exactly the same steps as you'd do with a single one! One thing though is that the XML might look like something like:

Code:
----
0x319E4F1D-0x00000000-0x0000000000000E10
Cotton, Denim
isMagicProject=False
isDiscoverableOnly=False
amountOfFabricToRemove=2
----
0x319E4F1D-0x00000000-0x0000000000000F64
Knitted, Synthetic
isMagicProject=False
isDiscoverableOnly=False
amountOfFabricToRemove=4
----
0x319E4F1D-0x00000000-0x0000000000000541
Cotton
isMagicProject=False
isDiscoverableOnly=False
amountOfFabricToRemove=2
Screenshots