Detect if there is any item in some slot

  • 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.
code_language.skript:
if slot 1 of current inventory of player is not air:
But how do I drag the item to the slot I want? Tuske or SkQuery? As?
[doublepost=1543624945,1543594842][/doublepost]
code_language.skript:
if slot 1 of current inventory of player is not air:
How do I get the player to drag the item into the slot and then continue there? And detect the item as you showed up?
[doublepost=1543680061][/doublepost]Someone?
 
But how do I drag the item to the slot I want? Tuske or SkQuery? As?
[doublepost=1543624945,1543594842][/doublepost]
How do I get the player to drag the item into the slot and then continue there? And detect the item as you showed up?
[doublepost=1543680061][/doublepost]Someone?
if slot 1 of current inventory of player is air:
[tab]set slot 1 of current inventory of player to barrier named "hi brother"
 
if slot 1 of current inventory of player is air:
[tab]set slot 1 of current inventory of player to barrier named "hi brother"
Hey man, what I'm talking about if there is how the player can drag the item to the slot and the item stay there, and detect if it is the right item and so on.
 
give me an example or explain yourself better xd
I believe he is trying to create a GUI which you can insert an item into, and then for example enchant it if it is a diamond sword named "Cow" (bad example maybe but I think it's what he's getting at haha)
My server is being ridiculous currently so I can't test this but I believe you can use this with TuSKe

code_language.skript:
on inventory drag:
    slot 4 of player's current inventory is diamond
    broadcast "%slot 4 of player's current inventory%"

TDragon_ if this isn't what you mean could you maybe try to explain it better (no offense I just don't know if I understand very well.)

Also P.S. the
code_language.skript:
on inventory drag
event does not work in creative mode.

EDIT

Okay so I finally got my server working again, it turns out that the above solution is definitely not what OP is asking for. I researched it a little and it appears that there aren't any events that match the request, so the only viable option I can think of is something like this

code_language.skript:
every 5 ticks in "world":
    loop all players:
        #name of loop-player's current inventory is "GUI NAME"
        slot 4 of loop-player's current inventory is a diamond #Item
        broadcast "found"
        close the loop-player's inventory

But depending on how many people are on your server this could get very laggy so I wouldn't recommend it.

Again not sure exactly what you want but this is the only work around I could think of

code_language.skript:
command /opengui:
    trigger:
        open chest with 1 row named "GUI NAME" to player
        wait 1 tick
        format slot 0 of player with 1 of gray glass named " " to be unstealable
        format slot 1 of player with 1 of gray glass named " " to be unstealable
        format slot 2 of player with 1 of gray glass named " " to be unstealable
        format slot 3 of player with 1 of red glass named "&cCancel" to close
        format slot 5 of player with 1 of green glass named "&aConfirm" to run [console command "/outputcommand %player%"]
        format slot 6 of player with 1 of gray glass named " " to be unstealable
        format slot 7 of player with 1 of gray glass named " " to be unstealable
        format slot 8 of player with 1 of gray glass named " " to be unstealable
command /outputcommand <player>:
    permission: op
    trigger:
        close player-arg's inventory
        #whatever code you want
on inventory close:
    name of player's current inventory is "GUI NAME"
    give player slot 4 of player's current inventory

Anyway hopefully this either solves your problem or at least points you in the right direction.
 
Last edited:
Status
Not open for further replies.