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 out 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.

How can i make my code look cleaner?

Discussion in 'Skript' started by Haloxx, Jun 19, 2021.

Thread Status:
Not open for further replies.
  1. Haloxx

    Haloxx Member

    Joined:
    May 2, 2021
    Messages:
    20
    Likes Received:
    0
    i have this long annoying code and it works but it looks like a 5 year old made it

    Code (Text):
    1. on mine of any ore:
    2.   player is sneaking:
    3.     if event-block is iron ore:
    4.       cancel event
    5.       loop blocks in radius 2 around event-block:
    6.         if loop-blocks is iron ore:
    7.           loop blocks in radius 2 of loop-blocks:
    8.             if loop-block-2 is iron ore:
    9.               break event-block using player's tool
    10.               break loop-blocks-2 using player's tool
    11.               loop blocks in radius 2 of loop-block-2:
    12.                 if loop-block-3 is iron ore:
    13.                   break loop-block-3 using player's tool
    14.                   loop blocks in radius 2 of loop-block-3:
    15.                     if loop-block-4 is iron ore:
    16.                       break loop-block-4 using player's tool
    17.                       loop blocks in radius 2 of loop-block-4:
    18.                         if loop-block-5 is iron ore:
    19.                           break loop-block-5 using player's tool
    20.                           loop blocks in radius 2 of loop-blocks-5:
    21.                             if loop-blocks-6 is iron ore:
    22.                               break loop-blocks-6 using player's tool
    23.                             loop blocks in radius 2 of loop-blocks-6:
    24.                               if loop-blocks-7 is iron ore:
    25.                                 break loop-blocks-7 using player's tool
    26.                               loop blocks in radius 2 of loop-blocks-7:
    27.                                 if loop-blocks-8 is iron ore:
    28.                                   break loop-blocks-8 using player's tool
    29.                                   loop blocks in radius 2 of loop-blocks-8:
    30.                                     if loop-blocks-9 is iron ore:
    31.                                       break loop-blocks-9 using player's tool
    32.                                       loop blocks in radius 2 of loop-blocks-9:
    33.                                         if loop-blocks-10 is iron ore:
    34.                                           break loop-blocks-10 using player's tool
     
  2. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Is this a vein miner?
     
  3. Haloxx

    Haloxx Member

    Joined:
    May 2, 2021
    Messages:
    20
    Likes Received:
    0
    Yes it took me a long time to figure it out even if it wasn’t all complete
     
  4. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    I'm pretty sure this will cause many errors and might not work, but you might get what I wanted to try
    Code (Text):
    1. on break of any ore:
    2.   loop blocks in radius 2 around event-block:
    3.     if loop-block is any ore:
    4.       add location of loop-block to {_ores::*}
    5.       set {_last} to location of loop-block
    6.       loop 5 times:
    7.         loop blocks in radius 2 around {_last}:
    8.           set {_last} to location of loop-block
    9.           if loop-block is any ore:
    10.             add location of loop-block to {_ores::*}
    11.   loop {_ores::*}:
    12.     break loop-block using player's tool
    but keep in mind: never change a running system
     
  5. Haloxx

    Haloxx Member

    Joined:
    May 2, 2021
    Messages:
    20
    Likes Received:
    0
    Ok going to try later because it’s getting late for me
    --- Double Post Merged, Jun 20, 2021, Original Post Date: Jun 19, 2021 ---
    Yeah didn't work my code is 272 lines and just a repeat but with a different ore but it works

    Code (Text):
    1. on mine of any ore:
    2.   player is sneaking:
    3.     if event-block is iron ore:
    4.       cancel event
    5.       loop blocks in radius 2 around event-block:
    6.         if loop-blocks is iron ore:
    7.           loop blocks in radius 2 of loop-blocks:
    8.             if loop-block-2 is iron ore:
    9.               break event-block using player's tool
    10.               break loop-blocks-2 using player's tool
    11.               loop blocks in radius 2 of loop-block-2:
    12.                 if loop-block-3 is iron ore:
    13.                   break loop-block-3 using player's tool
    14.                   loop blocks in radius 2 of loop-block-3:
    15.                     if loop-block-4 is iron ore:
    16.                       break loop-block-4 using player's tool
    17.                       loop blocks in radius 2 of loop-block-4:
    18.                         if loop-block-5 is iron ore:
    19.                           break loop-block-5 using player's tool
    20.                           loop blocks in radius 2 of loop-blocks-5:
    21.                             if loop-blocks-6 is iron ore:
    22.                               break loop-blocks-6 using player's tool
    23.                             loop blocks in radius 2 of loop-blocks-6:
    24.                               if loop-blocks-7 is iron ore:
    25.                                 break loop-blocks-7 using player's tool
    26.                               loop blocks in radius 2 of loop-blocks-7:
    27.                                 if loop-blocks-8 is iron ore:
    28.                                   break loop-blocks-8 using player's tool
    29.                                   loop blocks in radius 2 of loop-blocks-8:
    30.                                     if loop-blocks-9 is iron ore:
    31.                                       break loop-blocks-9 using player's tool
    32.                                       loop blocks in radius 2 of loop-blocks-9:
    33.                                         if loop-blocks-10 is iron ore:
    34.                                           break loop-blocks-10 using player's tool
    35. on mine of any ore:
    36.   player is sneaking:
    37.     if event-block is coal ore:
    38.       cancel event
    39.       loop blocks in radius 2 around event-block:
    40.         if loop-blocks is coal ore:
    41.           loop blocks in radius 2 of loop-blocks:
    42.             if loop-block-2 is coal ore:
    43.               break event-block using player's tool
    44.               break loop-blocks-2 using player's tool
    45.               loop blocks in radius 2 of loop-block-2:
    46.                 if loop-block-3 is coal ore:
    47.                   break loop-block-3 using player's tool
    48.                   loop blocks in radius 2 of loop-block-3:
    49.                     if loop-block-4 is coal ore:
    50.                       break loop-block-4 using player's tool
    51.                       loop blocks in radius 2 of loop-block-4:
    52.                         if loop-block-4 is coal ore:
    53.                           break loop-block-5 using player's tool
    54.                           loop blocks in radius 2 of loop-blocks-5:
    55.                             if loop-blocks-6 is coal ore:
    56.                               break loop-blocks-6 using player's tool
    57.                               loop blocks in radius 2 of loop-blocks-6:
    58.                                 if loop-blocks-7 is coal ore:
    59.                                   break loop-blocks-7 using player's tool
    60.                                   loop blocks in radius 2 of loop-blocks-7:
    61.                                     if loop-blocks-8 is coal ore:
    62.                                       break loop-blocks-8 using player's tool
    63.                                       loop blocks in radius 2 of loop-blocks-8:
    64.                                         if loop-blocks-9 is coal ore:
    65.                                           break loop-blocks-9 using player's tool
    66.                                           loop blocks in radius 2 of loop-blocks-9:
    67.                                             if loop-blocks-10 is coal ore:
    68.                                               break loop-blocks-10 using player's tool
    69. on mine of any ore:
    70.   player is sneaking:
    71.     if event-block is gold ore:
    72.       cancel event
    73.       loop blocks in radius 2 around event-block:
    74.         if loop-blocks is gold ore:
    75.           loop blocks in radius 2 of loop-blocks:
    76.             if loop-block-2 is gold ore:
    77.               break event-block using player's tool
    78.               break loop-blocks-2 using player's tool
    79.               loop blocks in radius 2 of loop-block-2:
    80.                 if loop-block-3 is gold ore:
    81.                   break loop-block-3 using player's tool
    82.                   loop blocks in radius 2 of loop-block-3:
    83.                     if loop-block-4 is gold ore:
    84.                       break loop-block-4 using player's tool
    85.                       loop blocks in radius 2 of loop-block-4:
    86.                         if loop-block-5 is gold ore:
    87.                           break loop-block-5 using player's tool
    88.                           loop blocks in radius 2 of loop-blocks-5:
    89.                             if loop-blocks-6 is gold ore:
    90.                               break loop-blocks-6 using player's tool
    91.                               loop blocks in radius 2 of loop-blocks-6:
    92.                                 if loop-blocks-7 is gold ore:
    93.                                   break loop-blocks-7 using player's tool
    94.                                   loop blocks in radius 2 of loop-blocks-7:
    95.                                     if loop-blocks-8 is gold ore:
    96.                                       break loop-blocks-8 using player's tool
    97.                                       loop blocks in radius 2 of loop-blocks-8:
    98.                                         if loop-blocks-9 is gold ore:
    99.                                           break loop-blocks-9 using player's tool
    100.                                           loop blocks in radius 2 of loop-blocks-9:
    101.                                             if loop-blocks-10 is gold ore:
    102.                                               break loop-blocks-10 using player's tool
    103. on mine of any ore:
    104.   player is sneaking:
    105.     if event-block is emerald ore:
    106.       cancel event
    107.       loop blocks in radius 2 around event-block:
    108.         if loop-blocks is emerald ore:
    109.           loop blocks in radius 2 of loop-blocks:
    110.             if loop-block-2 is emerald ore:
    111.               break event-block using player's tool
    112.               break loop-blocks-2 using player's tool
    113.               loop blocks in radius 2 of loop-block-2:
    114.                 if loop-block-3 is emerald ore:
    115.                   break loop-block-3 using player's tool
    116.                   loop blocks in radius 2 of loop-block-3:
    117.                     if loop-block-4 is emerald ore:
    118.                       break loop-block-4 using player's tool
    119.                       loop blocks in radius 2 of loop-block-4:
    120.                         if loop-block-5 is emerald ore:
    121.                           break loop-block-5 using player's tool
    122.                           loop blocks in radius 2 of loop-blocks-5:
    123.                             if loop-blocks-6 is emerald ore:
    124.                               break loop-blocks-6 using player's tool
    125.                               loop blocks in radius 2 of loop-blocks-6:
    126.                                 if loop-blocks-7 is emerald ore:
    127.                                   break loop-blocks-7 using player's tool
    128.                                   loop blocks in radius 2 of loop-blocks-7:
    129.                                     if loop-blocks-8 is emerald ore:
    130.                                       break loop-blocks-8 using player's tool
    131.                                       loop blocks in radius 2 of loop-blocks-8:
    132.                                         if loop-blocks-9 is emerald ore:
    133.                                           break loop-blocks-9 using player's tool
    134.                                           loop blocks in radius 2 of loop-blocks-9:
    135.                                             if loop-blocks-10 is emerald ore:
    136.                                               break loop-blocks-10 using player's tool
    137. on mine of any ore:
    138.   player is sneaking:
    139.     if event-block is lapis ore:
    140.       cancel event
    141.       loop blocks in radius 2 around event-block:
    142.         if loop-blocks is lapis ore:
    143.           loop blocks in radius 2 of loop-blocks:
    144.             if loop-block-2 is lapis ore:
    145.               break event-block using player's tool
    146.               break loop-blocks-2 using player's tool
    147.               loop blocks in radius 2 of loop-block-2:
    148.                 if loop-block-3 is lapis ore:
    149.                   break loop-block-3 using player's tool
    150.                   loop blocks in radius 2 of loop-block-3:
    151.                     if loop-block-4 is lapis ore:
    152.                       break loop-block-4 using player's tool
    153.                       loop blocks in radius 2 of loop-block-4:
    154.                         if loop-block-5 is lapis ore:
    155.                           break loop-block-5 using player's tool
    156.                           loop blocks in radius 2 of loop-blocks-5:
    157.                             if loop-blocks-6 is lapis ore:
    158.                               break loop-blocks-6 using player's tool
    159.                               loop blocks in radius 2 of loop-blocks-6:
    160.                                 if loop-blocks-7 is lapis ore:
    161.                                   break loop-blocks-7 using player's tool
    162.                                   loop blocks in radius 2 of loop-blocks-7:
    163.                                     if loop-blocks-8 is lapis ore:
    164.                                       break loop-blocks-8 using player's tool
    165.                                       loop blocks in radius 2 of loop-blocks-8:
    166.                                         if loop-blocks-9 is lapis ore:
    167.                                           break loop-blocks-9 using player's tool
    168.                                           loop blocks in radius 2 of loop-blocks-9:
    169.                                             if loop-blocks-10 is lapis ore:
    170.                                               break loop-blocks-10 using player's tool
    171. on mine of any ore:
    172.   player is sneaking:
    173.     if event-block is redstone ore:
    174.       cancel event
    175.       loop blocks in radius 2 around event-block:
    176.         if loop-blocks is redstone ore:
    177.           loop blocks in radius 2 of loop-blocks:
    178.             if loop-block-2 is redstone ore:
    179.               break event-block using player's tool
    180.               break loop-blocks-2 using player's tool
    181.               loop blocks in radius 2 of loop-block-2:
    182.                 if loop-block-3 is redstone ore:
    183.                   break loop-block-3 using player's tool
    184.                   loop blocks in radius 2 of loop-block-3:
    185.                     if loop-block-4 is redstone ore:
    186.                       break loop-block-4 using player's tool
    187.                       loop blocks in radius 2 of loop-block-4:
    188.                         if loop-block-5 is redstone ore:
    189.                           break loop-block-5 using player's tool
    190.                           loop blocks in radius 2 of loop-blocks-5:
    191.                             if loop-blocks-6 is redstone ore:
    192.                               break loop-blocks-6 using player's tool
    193.                               loop blocks in radius 2 of loop-blocks-6:
    194.                                 if loop-blocks-7 is redstone ore:
    195.                                   break loop-blocks-7 using player's tool
    196.                                   loop blocks in radius 2 of loop-blocks-7:
    197.                                     if loop-blocks-8 is redstone ore:
    198.                                       break loop-blocks-8 using player's tool
    199.                                       loop blocks in radius 2 of loop-blocks-8:
    200.                                         if loop-blocks-9 is redstone ore:
    201.                                           break loop-blocks-9 using player's tool
    202.                                           loop blocks in radius 2 of loop-blocks-9:
    203.                                             if loop-blocks-10 is redstone ore:
    204.                                               break loop-blocks-10 using player's tool
    205. on mine of any ore:
    206.   player is sneaking:
    207.     if event-block is diamond ore:
    208.       cancel event
    209.       loop blocks in radius 2 around event-block:
    210.         if loop-blocks is diamond ore:
    211.           loop blocks in radius 2 of loop-blocks:
    212.             if loop-block-2 is diamond ore:
    213.               break event-block using player's tool
    214.               break loop-blocks-2 using player's tool
    215.               loop blocks in radius 2 of loop-block-2:
    216.                 if loop-block-3 is diamond ore:
    217.                   break loop-block-3 using player's tool
    218.                   loop blocks in radius 2 of loop-block-3:
    219.                     if loop-block-4 is diamond ore:
    220.                       break loop-block-4 using player's tool
    221.                       loop blocks in radius 2 of loop-block-4:
    222.                         if loop-block-5 is diamond ore:
    223.                           break loop-block-5 using player's tool
    224.                           loop blocks in radius 2 of loop-blocks-5:
    225.                             if loop-blocks-6 is diamond ore:
    226.                               break loop-blocks-6 using player's tool
    227.                               loop blocks in radius 2 of loop-blocks-6:
    228.                                 if loop-blocks-7 is diamond ore:
    229.                                   break loop-blocks-7 using player's tool
    230.                                   loop blocks in radius 2 of loop-blocks-7:
    231.                                     if loop-blocks-8 is diamond ore:
    232.                                       break loop-blocks-8 using player's tool
    233.                                       loop blocks in radius 2 of loop-blocks-8:
    234.                                         if loop-blocks-9 is diamond ore:
    235.                                           break loop-blocks-9 using player's tool
    236.                                           loop blocks in radius 2 of loop-blocks-9:
    237.                                             if loop-blocks-10 is diamond ore:
    238.                                               break loop-blocks-10 using player's tool
    239. on mine of any ore:
    240.   player is sneaking:
    241.     if event-block is nether quartz ore:
    242.       cancel event
    243.       loop blocks in radius 2 around event-block:
    244.         if loop-blocks is nether quartz ore:
    245.           loop blocks in radius 2 of loop-blocks:
    246.             if loop-block-2 is nether quartz ore:
    247.               break event-block using player's tool
    248.               break loop-blocks-2 using player's tool
    249.               loop blocks in radius 2 of loop-block-2:
    250.                 if loop-block-3 is nether quartz ore:
    251.                   break loop-block-3 using player's tool
    252.                   loop blocks in radius 2 of loop-block-3:
    253.                     if loop-block-4 is nether quartz ore:
    254.                       break loop-block-4 using player's tool
    255.                       loop blocks in radius 2 of loop-block-4:
    256.                         if loop-block-5 is nether quartz ore:
    257.                           break loop-block-5 using player's tool
    258.                           loop blocks in radius 2 of loop-blocks-5:
    259.                             if loop-blocks-6 is nether quartz ore:
    260.                               break loop-blocks-6 using player's tool
    261.                               loop blocks in radius 2 of loop-blocks-6:
    262.                                 if loop-blocks-7 is nether quartz ore:
    263.                                   break loop-blocks-7 using player's tool
    264.                                   loop blocks in radius 2 of loop-blocks-7:
    265.                                     if loop-blocks-8 is nether quartz ore:
    266.                                       break loop-blocks-8 using player's tool
    267.                                       loop blocks in radius 2 of loop-blocks-8:
    268.                                         if loop-blocks-9 is nether quartz ore:
    269.                                           break loop-blocks-9 using player's tool
    270.                                           loop blocks in radius 2 of loop-blocks-9:
    271.                                             if loop-block-10 is nether quartz ore:
    272.                                               break loop-blocks-10 using player's tool
    273.  
     
Thread Status:
Not open for further replies.

Share This Page

Loading...