Solved Tuske GUI - Save 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.

ShaneBee

Supporter +
Addon Developer
Sep 7, 2017
2,248
241
73
Vancouver, Canada
Hello

Im trying to figure out a way, that when i have a gui open (chest) that when a player puts an item into a slot, and clicks something, lets say an anvil, it would save what is in that slot to a variable.
I just cant figure out how to do it.

here's what I have so far for my testing purpose
code_language.skript:
command /test:
    trigger:
        open virtual chest inventory named "test" with size 3 to player
        format slot 0 of player with anvil named "Click to save" to do nothing #will be changed obviously when i figure this out

I want to be able to do it like for example, a player places a sword in slot 10, clicks the anvil and it will save that item into a variable.

Is that possible?
 
first off, Shane, this is not Tuske "format slot"
Tuske is with the "gui" inserted
code_language.skript:
format|create|make gui slot

I saw this earlier on the Discord:

code_language.skript:
set {contents::%player's uuid%::*} to items in player's inventory
 
Last edited:
oh sorry, i was using tuske, i just forgot to add in gui in my example. but i will make sure to fix that

also, im not sure how that would work, because i need to save specific slots, like i said, if a player puts something in slot 10, i need to save slot 10, when they click on another slot
 
This should work (skipping the first item as being set as a part of the inventory, and saving every slot as list so you can clear it)
code_language.skript:
command /test:
    trigger:
        open virtual chest inventory named "test" with size 3 to player
        set {_slot} to 1
        loop 26 times:
            set slot {_slot} of current inventory of player to {chest::%{_slot}%::%player%}
            add 1 to {_slot}
        format slot 0 of player with anvil named "Click to save" to run [make player execute "/savechest"]  

command /savechest:
    trigger:
        set {_slot} to 1
        loop 26 times:
            set {chest::%{_slot}%::%player%} to slot {_slot} of current inventory of player
            add 1 to {_slot}
        send "&aSaved chest" to player
 
This should work (skipping the first item as being set as a part of the inventory, and saving every slot as list so you can clear it)
code_language.skript:
command /test:
    trigger:
        open virtual chest inventory named "test" with size 3 to player
        set {_slot} to 1
        loop 26 times:
            set slot {_slot} of current inventory of player to {chest::%{_slot}%::%player%}
            add 1 to {_slot}
        format slot 0 of player with anvil named "Click to save" to run [make player execute "/savechest"] 

command /savechest:
    trigger:
        set {_slot} to 1
        loop 26 times:
            set {chest::%{_slot}%::%player%} to slot {_slot} of current inventory of player
            add 1 to {_slot}
        send "&aSaved chest" to player
Oh man thanks a bunch. I feel like I kept trying to make stuff like this and it just wasn't going my way. I appreciate it
 
Status
Not open for further replies.