OLC Section 8

From Immwiki
Jump to: navigation, search

Recipe Data

Overview

Recipes are stored on the crafted item--that is the result of the crafting combo. Ingredients are listed in the recipe, along with various other details.

The Recipe Data Viewer

 +----------------------------------------------------------------------------------+
 | Recipe Settings (Slot 0)                                                         |
 | Recipe type: 1                                     (Cooking)                     |
 | Flags:       [needs_fire cooking_kit use_keywords]                               |
 | Keyword 1:   cooking_barley                                                      |
 | Keyword 2:   cooking_mushroom                                                    |
 | Keyword 3:   (null)                                                              |
 | Keyword 4:   (null)                                                              |
 +----------------------------------------------------------------------------------+

This will appear in Oedit after you've started a recipe. To begin a recipe, you need to first declare its slot.

Recipe commands use the following format:

 recipe <command> <value>

Available Commands

Slot

Syntax: recipe slot <value>

This specifies which slot you are using. An item can have multiple recipes with different ingredient combinations that result in the same item. In prog, the craft_script correspond to the recipe slot, allowing a great deal of flexibility.

There is presumably a limit to the number of recipe slots an item may have. NINJA FILL IN HERE.

Type

Syntax: recipe type <value>

Specifies what skill the crafter will be using to craft the item. The types are (NOTE: these types are preliminary):

 1: Cooking. For edible and drinkable items.
 2: Alchemy. Potions and pills probably.
 3: Smithing. Armor and weapons.
 4: Tailoring. Clothes.
 5. Scribing. ????
Flags

Syntax: recipe flags <flag>

Recipe flags can alter the requirements or format for the recipe.

 needs_fire: An object with the extra flag fire must be present in the room, or the recipe will fail.
 cooking_kit: Crafter must have an object with the extra flag cooking_kit in their inventory, or the recipe will fail.
 use_keywords: By default, recipes want specific ingredient vnums. Use_Keywords swaps to using keywords. You can only use one of these modes at a time.
Comp

Syntax: recipe comp<value> <vnum>

Example: recipe comp1 17134

The recipe adds [17134] some broccoli to the ingredient list.

Short for component, comp uses an exact vnum to specify an ingredient. Use this when you want EXACTLY Nika's bacon and EXACTLY a griffin egg and EXACTLY an Uzith-Hazi mushroom. Comp accepts no substitutes. Comp can, however, hold multiple vnums on each comp slot.

Example: recipe comp2 7189 11396

The recipe adds [ 7189] a pink and green apple and [11396] a ripe red apple as interchangeable ingredients

Key

Syntax: recipe key<value> <keyword>

Example: recipe key1 cooking_broccoli

The recipe checks for anything with cooking_broccoli in its name.

Keywords are more flexible than comp, allowing you to specify a broad category of ingredient rather than an exact vnum. This lets you make apple pie from any apple, including apples added to the game after you built the pie.

See the Meow for Snack[1] spreadsheet for a list of known ingredients and their keywords. If you add an ingredient to the game, add it here!!!


Craft_script

A data_prog that corresponds to a recipe slot, the craft_script can do whatever an item prog can do, making it a nigh limitless way to add functionality to your recipes. Triggered when the corresponding recipe slot is completed, the craft_script will go through its lines and act on them like any other prog. NOTE: the craft_script will override the normal success echo, so be sure to include an echo to indicate success (or failure as the case may be--yes, you can force a fail due to whatever arcane specificities your dark heart desires).

 craft_script0: Corresponds to recipe slot 0.
 craft_script1: Corresponds to recipe slot 1.
 etc.

Example Walkthrough

Let's look at the recipe for [ 3588] sauteed broccoli in orange sauce.

 +----------------------------------------------------------------------------------+
 | Recipe Settings (Slot 0)                                                         |
 | Recipe type: 1                                     (Cooking)                     |
 | Flags:       [needs_fire cooking_kit use_keywords]                               |
 | Keyword 1:   cooking_broccoli                                                    |
 | Keyword 2:   cooking_orange                                                      |
 | Keyword 3:   cooking_bandor_spice_mix                                            |
 | Keyword 4:   (null)                                                              |
 +----------------------------------------------------------------------------------+
  • Slot 0: This is the default slot.
  • Recipe type: 1 (Cooking): We want this to check the cooking skill.
  • Needs_fire: Can't sautee without a heat source.
  • Cooking_kit: Can't sautee without a pan.
    • We're using our judgement here on realism vs. player convenience. This doesn't seem like something you can make with just your hands and no heat. Unlike i.e. sandwiches, players can't make this on the go.
  • Use_keywords: Several oranges already exist, and we want all of them to be valid for the recipe, so we're using keywords instead of vnums.
  • Keyword 1...3: We've checked to make sure these ingredient keywords are on existing items.
  • Keyword 4: We don't need a fourth ingredient, so we're leaving it blank.

Let's check if it works by loading the ingredients and cooking them.

 >cook broccoli orange mix
 You prepare some broccoli, an orange, and a pouch of Bandor spice mix for use.
 You prepare a heavy iron cooking kit to assist you.
 You set yourself before the grill to cook.
 You successfully produce sauteed broccoli in orange sauce!

This item will have an alternative recipe that produces a restringed object. Now we'll switch to the alternative recipe by typing recipe slot 1.

 >recipe slot 1
 Switching recipe slot.
 +----------------------------------------------------------------------------------+
 | Recipe Settings (Slot 1)                                                         |
 | Recipe type: 1                                     (Cooking)                     |
 | Flags:       [needs_fire cooking_kit use_keywords]                               |
 | Keyword 1:   cooking_asparagus                                                   |
 | Keyword 2:   cooking_orange                                                      |
 | Keyword 3:   cooking_bandor_spice_mix                                            |
 | Keyword 4:   (null)                                                              |
 +----------------------------------------------------------------------------------+
  • Keyword 1: cooking_asparagus is the only change. The rest we'll copy over from slot 0.

By default, the different slots will craft the same item, in this case, sauteed broccoli in orange sauce. However, we want slot 1 to produce sauteed asparagus in orange sauce. We'll restring this bad boy in data_prog craft_script1, the craft script that corresponds to recipe slot 1. Remember, we need to add the success echo!

 >data_prog craft_script1
 mpstring obj self name asparagus plate orange sauce gourmet sauteed
 mpstring obj self short sauteed asparagus in orange sauce
 mpstring obj self long A plate of sauteed asparagus in orange sauce sits here.
 mpechoat $n You made $I!

Which in play produces...

 >cook orange asparagus mix
 You prepare a reddish blood orange, a small bundle of asparagus, and a pouch of Bandor spice mix for use.
 You prepare a heavy iron cooking kit to assist you.
 You set yourself before the grill to cook.
 You made sauteed asparagus in orange sauce!