1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't Unregister A Recipe

Discussion in 'Skript' started by BaddCamden, Jan 13, 2020.

  1. BaddCamden

    BaddCamden Active Member

    Joined:
    Nov 18, 2019
    Messages:
    25
    Likes Received:
    0
    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 (Text):
    1. on load:
    2.   if {recipenumber} is not set:
    3.     set {recipenumber} to 0
    4.   loop all players:
    5.     set {ingui.%loop-player%} to false
    6.  
    7. command /resetrecipe [<string>]:
    8.   permission: staff.recipemaker
    9.   trigger:
    10.     if arg-1 is "all":
    11.       set {_recipescovered} to 0
    12.         add 1 to {_recipescovered}
    13.       set {recipeitems::*} to air
    14.       set {recipenumber} to 0
    15.       set {recipecrafts::*} to 0
    16.       send "&aCleared all recipes!" to player
    17.  
    18.  
    19.  
    20. command /recipegui:
    21.   trigger:
    22.     wait 3 ticks
    23.     set {ingui.%player%} to true
    24.     open chest with 6 rows named "&aRecipes" to player
    25.     set {_inventorycovered} to 0
    26.     loop 54 times:
    27.       set slot {_inventorycovered} of player's current inventory to black stained glass pane named "&8Empty Slot"
    28.       add 1 to {_inventorycovered}
    29.     set {_inventorycovered} to 0
    30.     loop {recipenumber} times:
    31.       set slot {_inventorycovered} of player's current inventory to {recipecrafts::%{_inventorycovered}%} named "&7Recipe %{_inventorycovered}%"
    32.       add 1 to {_inventorycovered}
    33.  
    34.  
    35. command /addrecipe [<string>]:
    36.   permission: staff.recipemaker
    37.   trigger:
    38.  
    39.     open chest with 3 rows named "&aRecipe Maker" to player
    40.     if arg-1 is "Shapeless":
    41.       set {shape::%{recipenumber}%} to "Shapeless"
    42.     if arg-1 is "Solid":
    43.       set {shape::%{recipenumber}%} to "Shaped"
    44.     if arg-1 is "Shaped":
    45.       set {shape::%{recipenumber}%} to "Shaped"
    46.     set {inmaker.%player%} to true
    47.     set {_slotempty} to 0
    48.     loop 27 times:
    49.       set slot {_slotempty} of player's current inventory to black stained glass pane named "&8Empty Slot"
    50.       add 1 to {_slotempty}
    51.     set slot 3 of player's current inventory to air
    52.     set slot 4 of player's current inventory to air
    53.     set slot 5 of player's current inventory to air
    54.     set slot 12 of player's current inventory to air
    55.     set slot 13 of player's current inventory to air
    56.     set slot 14 of player's current inventory to air
    57.     set slot 16 of player's current inventory to air
    58.     set slot 21 of player's current inventory to air
    59.     set slot 22 of player's current inventory to air
    60.     set slot 23 of player's current inventory to air
    61.  
    62. on inventory click:
    63.   if name of clicked item is "&8Empty Slot":
    64.     cancel event
    65.   if {ingui.%player%} is true:
    66.     if clicked slot is 3:
    67.       cancel event
    68.     if clicked slot is 4:
    69.       cancel event
    70.     if clicked slot is 5:
    71.       cancel event
    72.     if clicked slot is 12:
    73.       cancel event
    74.     if clicked slot is 13:
    75.       cancel event
    76.     if clicked slot is 14:
    77.       cancel event
    78.     if clicked slot is 16:
    79.       cancel event
    80.     if clicked slot is 21:
    81.       cancel event
    82.     if clicked slot is 22:
    83.       cancel event
    84.     if clicked slot is 23:
    85.       cancel event
    86.     set {_inventorycovered} to 0
    87.     loop {recipenumber} times:
    88.       if clicked slot is {_inventorycovered}:
    89.         cancel event                    
    90.         close player's inventory
    91.         wait 3 ticks
    92.         open chest with 3 rows named "&aRecipe %{_inventorycovered}%" to player
    93.         set {_slotempty} to 0
    94.         loop 27 times:
    95.           set slot {_slotempty} of player's current inventory to black stained glass pane named "&8Empty Slot"
    96.           add 1 to {_slotempty}
    97.         set slot 3 of player's current inventory to {recipeitems::%{_inventorycovered}%::3}
    98.         set slot 4 of player's current inventory to {recipeitems::%{_inventorycovered}%::4}
    99.         set slot 5 of player's current inventory to {recipeitems::%{_inventorycovered}%::5}
    100.         set slot 12 of player's current inventory to {recipeitems::%{_inventorycovered}%::12}
    101.         set slot 13 of player's current inventory to {recipeitems::%{_inventorycovered}%::13}
    102.         set slot 14 of player's current inventory to {recipeitems::%{_inventorycovered}%::14}
    103.         set slot 16 of player's current inventory to {recipecrafts::%{_inventorycovered}%}
    104.         set slot 21 of player's current inventory to {recipeitems::%{_inventorycovered}%::21}
    105.         set slot 22 of player's current inventory to {recipeitems::%{_inventorycovered}%::22}
    106.         set slot 23 of player's current inventory to {recipeitems::%{_inventorycovered}%::23}
    107.  
    108.  
    109.       add 1 to {_inventorycovered}
    110. on inventory close:
    111.   if {inmaker.%player%} is true:
    112.     loop 27 times:
    113.       if slot {_inventorycovered} of player's current inventory isn't black stained glass pane:
    114.         if {_inventorycovered} isn't 16:
    115.           set {_iteminslot} to slot {_inventorycovered} of player's current inventory
    116.           set {recipeitems::%{recipenumber}%::%{_inventorycovered}%} to {_iteminslot}
    117.         else:
    118.           set {recipecrafts::%{recipenumber}%} to slot {_inventorycovered} of player's current inventory
    119.       add 1 to {_inventorycovered}
    120.     if {recipeitems::%{recipenumber}%::*} is air, air, air, air, air, air, air, air, and air:
    121.       set {recipenumber} to {recipenumber} - 1
    122.     else if {recipecrafts::%{recipenumber}%} is air:
    123.       set {recipenumber} to {recipenumber} - 1
    124.     set {_inventorycovered} to 0
    125.     broadcast "Recipe %{recipeitems::%{recipenumber}%::*}% with %{shape::%{recipenumber}%}% property"
    126.     broadcast "crafts: %{recipecrafts::%{recipenumber}%}%"
    127.     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})
    128.     broadcast "it works!"
    129.  
    130.     set {inmaker.%player%} to false
    131.     add 1 to {recipenumber}
    132.  
    133.   if {ingui.%player%} is true:
    134.     if {inguifailsafe.%player%} is true:
    135.       set {inguifailsafe.%player%} to false
    136.       set {ingui.%player%} to false
    137.     set {inguifailsafe.%player%} to true
    Researched the problem? Yes

    Plugins: skript, skquery, skrayfall, skdragon, skutilities, skvault, TuSKe (though i don't use it)
     
    #1 BaddCamden, Jan 13, 2020
    Last edited: Jan 13, 2020
  2. Goose

    Goose Well-Known Member

    Joined:
    Nov 23, 2019
    Messages:
    185
    Likes Received:
    7
    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.
     
  3. BaddCamden

    BaddCamden Active Member

    Joined:
    Nov 18, 2019
    Messages:
    25
    Likes Received:
    0
    Ok, i did
    --- Double Post Merged, Jan 18, 2020, Original Post Date: Jan 14, 2020 ---
    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?
     
  4. Goose

    Goose Well-Known Member

    Joined:
    Nov 23, 2019
    Messages:
    185
    Likes Received:
    7
    Use TuSKe :emoji_stuck_out_tongue:
     
  5. BaddCamden

    BaddCamden Active Member

    Joined:
    Nov 18, 2019
    Messages:
    25
    Likes Received:
    0
    Goose, would i have to change any code? If so, any suggestions on how to do so?
    (Also, how do i use TuSKe...?)
     
Loading...