Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Icy Spicy
Original Poster
#1 Old 19th Apr 2015 at 11:53 AM
Default Help regarding Adding Custom Recipe Books
As stated in the title I want to add Custom recipe books.Arsil has informed me that NRaas career has a Custom Book Loader

I have generated a new dll using BootStrap Creator by Twallan and exported into the package following theCustom Career Tutorial .
Then i have modified the XML according to this http://simswiki.info/wiki.php?title...tle_To_The_Game .

But in this bookfile tutorial by Twallan , it is mentioned that:
Quote:
it is not possible to set the <skill> field to a custom skill name


So I was wondering whether we can add custom recipe books( as custom skill books cannot be added)?

P.S.:I could not get my custom recipe books to show up
Advertisement
Inventor
#2 Old 19th Apr 2015 at 12:47 PM Last edited by Arsil : 19th Apr 2015 at 1:26 PM.
Hello ^^
Let's suppose you did everything correctly and it's a xml problem. Here's an example
Code:
<!-- LEAVE THE FIRST ENTRY ALONE -->
<BookRecipe>
  <Title>Title</Title>
  <Author></Author>
  <Recipe>None</Recipe>
  <Length>0</Length>
  <Value>0</Value>
  <PagesMinNorm>1</PagesMinNorm>
  <PagesMinBW>2</PagesMinBW>
  <NotInBookStore>False</NotInBookStore>
  <GeometryState>BookMediumThick</GeometryState>
  <MaterialState></MaterialState>
  <AllowedWorldTypes>Base,Downtown,University,Future</AllowedWorldTypes>
  <AllowedWorlds></AllowedWorlds>
  <CodeVersion>Basegame</CodeVersion>
</BookRecipe>

<!-- Only readable if Sim has cooking level >= recipe level
     and the recipe doesn't have auto_learn true -->
<BookRecipe>
  <Title>ArsilWhiteRice</Title>
  <Recipe>ArsilWhiteRice</Recipe> <!-- this must be the string used in the Recipe_Key field -->
  <Length>30</Length>
  <Value>25</Value>
  <GeometryState>BookMediumThin</GeometryState>
  <MaterialState>BookRecipe1</MaterialState>
</BookRecipe>


To set up the localized strings, set the keys in this way:
Code:
<!-- LOCALIZATION KEY: Gameplay/Excel/Books/<BookType>:<BookTitle|BookAuthor>
Examples:
  Gameplay/Excel/Books/BookGeneral:Arsil_BookGeneral_Title
  Gameplay/Excel/Books/BookGeneral:Arsil_BookGeneral_Author
  Gameplay/Excel/Books/BookToddler:Arsil_BookToddler_Title
  Gameplay/Excel/Books/BookToddler:Arsil_BookToddler_Author
  Gameplay/Excel/Books/WrittenBookTitles:Arsil_WBT_Title1
 -->


So, for a recipe book, you have to use as key:
Gameplay/Excel/Books/BookRecipe:<YourRecipeBookTitleOrAuthor>

As usual the suggestion of using unique strings/names applies, in order to reduce possible conflicts with other mods, present or future ^^

EDIT: well, let's complete the info:

Length should represent the number of pages of the book, hence the time it takes to read it.

Value is the price of the book

GeometryState is the shape of the book (as the name suggests it's actually a geostate of the book mesh)
You can choose between: BookLargeThick, BookLargeThin, BookMediumThick, BookMediumThin, BookSmallThin

MaterialState is the texture (to simplify the explanation, it's actually a material state, MTST, of the book)
used for the book (cover and what not), you can use that of whatever kind of book, not only the recipe ones or
limited to the genre (but for coherency maybe it's better to stick to those for recipes). There are a lot of options
here, let me see if a can list them...
- BookRecipe1
- BookRecipe2
- BookRecipe3
- too lazy to list the others, check Books _XML in GameplayData to see other examples
Icy Spicy
Original Poster
#3 Old 19th Apr 2015 at 1:06 PM
Code:
<Books>
<BookRecipe>
  <Title>Title</Title>
  <Author></Author>
  <Recipe>None</Recipe>
  <Length>0</Length>
  <Value>0</Value>
  <PagesMinNorm>1</PagesMinNorm>
  <PagesMinBW>2</PagesMinBW>
  <NotInBookStore>False</NotInBookStore>
  <GeometryState>BookMediumThick</GeometryState>
  <MaterialState></MaterialState>
  <AllowedWorldTypes>Base,Downtown,University,Future</AllowedWorldTypes>
  <AllowedWorlds></AllowedWorlds>
  <CodeVersion>Basegame</CodeVersion>
 </BookRecipe>
<BookRecipe>
  <Title>KiwiSummerSalad</Title>
  <Recipe>KiwiSummerSalad</Recipe>
  <Length>25</Length>
  <Value>20</Value>
  <GeometryState>BookMediumThin</GeometryState>
  <MaterialState>BookRecipe1</MaterialState>
 </BookRecipe>
</Books>


My xml.I think I got my localization wrong.But I have Untranslated Key in game so it should show up without correct localization

I just saw that you have uploaded your Custom Book Loader (Earlier I had only seen the source code).I need a different script for different sets of recipes right( for ex: one for Green Vegetables,different one for Fruit Recipes etc)?

P.S.:I opened a thread for this so that other who maybe interested can see this too!
Inventor
#4 Old 19th Apr 2015 at 1:19 PM Last edited by Arsil : 19th Apr 2015 at 1:38 PM.
You should put all the books in the same xml, no need to create more than one (supposing they all belong to the same mod).

My Custom Book Loader is not flexible/versatile like the NRaas one or like douglasveiga's CCLoader, not sure how to explain
that, you can't "re-use it". My idea was to ask DV to integrate it with the CCLoader but then I found out that NRaas Careers
already does that and it seemed rude to me to make another (and yet integrating at least RecipeBooks to CCLoader doesn't
sound like a bad idea, so the same tool is able to handle all things related to recipes).

I've edited my previous post, check it again if you didn't already.

EDIT: oh, and to be safe, in the xml of course you also have to put the header and open/close the main tag, I took that for granted
Code:
<?xml version="1.0"?>
<Books>

  ...

</Books>
Icy Spicy
Original Poster
#5 Old 19th Apr 2015 at 1:45 PM
Quote: Originally posted by Arsil
You should put all the books in the same xml, no need to create more than one (supposing they all belong to the same mod).


I was talking about different mods because I have a huge no. of ingredients and recipes planned.Putting them all into one huge file seemed like a bad idea and cumbersome.So I am putting them into reasonably sized mods.

Quote: Originally posted by Arsil
(and yet integrating at least RecipeBooks to CCLoader doesn't
sound like a bad idea, so the same tool is able to handle all things related to recipes).


Thats is an awesome idea and very practical too.

Quote: Originally posted by Arsil
I've edited my previous post, check it again if you didn't already.


Yes,I have seen the edited post.I was worried that maybe I had missed a step.There are no other additional steps to this right?
My end product has 4 entries:
1) The unique .dll XML with the following:
Quote:
<CareerFiles>
<BookFile>
<Books></Books>
</BookFile>
<BookFile>
<Books>mc_KiwiRecipeBooks</Books>
</BookFile>
</CareerFiles>


2)Unique .dll S3SA
3)Custom Books XML
4)STBL

Am I missing something?Are the steps correct.

I am going to go and build it from scratch again.
Inventor
#6 Old 19th Apr 2015 at 1:53 PM
Make sure mc_KiwiRecipeBooks is also the name of the xml (or course) and is the key
used to generate its Instance ID (double click on it and then click on the FNV64 button
once you verify that the name is spelled correctly).

If it still doesn't work, upload it here.
Icy Spicy
Original Poster
#7 Old 19th Apr 2015 at 2:14 PM
Quote: Originally posted by Arsil
Make sure mc_KiwiRecipeBooks is also the name of the xml (or course) and is the key
used to generate its Instance ID (double click on it and then click on the FNV64 button
once you verify that the name is spelled correctly).

If it still doesn't work, upload it here.


I have done that.Maybe something went wrong while building the file!I think I am going to rebuild the file and see.
I have attached all the kiwi files( fruit,recipe,recipe book)
Attached files:
File Type: rar  Kiwi Recipe Books.rar (2.9 KB, 13 downloads) - View custom content
File Type: rar  Kiwi Recipes.rar (49.5 KB, 14 downloads) - View custom content
File Type: rar  Kiwi.rar (271.7 KB, 15 downloads) - View custom content
Inventor
#8 Old 19th Apr 2015 at 4:11 PM Last edited by Arsil : 19th Apr 2015 at 5:15 PM.
There's the same xml resource for the recipe data in 2 packages.
In kiwi.package there are no recipes defined and probably this occurrence of the resource
overrides the other one, so there's no recipe and the recipe book can't work (doesn't get initialized at all).

Let me do a quick test... just deleting the resource from kiwi.package should fix it... nope, still no book.
It works fine using my loader, I'm trying to understand why it doesn't work with NRaas Careers' one...

On another note, remember that you can also specify the author's name for the book, I didn't do that
in my example (I don't think it's mandatory).
Icy Spicy
Original Poster
#9 Old 19th Apr 2015 at 6:21 PM
Quote: Originally posted by Arsil
There's the same xml resource for the recipe data in 2 packages.
In kiwi.package there are no recipes defined and probably this occurrence of the resource
overrides the other one, so there's no recipe and the recipe book can't work (doesn't get initialized at all).

Let me do a quick test... just deleting the resource from kiwi.package should fix it... nope, still no book.
It works fine using my loader, I'm trying to understand why it doesn't work with NRaas Careers' one...

On another note, remember that you can also specify the author's name for the book, I didn't do that
in my example (I don't think it's mandatory).


Oops I forgot to delete the extra resource!

Thank you so much for looking taking the time to look into this :lovestruc
Inventor
#10 Old 20th Apr 2015 at 5:45 PM
Oh my, it was subtle, but luckily I faced a situation like this when I made Custom Rabbit Holes to be used with NRaas Careers.

It's a problem related to the order or priority with which resources are parsed.

The game tries to parse your custom recipe book BEFORE your custom recipe has been parsed by CCLoader,
so when it tries to add a recipe book for a non existing recipe the process fails. It was a coincidence (so to speak)
that instead it worked using my mod, because for some reason my mod parsed your custom books AFTER
CCLoader had already parsed your custom recipes. It doesn't depend, like one may think, by the path+filename
of the packages or by the Instance ID of the resources, it depends on the order on which the event handlers are
called... but there's no need to be too technical, mostly because I don't fully understand it either ;P

Pretty sure I fucked up all verbs and consecutio temporum (sequence of tenses?) there, sorry!

I had my reserve for a form of gentlemen's agreement when I found out that NRaas Careers already allowed to add
custom books to the game, but now I think douglasveiga should really add also a custom book loader to his CCLoader,
because having one tool to handle all things related to recipes would be very handy and can guarantee that resources
are parsed in the correct order (as long as they belong to the same CCLoader "module").

Why?

CCLoader correctly parses things in this order:
- plants (they don't refer to anything else)
- ingredients (they MAY refer to plants previously defined)
- recipes (they MAY refer to ingredients previously defined)

Adding the parsing of books after the parsing of recipes will guarantee that the relative recipes were already been parsed
and added to the game. Of course, presuming that plants+ingredients+recipes+recipeBooks are all handled by the same
mod (i.e. the same module of CCLoader). I had already stated that but repetita iuvant. Wow, my Latin comes back at the
weirdest times.

@douglasveiga : sorry if I bother you (I don't like when I'm "mentioned"), but I think it's for a good reason.
I had already posted the sourcecode in the CCLoader thread - now sticky, in case you don't find it anymore :D
feel free to use and modify it. Of course it is up to you to decide to do it or not, but I think it will help a lot.
Icy Spicy
Original Poster
#11 Old 20th Apr 2015 at 7:13 PM
for figuring it out.Your are awesome .
So I understand that to make it work in its current form I need to put my ingredients and recipes file in the override file and the custom books file in the main mods folder?
Parse order is chosen randomly?It really was subtle ! (I got a bit stuck at the latin though )

The best option really seems to be including in CCLoader!
Inventor
#12 Old 20th Apr 2015 at 7:49 PM Last edited by Arsil : 21st Apr 2015 at 7:55 AM.
It can't work in its current form. At least not in a predictable way.

The order is not random, otherwise it would change every time you run the game and I don't think
that's what happen. I'm not sure how the order is established (and it doesn't help that I'm super tired
and with an headache). My best guess involves a mix of:
- [EDIT] after all, maybe the path+filename of the package may play a role
- IID of the resources (or maybe the assembly name)
- the order with which event handlers (OnWorldLoadFinished and stuff like that) are added/called

The same thing that is happening to your custom books happened with my custom rabbit holes:
the careers xml (that, among their data, contain the reference to the rabbit hole enum used to
host the career) were parsed before the game "knew" about the custom rabbit holes.
I solved the problem (after cursing in ancient and forgotten languages) making sure that their
custom enum entries were added before the custom careers were parsed by using a "kind" of event
handler (PostInit) that - according to the GameFlow class constructor - is called before the "kind" of
event handler used by NRaas Careers to parse the xml resources with the career definitions/data
(OnAppStartUp if I recall it correctly).

[I'm not sure if I'm using the right terminology, my programming knowledge is outdated and rusty]
EDIT: I think the correct term may be "multicast delegate"

The solution to your issue is to create a script that loads your resources in the proper order or,
preferably, adding support to books to an existing script, that of CCLoader, that is already designed
with that purpose. I say preferably also because it makes little sense that every modder creates its
own script for something that now, thanks to CCLoader itself, can be "mass-produced" and
without risk of conflicts or having to merge default replacements of official resources (good thing
for an overhaul of recipes/ingregients/whatever, but not for adding custom stuff).

Gee, my head is exploding. Gotta go. I hope I haven't written too many stupid things.
Inventor
#13 Old 21st Apr 2015 at 3:57 PM Last edited by douglasveiga : 2nd Jun 2015 at 1:40 AM.
Now supports custom books. This file is for testing purposes before replace the official mod file.

Arsil, thanks for the amazing contribution.
Icy Spicy
Original Poster
#14 Old 21st Apr 2015 at 7:08 PM
Quote: Originally posted by douglasveiga
Now supports custom books. This file is for testing purposes before replace the official mod file.

Arsil, thanks for the amazing contribution.


Going to test it now :lovestruc
Inventor
#15 Old 21st Apr 2015 at 8:00 PM
It's working. Sorry, I was anxious and I tried it myself.

icemunmun, remember to compile the fields Name and Creator in the main xml resource (also for the mod you already uploaded) ^^
Icy Spicy
Original Poster
#16 Old 21st Apr 2015 at 8:06 PM
Its showing up .Thank you so so much Arsil and douglasveiga :lovestruc .I will go and update my mods now!
Screenshots
Inventor
#17 Old 22nd Apr 2015 at 10:46 AM Last edited by Arsil : 22nd Apr 2015 at 11:04 AM.
Right. Yesterday I was too distracted and I forgot to thank you douglasveiga.

I think it would be a good idea to put an advice/warning in the CCLoader thread (directly in the opening post)
to NOT make cross references between modules.

For instance, don't make a recipe that requires an ingredient defined in another module, because you
can't be sure that that module has already been parsed. Of course you can reference, for example, an
ingredient defined in the official resource "Ingredients" in GameplayData.package, AFAIK those resources,
even if there are default overrides of them, are always parsed before any xml parsed by a custom script.

Except when a certain modder decided to convert all ingredients to fruits in her overhaul and my poor,
innocent, candid White Rice stopped working. You were very very naughty Cinderellimouse :P

Let's suppose that the order between two CCLoader modules depends only by the path+filename of their packages.
What if one user rename the packages or put them in different folders? What if one user merges the packages?
That's what I meant before with not predictable.



Maybe one day we can add support for custom minor pets. Well, maybe with another tool to not mix different things.
http://modthesims.info/showthread.p...564#post4718564
They are defined in a way very similar to plants, but there are a few complications:
- species are hard coded with an enum, so there's also need to specify (maybe in the same xml with the minor pet data)
what kind of minor pet we want to add and what are the names and guids of the custom enum entries.
- [optional] extra work to add the new species to its related spawner

Something like this
Code:
<?xml version="1.0"?>
<CustomMinorPets>

  <Header>
    <EnumNamesList value="CustomLargeBird1, CustomLargeBird2" />
    <EnumGuidsList value="1234567801,1234567802" />
    <SpawnerNamesList value="MinorPetBirdLargeSpawner1,MinorPetBirdLargeSpawner1" />
    <SpawnerProbabilitiesList value="1, 1" />
  </Header>

  <!--Leave the first entry alone-->
  <LargeBirds>
    [...]
  </LargeBirds>

  <!--Define here your custom minor pets-->

  <LargeBirds>
    <Species>CustomLargeBird1</Species>
    [...]
  </LargeBirds>

  <LargeBirds>
    <Species>CustomLargeBird2</Species>
    [...]
  </LargeBirds>

</CustomMinorPets>


Well, isn't this a - very sober, short, extremely clear and focused on just one subject - post?
Inventor
#18 Old 23rd Apr 2015 at 3:53 AM
Quote: Originally posted by Arsil
Right. Yesterday I was too distracted and I forgot to thank you douglasveiga.

I think it would be a good idea to put an advice/warning in the CCLoader thread (directly in the opening post)
to NOT make cross references between modules.

For instance, don't make a recipe that requires an ingredient defined in another module, because you
can't be sure that that module has already been parsed. Of course you can reference, for example, an
ingredient defined in the official resource "Ingredients" in GameplayData.package, AFAIK those resources,
even if there are default overrides of them, are always parsed before any xml parsed by a custom script.

Except when a certain modder decided to convert all ingredients to fruits in her overhaul and my poor,
innocent, candid White Rice stopped working. You were very very naughty Cinderellimouse :P

Let's suppose that the order between two CCLoader modules depends only by the path+filename of their packages.
What if one user rename the packages or put them in different folders? What if one user merges the packages?
That's what I meant before with not predictable.



Maybe one day we can add support for custom minor pets. Well, maybe with another tool to not mix different things.
http://modthesims.info/showthread.p...564#post4718564
They are defined in a way very similar to plants, but there are a few complications:
- species are hard coded with an enum, so there's also need to specify (maybe in the same xml with the minor pet data)
what kind of minor pet we want to add and what are the names and guids of the custom enum entries.
- [optional] extra work to add the new species to its related spawner

Something like this
Code:
<?xml version="1.0"?>
<CustomMinorPets>

  <Header>
    <EnumNamesList value="CustomLargeBird1, CustomLargeBird2" />
    <EnumGuidsList value="1234567801,1234567802" />
    <SpawnerNamesList value="MinorPetBirdLargeSpawner1,MinorPetBirdLargeSpawner1" />
    <SpawnerProbabilitiesList value="1, 1" />
  </Header>

  <!--Leave the first entry alone-->
  <LargeBirds>
    [...]
  </LargeBirds>

  <!--Define here your custom minor pets-->

  <LargeBirds>
    <Species>CustomLargeBird1</Species>
    [...]
  </LargeBirds>

  <LargeBirds>
    <Species>CustomLargeBird2</Species>
    [...]
  </LargeBirds>

</CustomMinorPets>


Well, isn't this a - very sober, short, extremely clear and focused on just one subject - post?



I believe it's possible to solve the dependencies between mods by building a Tree of tunings and them load everything from top (high dependency) to bottom (low dependency). Of course, we need to avoid any cross reference to avoid any loop in the tree.

I need to think about the bird loader later. I am sleepy...
Inventor
#19 Old 23rd Apr 2015 at 10:22 AM
Or every modder could assign a priority to their single modules (specifying it together with Name and Creator),
and CCLoader could use that value to sort the tunings before parsing them.

But I'm not sure if this complication is necessary: if you make a recipe that requires one of your custom ingredient,
just put it in the same module.

About custom minor pets, it was just a random thought, the one I did didn't triggered much interest
(of course the fact it wasn't re-meshed nor re-textured played a role but that wasn't the point).
Icy Spicy
Original Poster
#20 Old 23rd Apr 2015 at 10:44 AM Last edited by icemunmun : 23rd Apr 2015 at 11:48 AM.
You two are so frigging awesome *huge hug*

What happens if someone uses the new CCLoader and an harvestables package made with the old CCLoader_Generator?Is the books XML ignored as no book data is found?

The minor pets/birds idea is pretty cool.I will go check out your package in-game and will try a simple DDS replacement and post pictures(if you are okay with it).

I am being greedy...but what about Alchemy potions...they appear to be XML tunable too *runs away*

P.S. Are there any XML files for the University Barista bar drinks like the LN professional bar? I could not find them
See...I am keeping to the topic of the thread too
Inventor
#21 Old 23rd Apr 2015 at 2:32 PM Last edited by Arsil : 23rd Apr 2015 at 5:41 PM.
Quote: Originally posted by icemunmun
What happens if someone uses the new CCLoader and an harvestables package made with the old CCLoader_Generator?Is the books XML ignored as no book data is found?

Yep, it's backward compatible. If there is no book defined in the xml, no xml at all or even no <Books_XML> field the CCLoader will keep doing its work.

Quote:
The minor pets/birds idea is pretty cool.I will go check out your package in-game and will try a simple DDS replacement and post pictures(if you are okay with it).

Sure. You can also upload it to MTS or wherever you want (but if someone else uses that script the two mods will conflict).

Quote:
I am being greedy...but what about Alchemy potions...they appear to be XML tunable too *runs away*
P.S. Are there any XML files for the University Barista bar drinks like the LN professional bar? I could not find them

I only made a quick check, so very susceptible to errors.

I see an AlchemyRecipes xml (with Medators and ModelNames) that might work in a similar way to the Plants and MinorPets xmls.

The BaristaBar_blahblahblah xml lists the snacks and drinks available to buy.
Snacks are defined in the RecipeMasterList like regular recipes.
Drinks... well, seems like they will require more research. Seems like they are all variations of the same object,
accessoryCupBarBarista, they are divided in categories (teas, etc), the specific drink changes details like materialstate
(for the texture or color of the drink probably)
[EDIT: it's been a while, they all look the same, don't they?]
a drink may must refer to an Ingredient (for VFX and post ingestion buff probably).

Bottom line: it seems like there's room for "moddability".

Quote:
See...I am keeping to the topic of the thread too

Shame on you for going off topic!

EDIT: wanna try an Arsil's apple tea? It's very tasty and gives no nausea or side effects!
The VFX (Visual Effects?) is linked to the name of the ingredient
("ep9SpicePlate<IngredientNameWithBlanksRemoved>_main")
and I think refers to the name of a vfx defined in one of the _SWB resources.
Apples give no buffs, so no moodlet after drinking the tea.
Localization key : Gameplay/Objects/Appliances/BaristaBar:<drinkName>

With a default replacement of the BaristaBar_* xml you can't use custom ingredients though
(because this xml is parsed before the custom ingredients are added).
But you can use a script to add new drinks, making sure to add them after the related custom ingredients have been added.
Never mind, the drink list is re-created every time you use the interaction, so maybe it's not a problem.
Let me do a few test with your kiwi ingredient...
Oh, lovely, an infinite saving bug: welcome back sweet friend, I missed you sooo much.

Not sure if related. Yep, totally related. Even using a default Ingredient.
Attachment removed.

EDIT2: infinite saving even without it, must be something else then.
Too much experimental crap in my Mods folder or maybe a corrupted savefile
after too much crappy experiments...

EDIT3: Ok, it was something else. Apparently it works even with custom ingredients.
Attached files:
File Type: zip  CustomDrinkForBaristaBar.package.zip (2.2 KB, 12 downloads) - View custom content
Icy Spicy
Original Poster
#22 Old 24th Apr 2015 at 7:32 PM
The BaristaBar edit worked...now I can add the 1000 and one non-alcoholic beverages I had always wanted to add to the game I have tested with custom ingredient and a store ingredient..Thank you so much for showing the way :lovestruc
I will have to make a few tea ingredients!
I have recolored the cockatoo and posted it in the bird thread.Its very basic but I will do more stuff with it.

I may try something with the alchemy potions too!
Screenshots
Back to top