Solved chest GUI to save items

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

Ubya

Member
Jun 15, 2020
10
0
1
27
i'm making a game, i need to set a few items players need to find. instead of putting the items in the skript, i thought it would be nicer if i could do that in game.
what i want to do is open a chest gui with a command, i can then drag and drop items in this chest inventory, and save the items in a variable when i close the GUI.

i tried using TuSke
Code:
command /bingolist:
    permission: bingo.admin
    trigger:
        create a gui with id "BingoList" with virtual chest with 6 rows named "&6Bingo List":
            set {_slot} to 0
            loop 52 times:
                format gui slot {_slot} with {bingo::%{_slot}%}
                add 1 to {_slot}
            format gui slot 53 with shiny lime dye named "Save":
                set {_slot} to 0
                loop 52 times:
                    if slot {_slot} of current inventory of player is not air:
                        set {bingo::%{_slot}%} to slot {_slot} of current inventory of player
                        add 1 to {_slot}
                    else:
                        add 1 to {_slot}
                message "&aSAVED"
                close player's inventory
        open gui "BingoList" to player
what this code "SHOULD" do is, open a chest GUI when i type /bingolist, in the slot 53 is filled with a lime dye that upon clicking closes the GUI and saves what's inside it. when i reopen the GUI i should see the items i placed before.
what really happens, if i use
Code:
format gui slot {_slot} with {bingo::%{_slot}%}
i can see the items, but i can't move them, or place new items (i could see some items as i made the variable before using this code).
so i tried with
Code:
set slot {_slot} of current inventory to {bingo::%{_slot}%}
instead of the tuske format, and now i simply can't see anything in the inventory, only the lime dye
 
Status
Not open for further replies.