Can't Unregister A Recipe

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

BaddCamden

Member
Nov 18, 2019
25
0
0
America
I am making a "Recipe Sorter" where you can make and view recipes externally, but for some reason, when i try to unregister recipes, the recipes either won't. When I make the recipe's craftable item into air, it says "Internal error" in chat. I try to set the variables back to air, but it won't change the recipes. Help!


Code:
Code:
on load:
  if {recipenumber} is not set:
    set {recipenumber} to 0
  loop all players:
    set {ingui.%loop-player%} to false

command /resetrecipe [<string>]:
  permission: staff.recipemaker
  trigger:
    if arg-1 is "all":
      set {_recipescovered} to 0
        add 1 to {_recipescovered}
      set {recipeitems::*} to air
      set {recipenumber} to 0
      set {recipecrafts::*} to 0
      send "&aCleared all recipes!" to player

 

command /recipegui:
  trigger:
    wait 3 ticks
    set {ingui.%player%} to true
    open chest with 6 rows named "&aRecipes" to player
    set {_inventorycovered} to 0
    loop 54 times:
      set slot {_inventorycovered} of player's current inventory to black stained glass pane named "&8Empty Slot"
      add 1 to {_inventorycovered}
    set {_inventorycovered} to 0
    loop {recipenumber} times:
      set slot {_inventorycovered} of player's current inventory to {recipecrafts::%{_inventorycovered}%} named "&7Recipe %{_inventorycovered}%"
      add 1 to {_inventorycovered}


command /addrecipe [<string>]:
  permission: staff.recipemaker
  trigger:
 
    open chest with 3 rows named "&aRecipe Maker" to player
    if arg-1 is "Shapeless":
      set {shape::%{recipenumber}%} to "Shapeless"
    if arg-1 is "Solid":
      set {shape::%{recipenumber}%} to "Shaped"
    if arg-1 is "Shaped":
      set {shape::%{recipenumber}%} to "Shaped"
    set {inmaker.%player%} to true
    set {_slotempty} to 0
    loop 27 times:
      set slot {_slotempty} of player's current inventory to black stained glass pane named "&8Empty Slot"
      add 1 to {_slotempty}
    set slot 3 of player's current inventory to air
    set slot 4 of player's current inventory to air
    set slot 5 of player's current inventory to air
    set slot 12 of player's current inventory to air
    set slot 13 of player's current inventory to air
    set slot 14 of player's current inventory to air
    set slot 16 of player's current inventory to air
    set slot 21 of player's current inventory to air
    set slot 22 of player's current inventory to air
    set slot 23 of player's current inventory to air

on inventory click:
  if name of clicked item is "&8Empty Slot":
    cancel event
  if {ingui.%player%} is true:
    if clicked slot is 3:
      cancel event
    if clicked slot is 4:
      cancel event
    if clicked slot is 5:
      cancel event
    if clicked slot is 12:
      cancel event
    if clicked slot is 13:
      cancel event
    if clicked slot is 14:
      cancel event
    if clicked slot is 16:
      cancel event
    if clicked slot is 21:
      cancel event
    if clicked slot is 22:
      cancel event
    if clicked slot is 23:
      cancel event
    set {_inventorycovered} to 0
    loop {recipenumber} times:
      if clicked slot is {_inventorycovered}:
        cancel event                     
        close player's inventory
        wait 3 ticks
        open chest with 3 rows named "&aRecipe %{_inventorycovered}%" to player
        set {_slotempty} to 0
        loop 27 times:
          set slot {_slotempty} of player's current inventory to black stained glass pane named "&8Empty Slot"
          add 1 to {_slotempty}
        set slot 3 of player's current inventory to {recipeitems::%{_inventorycovered}%::3}
        set slot 4 of player's current inventory to {recipeitems::%{_inventorycovered}%::4}
        set slot 5 of player's current inventory to {recipeitems::%{_inventorycovered}%::5}
        set slot 12 of player's current inventory to {recipeitems::%{_inventorycovered}%::12}
        set slot 13 of player's current inventory to {recipeitems::%{_inventorycovered}%::13}
        set slot 14 of player's current inventory to {recipeitems::%{_inventorycovered}%::14}
        set slot 16 of player's current inventory to {recipecrafts::%{_inventorycovered}%}
        set slot 21 of player's current inventory to {recipeitems::%{_inventorycovered}%::21}
        set slot 22 of player's current inventory to {recipeitems::%{_inventorycovered}%::22}
        set slot 23 of player's current inventory to {recipeitems::%{_inventorycovered}%::23}

  
      add 1 to {_inventorycovered}
on inventory close:
  if {inmaker.%player%} is true:
    loop 27 times:
      if slot {_inventorycovered} of player's current inventory isn't black stained glass pane:
        if {_inventorycovered} isn't 16:
          set {_iteminslot} to slot {_inventorycovered} of player's current inventory
          set {recipeitems::%{recipenumber}%::%{_inventorycovered}%} to {_iteminslot}
        else:
          set {recipecrafts::%{recipenumber}%} to slot {_inventorycovered} of player's current inventory
      add 1 to {_inventorycovered}
    if {recipeitems::%{recipenumber}%::*} is air, air, air, air, air, air, air, air, and air:
      set {recipenumber} to {recipenumber} - 1
    else if {recipecrafts::%{recipenumber}%} is air:
      set {recipenumber} to {recipenumber} - 1
    set {_inventorycovered} to 0
    broadcast "Recipe %{recipeitems::%{recipenumber}%::*}% with %{shape::%{recipenumber}%}% property"
    broadcast "crafts: %{recipecrafts::%{recipenumber}%}%"
    register new shapeless recipe for ({recipecrafts::%{recipenumber}%}) using ({recipeitems::%{recipenumber}%::3}), ({recipeitems::%{recipenumber}%::4}), ({recipeitems::%{recipenumber}%::5}), ({recipeitems::%{recipenumber}%::12}), ({recipeitems::%{recipenumber}%::13}), ({recipeitems::%{recipenumber}%::14}), ({recipeitems::%{recipenumber}%::21}), ({recipeitems::%{recipenumber}%::22}), ({recipeitems::%{recipenumber}%::23})
    broadcast "it works!"
 
    set {inmaker.%player%} to false
    add 1 to {recipenumber}
 
  if {ingui.%player%} is true:
    if {inguifailsafe.%player%} is true:
      set {inguifailsafe.%player%} to false
      set {ingui.%player%} to false
    set {inguifailsafe.%player%} to true

Researched the problem? Yes

Plugins: skript, skquery, skrayfall, skdragon, skutilities, skvault, TuSKe (though i don't use it)
 
Last edited:
Please format the code using code blocks, it makes it easier to read and that way you can have indentation be shown making it a billion times easier to understand.
 
Ok, i did
[doublepost=1579315067,1579040546][/doublepost]I haven't seen any answers to this question without causing memory leaks, too much complicity, or is just plain impossible. I don't think error can be fixed without some plugin like WildSkript, but WildSkript hasn't been updated from 1.12 yet, and never will. Any plugin suggestions that could fix my problem?
 
Ok, i did
[doublepost=1579315067,1579040546][/doublepost]I haven't seen any answers to this question without causing memory leaks, too much complicity, or is just plain impossible. I don't think error can be fixed without some plugin like WildSkript, but WildSkript hasn't been updated from 1.12 yet, and never will. Any plugin suggestions that could fix my problem?
Use TuSKe :emoji_stuck_out_tongue:
 
Status
Not open for further replies.