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

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

SkyTake

New Member
Jan 22, 2022
6
1
3
24
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:
every 1 seconds:
    loop {pchest::*}:
        loop all items in block at loop-value:
            if {banneditems::*} contains loop-item: #this is what i mean
                set {loop} to location at ????????
                if {loop} is equal to {dupe1_location} or {dupe2_location} or {dupe3_location} or {dupe4_location}:                      other code..
 
Well I have no clue what youre trying to do (im pretty sure you dont either), so I probably suggest learning the basics
 
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:
options:
    Ban List: bedrock, or barriers, or east conditional command block, or command block, or command
    Item Removed Message: &c&lITEMSUCHT &8» &cDieses Item ist verboten! &7(&a%event-item%&7)

variables:
    {dupe1_location} = 0
    {chest.amount.%player%} = 0
    {pchest::*} = 0

on load:
    set {banneditems::*} to {@Ban List}

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:
    add location of event-block to {pchest::*}
    send "%{pchest::*}%" to player

command /dupe [<text>] [<number>]:
    permission: dupe.use
    permission message: &c&lITEMSUCHT &8» &7Dazu hast du keine Berechtigung!
    aliases: dup
    trigger:
        if arg 1 is "list":
            send "&8]================================[" to player
            if {dupe1} is set:
                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")
            if {dupe2} is set:
            if {dupe3} is set:
            if {dupe4} is set:
            if {dupe5} is set:
            if {dupe6} is set:
            if {dupe7} is set:
            if {dupe8} is set:
            if {dupe9} is set:
            if {dupe10} is set:
            if {dupe11} is set:
            if {dupe12} is set:
            if {dupe13} is set:
            if {dupe14} is set:
            if {dupe15} is set:
            if {dupe16} is set:
            if {dupe17} is set:
            if {dupe18} is set:
            if {dupe19} is set:
            if {dupe20} is set:
            if {dupe21} is set:
            if {dupe22} is set:
            if {dupe23} is set:
            if {dupe24} is set:
            if {dupe1} is not set:
                send "&cMomentan gibt es keine Dupe-Einträge!"
            send "&8]================================[" to player
        if arg 1 is "remove":
            if arg 2 is set:
                if arg 2 is a number:
                    if {dupe%arg 2%} is set:
                        clear {dupe%arg 2%}
                        reset {dupe%arg 2%_player}
                        reset {dupe%arg 2%_value}
                        reset {dupe%arg 2%_server}
                        reset {dupe%arg 2%_location}                     
                    else:   
                        send "&cDieser Dupe-Eintrag existiert nicht!" to player
                else:
                    send "&cUsage: &b/dupe remove <number>" to player
            else:
                send "&cDu musst eine ID-Nummer angeben!" to player
        if arg 1 is not "remove" or "list":
            set {_num} to arg 1 parsed as a number
            if {_num} is a number:
                if {dupe%arg 1%} is set:
                    teleport player to location {dupe%arg 1%_location}
                else:
                    send "&cEs gibt keinen Dupe-Eintrag mit dieser ID!"

            else:
                send "&cUsage: &b/dupe list/remove" to player

every 1 seconds:
    loop {pchest::*}:
        loop all items in block at loop-value:
            if {banneditems::*} contains loop-item:
                set {loop} to location at
                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}:
                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}:
                    if {dupe1} is not set:
                        set {dupe1} to "set"
                        set {dupe1_value} to random integer between 10381 and 94729
                        set {dupe1_server} to "CB01"
                        set {dupe1_location} to {loop}
                    else:
                        if {dupe2} is not set:
                        else:
                            if {dupe3} is not set:
                            else:
                                if {dupe4} is not set:
                                else:
                                    if {dupe5} is not set:
                                    else:
                                        if {dupe6} is not set:
                                        else:
                                            if {dupe7} is not set:
                                            else:
                                                if {dupe8} is not set:
                                                else:
                                                    if {dupe9} is not set:
                                                    else:
                                                        if {dupe10} is not set:
                                                        else:
                                                            if {dupe11} is not set:
                                                            else:
                                                                if {dupe12} is not set:
                                                                else:
                                                                    if {dupe13} is not set:
                                                                    else:
                                                                        if {dupe14} is not set:
                                                                        else:
                                                                            if {dupe15} is not set:
                                                                            else:
                                                                                if {dupe16} is not set:
                                                                                else:
                                                                                    if {dupe17} is not set:
                                                                                    else:
                                                                                        if {dupe18} is not set:
                                                                                        else:
                                                                                            if {dupe19} is not set:
                                                                                            else:
                                                                                                if {dupe20} is not set:
                                                                                                else:
                                                                                                    if {dupe21} is not set:
                                                                                                    else:
                                                                                                        if {dupe22} is not set:
                                                                                                        else:
                                                                                                            if {dupe23} is not set:
                                                                                                            else:
                                                                                                                if {dupe24} is not set:
                                                                                                                else:
                                                                                                                    set {dupelist.full} to true

every 10 seconds:
    if {dupelist.full} is true:
        loop all players:
            if loop-player has permission "dupe.use":
                send "&cDie Dupelist ist voll!" to loop-player

command /neuch:
    trigger:
        send {pchest::*} to player
        send {dupe1} to player
        clear {pchest::*}

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.
 
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
 
I mean the location of the chest where the looped forbidden item is located....
[doublepost=1642872353,1642872292][/doublepost]But many chests are looped from a list, so I don't know how to query the specific one.
 
Im going to be dead honest, this script isnt all that good, as I suggested before you should probably start learning the basics
 
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.
 
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.
 
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.
Thanks, it worked :emoji_grinning:
Did it this way:

Code:
set {loop} to location at loop-value-1
 
  • Like
Reactions: Goose
Status
Not open for further replies.