Skript

Forum > Help

Location of Block is Loop-Index [Resolved]

This thread has been locked by My_Name_Was_Stolen.

Resolved

  • 3 posts
    #1 Jun 19, 2014 at 22:55 UTC - 0 likes

    I'm trying to make a script which allows players to place items on the ground, I've got this so far, but I'm running into issues

    command /place:
        trigger:
            distance between player and targeted block is less than 3:
                set {_x} to x coordinate of targeted block
                set {_y} to y coordinate of targeted block
                set {_z} to z coordinate of targeted block
                set {_id} to id of player's held item
                set {_data} to the data value of player's held item
                set {dii::%location of targeted block%} to player's held item
                set {di::%{_x}% %{_y}% %{_z}%} to player's held item
                execute console command "/summon Item %{_x}% %{_y} + 1% %{_z}% {Item:{id:%{_id}%,Damage:%{_data}%,Count:0q},Age:-32768,PickupDelay:32767}"
                message "%{_x}% %{_y}% %{_z}% %{_id}%"
    on right click:
        player's tool is air:
            loop {dii::*}:
                location of clicked block is loop-index:
                    give player loop-value
                    remove loop-index from {dii::*}

    Whenever I load the script, it says "Can't compare a location with a text". Could someone explain why this doesn't work and how I can make it work?

    Also, I was wondering if anyone would be interested in mentoring me. It would be nice to have a friend on skype I could ask about things so I don't have to spam up the forums with all my noob questions. If you'd be interested, let me know. :)

    #2 Jun 19, 2014 at 23:06 UTC - 0 likes

    Does this work?

    on right click:
    	player's tool is air:
    		loop {dii::*}:
    			loop-index contains "%location of clicked block%":
    				give player loop-value
    				delete {dii::%loop-index%}	
    

    Add me on skype if you are interested: bi0qaw

    But I will be away for 10 days now...

    #3 Jun 20, 2014 at 02:23 UTC - 0 likes

    @bi0qaw:

    No, but I changed it to this, which worked.

    on right click:
        player's tool is air:
            loop {di::*}:
                loop-index contains "%x coordinate of targeted block%" and "%y coordinate of targeted block%" and "%z coordinate of targeted block%":
                    give player loop-value
                    delete {di::%loop-index%}

  • 3 posts