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.

Solved How to get the location of the block of the looped item?

Discussion in 'Skript' started by SkyTake, Jan 22, 2022.

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

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
    Hello, I'm trying to develop an anti-dupe system and I need help urgently..
    I want to get the location of the block of the looped item, but do not know how :/

    This is my code:

    Code (Text):
    1. every 1 seconds:
    2.     loop {pchest::*}:
    3.         loop all items in block at loop-value:
    4.             if {banneditems::*} contains loop-item: #this is what i mean
    5.                 set {loop} to location at ????????
    6.                 if {loop} is equal to {dupe1_location} or {dupe2_location} or {dupe3_location} or {dupe4_location}:                      other code..


     
  2. Best Answer:
    Post #11 by Goose, Jan 27, 2022
  3. Phuple

    Phuple Member

    Joined:
    Jun 25, 2021
    Messages:
    18
    Likes Received:
    1
    Well I have no clue what youre trying to do (im pretty sure you dont either), so I probably suggest learning the basics
     
  4. SkyTake

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
    I know exactly what I am doing and if you could read correctly, you would already know that I am scripting an Anti-Dupe script.
    And I've written many large elaborate scripts where you need more than just basics :emoji_wink: Have you never had a moment where you got stuck? Where it has hacked at something? I would not immediately comment as know-it-all as you do. Oh, and here is the entire code:


    Code (Text):
    1. options:
    2.     Ban List: bedrock, or barriers, or east conditional command block, or command block, or command
    3.     Item Removed Message: &c&lITEMSUCHT &8» &cDieses Item ist verboten! &7(&a%event-item%&7)
    4.  
    5. variables:
    6.     {dupe1_location} = 0
    7.     {chest.amount.%player%} = 0
    8.     {pchest::*} = 0
    9.  
    10. on load:
    11.     set {banneditems::*} to {@Ban List}
    12.  
    13. on place of chest or trapped chest or hopper or furnace or dropper or dispenser or white shulker box or orange shulker box or magenta shulker box or light blue shulker box or yellow shulker box or lime shulker box or pink shulker box or gray shulker box or black shulker box or cyan shulker box or purple shulker box or blue shulker box or brown shulker box or green shulker box or red shulker box:
    14.     add location of event-block to {pchest::*}
    15.     send "%{pchest::*}%" to player
    16.  
    17. command /dupe [<text>] [<number>]:
    18.     permission: dupe.use
    19.     permission message: &c&lITEMSUCHT &8» &7Dazu hast du keine Berechtigung!
    20.     aliases: dup
    21.     trigger:
    22.         if arg 1 is "list":
    23.             send "&8]================================[" to player
    24.             if {dupe1} is set:
    25.                 json("%player%", "&a[TP]||cmd:/dup 1|| &c%{dupe1_player}%-1  &8| &4%{dupe1_value}% &8| &4%{dupe1_server}% ||ttp: ||&e[RM]||cmd:/dupe remove 1")
    26.             if {dupe2} is set:
    27.             if {dupe3} is set:
    28.             if {dupe4} is set:
    29.             if {dupe5} is set:
    30.             if {dupe6} is set:
    31.             if {dupe7} is set:
    32.             if {dupe8} is set:
    33.             if {dupe9} is set:
    34.             if {dupe10} is set:
    35.             if {dupe11} is set:
    36.             if {dupe12} is set:
    37.             if {dupe13} is set:
    38.             if {dupe14} is set:
    39.             if {dupe15} is set:
    40.             if {dupe16} is set:
    41.             if {dupe17} is set:
    42.             if {dupe18} is set:
    43.             if {dupe19} is set:
    44.             if {dupe20} is set:
    45.             if {dupe21} is set:
    46.             if {dupe22} is set:
    47.             if {dupe23} is set:
    48.             if {dupe24} is set:
    49.             if {dupe1} is not set:
    50.                 send "&cMomentan gibt es keine Dupe-Einträge!"
    51.             send "&8]================================[" to player
    52.         if arg 1 is "remove":
    53.             if arg 2 is set:
    54.                 if arg 2 is a number:
    55.                     if {dupe%arg 2%} is set:
    56.                         clear {dupe%arg 2%}
    57.                         reset {dupe%arg 2%_player}
    58.                         reset {dupe%arg 2%_value}
    59.                         reset {dupe%arg 2%_server}
    60.                         reset {dupe%arg 2%_location}                    
    61.                     else:  
    62.                         send "&cDieser Dupe-Eintrag existiert nicht!" to player
    63.                 else:
    64.                     send "&cUsage: &b/dupe remove <number>" to player
    65.             else:
    66.                 send "&cDu musst eine ID-Nummer angeben!" to player
    67.         if arg 1 is not "remove" or "list":
    68.             set {_num} to arg 1 parsed as a number
    69.             if {_num} is a number:
    70.                 if {dupe%arg 1%} is set:
    71.                     teleport player to location {dupe%arg 1%_location}
    72.                 else:
    73.                     send "&cEs gibt keinen Dupe-Eintrag mit dieser ID!"
    74.  
    75.             else:
    76.                 send "&cUsage: &b/dupe list/remove" to player
    77.  
    78. every 1 seconds:
    79.     loop {pchest::*}:
    80.         loop all items in block at loop-value:
    81.             if {banneditems::*} contains loop-item:
    82.                 set {loop} to location at
    83.                 if {loop} is equal to {dupe1_location} or {dupe2_location} or {dupe3_location} or {dupe4_location} or {dupe5_location} or {dupe6_location} or {dupe7_location} or {dupe8_location} or {dupe9_location} or {dupe10_location} or {dupe11_location} or {dupe12_location} or {dupe13_location} or {dupe14_location} or {dupe15_location} or {dupe16_location} or {dupe17_location} or {dupe18_location} or {dupe19_location} or {dupe20_location} or {dupe21_location} or {dupe23_location} or {dupe24_location}:
    84.                 if {loop} is not equal to {dupe1_location} or {dupe2_location} or {dupe3_location} or {dupe4_location} or {dupe5_location} or {dupe6_location} or {dupe7_location} or {dupe8_location} or {dupe9_location} or {dupe10_location} or {dupe11_location} or {dupe12_location} or {dupe13_location} or {dupe14_location} or {dupe15_location} or {dupe16_location} or {dupe17_location} or {dupe18_location} or {dupe19_location} or {dupe20_location} or {dupe21_location} or {dupe23_location} or {dupe24_location}:
    85.                     if {dupe1} is not set:
    86.                         set {dupe1} to "set"
    87.                         set {dupe1_value} to random integer between 10381 and 94729
    88.                         set {dupe1_server} to "CB01"
    89.                         set {dupe1_location} to {loop}
    90.                     else:
    91.                         if {dupe2} is not set:
    92.                         else:
    93.                             if {dupe3} is not set:
    94.                             else:
    95.                                 if {dupe4} is not set:
    96.                                 else:
    97.                                     if {dupe5} is not set:
    98.                                     else:
    99.                                         if {dupe6} is not set:
    100.                                         else:
    101.                                             if {dupe7} is not set:
    102.                                             else:
    103.                                                 if {dupe8} is not set:
    104.                                                 else:
    105.                                                     if {dupe9} is not set:
    106.                                                     else:
    107.                                                         if {dupe10} is not set:
    108.                                                         else:
    109.                                                             if {dupe11} is not set:
    110.                                                             else:
    111.                                                                 if {dupe12} is not set:
    112.                                                                 else:
    113.                                                                     if {dupe13} is not set:
    114.                                                                     else:
    115.                                                                         if {dupe14} is not set:
    116.                                                                         else:
    117.                                                                             if {dupe15} is not set:
    118.                                                                             else:
    119.                                                                                 if {dupe16} is not set:
    120.                                                                                 else:
    121.                                                                                     if {dupe17} is not set:
    122.                                                                                     else:
    123.                                                                                         if {dupe18} is not set:
    124.                                                                                         else:
    125.                                                                                             if {dupe19} is not set:
    126.                                                                                             else:
    127.                                                                                                 if {dupe20} is not set:
    128.                                                                                                 else:
    129.                                                                                                     if {dupe21} is not set:
    130.                                                                                                     else:
    131.                                                                                                         if {dupe22} is not set:
    132.                                                                                                         else:
    133.                                                                                                             if {dupe23} is not set:
    134.                                                                                                             else:
    135.                                                                                                                 if {dupe24} is not set:
    136.                                                                                                                 else:
    137.                                                                                                                     set {dupelist.full} to true
    138.  
    139. every 10 seconds:
    140.     if {dupelist.full} is true:
    141.         loop all players:
    142.             if loop-player has permission "dupe.use":
    143.                 send "&cDie Dupelist ist voll!" to loop-player
    144.  
    145. command /neuch:
    146.     trigger:
    147.         send {pchest::*} to player
    148.         send {dupe1} to player
    149.         clear {pchest::*}
    150.  
    I don't think a beginner could write so much code without help^^ I'm just not getting anywhere because I've tried everything and nothing has worked.
     
  5. Phuple

    Phuple Member

    Joined:
    Jun 25, 2021
    Messages:
    18
    Likes Received:
    1
    Well too my knowledge, items dont have locations, I could be wrong but if you rlly wanna know, try sending the location of an item to the player and see what it returns
     
  6. SkyTake

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
    I mean the location of the chest where the looped forbidden item is located....
    --- Double Post Merged, Jan 22, 2022, Original Post Date: Jan 22, 2022 ---
    But many chests are looped from a list, so I don't know how to query the specific one.
     
  7. Phuple

    Phuple Member

    Joined:
    Jun 25, 2021
    Messages:
    18
    Likes Received:
    1
    Im going to be dead honest, this script isnt all that good, as I suggested before you should probably start learning the basics
     
  8. SkyTake

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
  9. rsrsamr

    rsrsamr New Member

    Joined:
    Jan 25, 2022
    Messages:
    8
    Likes Received:
    0
    phuple doesnt know what to say haha bet he hasnt seen such an expert in his life
     
  10. Phuple

    Phuple Member

    Joined:
    Jun 25, 2021
    Messages:
    18
    Likes Received:
    1
    Yeah I guess 1.5 years+ worth of skript experience isnt enough to comprehend the complexity of his skript
     
  11. SkyTake

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
    Ok I may have made it a little too complicated for myself, that's true.... But I know the basics and I know how I could make it easier for myself.... But I want to save the location of the container where the forbidden item is, because I have a citybuild server and I need to see where (on which plot) the container is, to check the plot for other possible illegal items.
     
  12. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    Jesus christ Phuple, ever tried to be helpful?!
    Sorry about that guy, SkyTake, some people don't know how to help on help forums.

    If I'm understanding your script correctly, in that loop, loop-value-1 should refer to the location of the block you're looping.
    When embedding loops, you can refer to different loop values by putting loop-value- followed by the number of loop you're trying to get the value from.
     
  13. SkyTake

    SkyTake New Member

    Joined:
    Jan 22, 2022
    Messages:
    6
    Likes Received:
    1
    Thanks, it worked :emoji_grinning:
    Did it this way:

    Code (Text):
    1. set {loop} to location at loop-value-1
     
    Goose likes this.
Thread Status:
Not open for further replies.

Share This Page

Loading...