Getting item in a certain 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.

2266Flash

New Member
Jun 23, 2020
8
0
1
24
Hi! I would like to know how to get a specific item in an SKQuery GUI.

I would also like for it's name, lore, etc. to be attached as well.

%slot 30 of player's current inventory% will not work.

For example:
Code:
set {variable} to slot 30 of player's current inventory

That would set {variable} to any item that is in slot 30 of the GUI. e.g: bedrock block named "&6&lBEDROCK" with lore "&aLORE".

Thanks in advance,
Flash


EDIT:

My code is for a custom crafting system. You can see the basics I made in 5 minutes here:
https://pastebin.com/kbYm0PYG
 
Code:
command /gui:
  trigger:
    open chest with 5 rows named "Random" to player
    set {_random} to random integer between 0 and 2
    if {_random} is 1:
      format slot 5 of player with red wool named "&c1%%" to be unstealable
    else if {_random} is 2:
      format slot 21 of player with gray wool named "&82%%" to be unstealable
 
Code:
command /gui:
  trigger:
    open chest with 5 rows named "Random" to player
    set {_random} to random integer between 0 and 2
    if {_random} is 1:
      format slot 5 of player with red wool named "&c1%%" to be unstealable
    else if {_random} is 2:
      format slot 21 of player with gray wool named "&82%%" to be unstealable

That is TuSKe and not SKQuery GUIs.

That will also not tell me what the block in the clicked slot will be.
 
That is not even what I want to do. I want to get the item in the slot of a player's current inventory in a periodic event.
[doublepost=1617296423,1612641445][/doublepost]Still looking.
 
That is not even what I want to do. I want to get the item in the slot of a player's current inventory in a periodic event.
[doublepost=1617296423,1612641445][/doublepost]Still looking.

Haven't tested this but I got no errors when parsing it.

Code:
set {_item} to slot 4 of player's inventory
 
Code:
command /gui:
  trigger:
    set {_gui} to a new chest inventory with 3 rows with name "Gui"
    set slot 0 of {_gui} to diamond sword named "&bHello"
    open {_gui} to player
    set line 1 of slot 0 of current inventory of player's lore to "Good Bye"

That's what works for me
 
Haven't tested this but I got no errors when parsing it.

Code:
set {_item} to slot 4 of player's inventory

Exactly what I tried. It just sets the variable to "slot 4 of player's inventory".



Code:
command /gui:
  trigger:
    set {_gui} to a new chest inventory with 3 rows with name "Gui"
    set slot 0 of {_gui} to diamond sword named "&bHello"
    open {_gui} to player
    set line 1 of slot 0 of current inventory of player's lore to "Good Bye"

That's what works for me

That is not what I am trying to do. Please read the full thread. I know how to create a GUI, I know how to put items in a slot. But if somebody was to put an item in a slot of this GUI, how would I get that item? I was thinking about using the Inventory click event.
 
Exactly what I tried. It just sets the variable to "slot 4 of player's inventory".





That is not what I am trying to do. Please read the full thread. I know how to create a GUI, I know how to put items in a slot. But if somebody was to put an item in a slot of this GUI, how would I get that item? I was thinking about using the Inventory click event.
Have you tried
Code:
slot 4 of inventory of player
 
Status
Not open for further replies.