Topic: Issues Integrating Cookery with Craft Mod Recipes  (Read 10277 times)


Roheline

« on: November 05, 2020, 01:58:04 AM »
I'm working on designing a realistic mod that allows me to create dyed yarn and garments using various plants and mushrooms. My first attempt has some of the mod under cookery so I can create, for example "A pot of blue dye" rather than "A blue dye". My goal was to then have the dyeing step call for a portion in #s of the created "liquid product" gained from cookery. So "A pot of blue dye" might work for several batches of yarn (each requiring 1 lb of the intitially created 5 lbs of liquid, for example), with the weight of liquid reducing each time it's used as in when you have a pot of something and eat portions from it. I was hoping I could go this route as long as I remembered not to eat my dye stocks, as they show up in the food menu until further utilized.

The problem I'm encountering is that when I try to do regular modded crafting outside the cookery menu, it just doesn't want to pull the volume correctly. So my very labor intensive "pot of blue dye" was all emptied simultaneously leaving and empty pot when I attempted a test dye with it, rather than using a portion of the weight/volume and leaving the rest in the pot for later use. I wanted to end up with "Blue yarn" plus "A pot of blue dye" minus 1 lb of liquid, instead I got "Blue yarn" and an empty pot.

Can anyone advise on a way to make these functions work together, or is the cookery menu just not meant to be used that way?

Thanks!

Privateer

« Reply #1 on: November 05, 2020, 03:16:13 AM »
 Hello,

 I took a fast and dirty run at this, here's what I got for function NOT form.
Cooking > copied Pea soup (cause peas are green right ;) )
Code: [Select]
.Pea Dye. *COOKERY* /10/  \120\ %20% :148: 
{Rock} #2# [remove] [boil]
{Water}   #5# [remove] [boil]

So now I have a pot of Pea Dye (weight 9 lbs)
Now to Pea.. Well Dye something.
I was going to do an article like a shirt but then thought "That would prevent you from assembling something that is the dye color". So instead I for my example I just Pea colored a 1 lb cloth (bandage), which would allow for better naming choices.

Code: [Select]
.Dye cloth Pea. "Bandage" [effort:1] [phys:arms,one-armed]  *COOKERY* /30/ %40% |-2|
{Pea Dye} #1# [remove]
{Cloth} #1# [remove]
[MATERIAL:cloth]
[NAME:Pea colored cloth]

 This seemed to work properly and as expected consumed .5 for my cloth shirt and 1 lb of the Pea liquid
Hope this help

Spoiler: show

Spoiler: show
To help is it's own reward.
Mods:
https://www.unrealworld.fi/forums/index.php?action=profile;area=showposts;sa=attach;u=10 Player Quests, Arrow quiver, Bee hives honey & mead, Massive menus, Fish Farmer, Combat trainer, Player made markers, Weaving, Wood stacks, Chicken coop Fish cuts, string&bone.

PALU

« Reply #2 on: November 05, 2020, 01:31:12 PM »
Since Privateer seems to have succeeded, I guess it might be useful to provide the non working recipe for expert advice (i.e. not including myself).

Also, regarding the naming issue in suggestions, what about going for "Dye, blue"-> "cloth, blue"->footwraps, blue" until first part naming becomes available? Would that work, or would that knock out some other important part of the name, or cause other issues?

Roheline

« Reply #3 on: November 05, 2020, 09:17:22 PM »
I was going to test my own recipe again before posting the text, and in the process of obtaining some of the raw ingredients (my dye recipes are pretty complex to be realistic), I think I may have figured out what's happening (just not how to solve it!)

I think instead of the game miscalculating as I originally thought, the problem is that when I'm crafting and the recipe calls for a pot to cook in, the game grabs any random pot out of my inventory rather than letting me select it. If it selects a pot that had some dye product (or anything) left in it, then the pot becomes emptied as part of the crafting process.

This just happened when I was testing when my recipe called for "clay pot" and it emptied a pot of porridge out of my inventory rather than letting me select one of my 3 empty pots.

So the next question: is there a way to code the mod so that the game forces the player to select the specific item desired rather than autoselecting and in many cases inadvertently emptying a desired container?

Privateer

« Reply #4 on: November 05, 2020, 10:11:22 PM »
 I've seen this behavior when I was making a resin which in my process involved putting containers into containers to be burned.

Anywho.. I made a couple pots of differing quality and had no problem with
Code: [Select]
.Pea Dye. *COOKERY* /10/  \120\ %20% :148: 
{Rock} #2# [remove] [boil]
{Water}   #5# [remove] [boil]
Prompting me to choose a container.
Spoiler: show


I did produce (2) same name pots just to verify that the quality difference did not 'cause' the choice. With 2 same name/quality pots I still get prompted for which pot to use.

 Now with regard to the afore mentioned, I think my issue was calling out for a pot in the recipe, which allows the game to auto select ingredients 'by name'. As I recall, at the time I resolved it by changing from a numeric (1) to using a weight qualifier to the ingredient #x# which forces the game to prompt for selection.

 Lastly as PALU said the code helps a lot to determine specific issues/workarounds.
Though I do understand that sometimes things are TOP Secret  8)

Hope this helps
To help is it's own reward.
Mods:
https://www.unrealworld.fi/forums/index.php?action=profile;area=showposts;sa=attach;u=10 Player Quests, Arrow quiver, Bee hives honey & mead, Massive menus, Fish Farmer, Combat trainer, Player made markers, Weaving, Wood stacks, Chicken coop Fish cuts, string&bone.

Roheline

« Reply #5 on: November 05, 2020, 10:30:42 PM »
No secrets, I actually wasn't entirely sure how to display my code haha. It's also unlikely my recipes could be easily playtested since I went so far as to mod in whole new plants based on my extensive research of what would have actually been used, so most of the ingredients wouldn't be obtainable without a whole mess of ingredients I've modded in.

Anyway, worth a go to see if you can figure out any solutions. Here's the first recipe in Cookery for extracting a dye solution from a plant called bloodroot:

Code: [Select]
.Bloodroot extract.    *COOKERY* /60/ \10d\ [effort:1] [phys:arms,hands]
{Bloodroot root}      #3# [remove] [boil]
{Wood ash lye}      #0.5# [remove] [boil] 
{Water}      #2.5# [remove] [boil]
{Knife} '+to chop roots'
{Stone}   (2) [nearby] '+to grind the roots'
{[NEARBY_TILE:ground]} 'Ferment outside in a clay vat'
[SPOILAGE_DAYS:0]

So the selection of the pot is not coded in by me but is forced by whatever code goes on in cookery. No issues there.

The next part for the dyeing:

Code: [Select]
.Dye yarn red with bloodroot. *HIDEWORKING* "Cord" /1h/ \14d\  [effort:0] [phys:arms,hands]
{Wool yarn} #1#                [remove]
{Bloodroot extract}     #1#        [remove]
{Water} #1#         [remove]
{*lay pot*}       'Clay pot to ferment'
[TILEGFX:rc-yarnr]
[NAME:Wool yarn dyed red]
[LENGTH:250]
[WEIGHT:1]
[PRICE:4]

So the bit with the asterisks and the clay pot was me attempting a solution by having all of the cookery processes take place in a "Clay vat" object (which is coded as a pot) that still works as a pot but cannot be selected accidentally in the crafting step if I specify a pot with asterisks. However, the first step being cookery, I cannot force the player to choose the "Clay vat" object.  When I run these two processes, it works exactly as intended, with 6 lbs of dye solution being created in the cookery step and 1 lb being used up in the second step. So I think I've confirmed that the issue is the pot selection in the dyeing/crafting step accidentally grabbing a full pot of out my inventory and emptying it.

Now, do I understand correctly that if I were to specify

Code: [Select]
{Clay pot}   #6# 
in the crafting step, it would force me to choose a specific pot, thereby avoiding the accidental selection problem?

EDIT: I just tested and confirmed that specifying a weight of Clay pot does force a selection. It looks pretty stupid but does prevent the game from emptying any other pots in my inventory. Does anyone know any other methods of forcing a selection? I've tried codign with and without the asterisks (
Code: [Select]
{Clay pot} vs {*clay pot*} and it doesn't seem to make a difference.
« Last Edit: November 05, 2020, 10:39:40 PM by Roheline »

Privateer

« Reply #6 on: November 05, 2020, 11:19:48 PM »
 Ok, I think I see what your asking, but at least one issue; Since you're not in the cooking section for the dyeing process the 'pot' is just a 'tool' and will be pattern matched to "* *lay" you can disrupt this process by saying #1# (since the text match or item in the Pot case, are over weight it forces a choice) OR by setting <preferred tool name> of the item (I only think this works) . Since there is no [remove] no weight will be lost BUT the pot is returned to your inventory at interactive task completion. Meanwhile the string will be laying on the floor for 14 days. The cooking 'process' probably creates the visual you are looking for of a pot sitting on the floor while the dyeing process is running.
« Last Edit: November 05, 2020, 11:21:49 PM by Privateer »
To help is it's own reward.
Mods:
https://www.unrealworld.fi/forums/index.php?action=profile;area=showposts;sa=attach;u=10 Player Quests, Arrow quiver, Bee hives honey & mead, Massive menus, Fish Farmer, Combat trainer, Player made markers, Weaving, Wood stacks, Chicken coop Fish cuts, string&bone.

PALU

« Reply #7 on: November 05, 2020, 11:37:47 PM »
I believe the basic problem isn't restricted to pots, but to any kind of items, where the auto selection tends to grab the best quality one, even though you may want to keep those for more important uses (such as using a knife to remove the handle of a knife for salvage of the blade: you don't want to "salvage" your masterworks knife blade using a badly worn standard one).

I also know a "staff & spindle" mod object based on a staff has been an issue, as it has tended to be used rather than the "actual" staff I intended to be used.

Thus, the weight specification work around may have a wider application than just this case.

Roheline

« Reply #8 on: November 05, 2020, 11:39:36 PM »
Actually my original code used the generic {Pot} followed by the preferred tag <Clay pot> and as I recall it still did not force a selection. I could try going back to that just to make sure though.

In terms of the visual graphics, I've pretty much just accepted that my yarn object will be sitting there in the open and not technically inside the pot. Usually I drop the pot on top of it in order to simulate the pot being occupied as well, but since the dyeing process isn't a cooking process there's no way to force the pot to be there during my entire simulated fermentation/dye adhering time period.

Thanks for all your help! I guess it's nice I at least know what the issue is that I have 3 possible solutions: I can either avoid having filled pots in my inventory, use a vat for step 1 and a pot for step 2, or specify #s of pot in step 2 to force a selection. 

The other problem with using cookery is I have to make sure I don't accidentally eat my dyestocks, especially since some of my coded plants are actually poisonous!   ;D

Privateer

« Reply #9 on: November 06, 2020, 12:19:50 AM »
 You should be able to poof your flora 'items' after they have been defined and a game started eg:
Code: [Select]
.Wild Bee hive.      (1)    :28:  [berry]
[NAME:Honey comb]
[TILEGFX:h-comb]
etc. etc

Defined should allows for use of:
.honey combs.
to create your object, this can help a great deal when making and checking... and double checking things.
You may need to open a new character and save/load to get them in there.

Once they appear (game stores known / 'learned' objects here) in the "create_objects.txt" file they can be used.
« Last Edit: November 06, 2020, 12:21:35 AM by Privateer »
To help is it's own reward.
Mods:
https://www.unrealworld.fi/forums/index.php?action=profile;area=showposts;sa=attach;u=10 Player Quests, Arrow quiver, Bee hives honey & mead, Massive menus, Fish Farmer, Combat trainer, Player made markers, Weaving, Wood stacks, Chicken coop Fish cuts, string&bone.

Ezezaguna

« Reply #10 on: December 17, 2020, 11:01:55 PM »
This is great. I was thinking about doing the same dyeing mod and Privateer told me about this thread.

Also, I will leave this document here that I was reading about natural dyeing in Finland. It is worth reading  ;D: https://www.mediafire.com/file/qk6nhr1j7tomnqn/Dyes+methods+in+Iron+Age+Finland.pdf/file