Technical issues with Szyu's Crafting system script

Hello, first-time poster here in need of some scripting assistance.

Hi, name's Midashe (Username at least) and I need some help regarding Szyu's Crafting system script, link below to their thread for easy access.

https://forums.rpgmakerweb.com/index.php?threads/szyus-crafting-system.31377/

I basically have two issues with this script. The first and main issue is that I can't get it to properly work (Most likely and hopefully something I'm doing wrong). The second issue is that I want to expand its functionality a little but I couldn't script to save my life so I have no idea how to do that. So, one at a time.

[SOLVED]Issue 1: I can't get categories to work. [SOLVED]
Szyu's crafting system script has this feature that allows you to create custom crafting categories (Like cooking, smithing or even blublublu if that's what you want). You don't have to use this feature however and can instead open the crafting window with all unlocked recipés available. I've chosen not to do that and instead use custom categories. Thing is, opening the crafting window with all recipés works fine but when I try to use categories, none of the recipés show up. The window itself opens up but the recipés are not there. I've tried following the instructions that come with the script but they seem to lack details and may even contradict themselves. Here, I'll try to give an example of how I set things up.
Within the script
CRAFTING_CATEGORIES = ["Cooking","Smithing"]

Item notetagging
001: Potion
<category: Cooking>
<ingredients>
i: 2x 5
</ingredients>
010: Recipé book
<recipe book>
<recipes>
i: 1
</recipes>

Scriptcall used to open crafting window
SceneManager.call(Scene_Crafting, "Cooking")
OR
SceneManager.call(Scene_Crafting)
When I use the second scriptcall (Uncategorized) it works just fine but when I use the first scriptcall (Categorized) the recipés just won't show up. The window shows up but the recipés don't. I've tried rearranging the notetags, I've tried with and without quotation marks but I just can't get it to work. Anyone have any idea what I'm doing wrong?

Issue 2: Crafting yields only one item.
You can define how many ingredients are required, you can make a crafting recipé require several of one item to craft as well as several of several different items, it can even require weapons or armour and even money. This is all well and good but no matter how much the item requires to be crafted, the result will always be one of that item. Here, example, let's make a 'sandwich'. To make a sandwich you will need a 'loaf of bread' a 'chunk of meat' a 'box of butter' and a 'chunk of cheese'. Now, with all of that, you'd expect to be able to make several sandwiches. However, this script limits you to make only one sandwich. That's what I want to improve. I want to create a new notetag for the script that allows me to determine how many of the same item the crafting yields. Anyone have any idea how to accomplish this? I sure as heck don't.

There, those are the issues I need help with. I really hope someone can help me with this 'cause I've already implemented this script into my game to several points of no return. I really don't wanna go back to crafting through eventing *Shudder*. Thanks for listening.

I've moved this thread to Script Support. Thank you.

Okay, so, umm... After some extensive testing I finally managed to get the script to work. I had made a lot of errors but that's all fixed now and the script works just fine. So, that takes care of issue 1. All I need now is a solution for issue 2, which I'm still waiting for. Just thought I'd put up such an update.
Place <craft quantity: X> on the item to get crafted more than one.
Code:
##    use the following:
##    <craft quantity: X>  where X is the number of items to craft

module R2
  module Craft_Quantity
    Regex = /<craft[-_ ]quantity:[-_ ]\s*(\d+)\s*>/imx
  end
end

class Scene_Crafting < Scene_ItemBase
def craft_item
    item = @item_window.item
    gi = 1
    item.ingredients.each do |ing|
      if ing[0].is_a?(RPG::BaseItem)
        $game_party.lose_item(ing[0],ing[1])
      else
        $game_party.lose_gold(ing[1])
      end
    end
    results = item.note.scan(R2::Craft_Quantity::Regex)
    results.each do |res|
      gi = res[0].to_i
    end
    $game_party.gain_item(item,gi)
    
    if @cr_category != -1
      csf = CUSTOM_CRAFT_SOUNDS_BY_CAT[@cr_category]
    else
      if item.is_a?(RPG::Item)
        csf = CUSTOM_CRAFT_SOUNDS_BY_TYPE[0]
      elsif item.is_a?(RPG::Weapon)
        csf = CUSTOM_CRAFT_SOUNDS_BY_TYPE[1]
      elsif item.is_a?(RPG::Armor)
        csf = CUSTOM_CRAFT_SOUNDS_BY_TYPE[2]
      end
    end
    RPG::SE.new(csf, 100, 50).play
    
    @item_window.refresh
    @item_window.activate
  end
end
Thanks Roninator2, works like a charm.
So i'm trying to use this but whenever I have the items to craft the said thing, it doesn't work. It says I have 0/1 of items but the thing is I have the items but it won't let me craft. Why is this?

@Watson2345 , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please start a new thread if you are having some similar issues.

I'm closing this thread.

Original thread: https://forums.rpgmakerweb.com/threads/technical-issues-with-szyus-crafting-system-script.110686/