GUI wont save with Shift+Left

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

Mattllama987

Active Member
Aug 5, 2018
225
7
18
24
Hi, ive been working on a Autofarmer, and im stuck on only 1 thing. When a player drags out items from the GUI, it saves fine. If they shift clicks a item out, it wont save. Ill post the saving part i have now. I tried countless things, and its jut not saving the inv. Ill also post a GIF for a example on what its doing. But its leading to a infinite dupe lol. Ive tried looping the slots in the inv, setting a variable to the inv and many many other things. Im not sure what its not saving
EXAMPLE:
https://gyazo.com/a25f5265a40070f94392b92a16130e4e

Thanks!
~Matt

Skript version:
2.5-Alpha3

Skript Mirror:
2.0.0-snapshot

Code here.
I can send the WHOLE thing in discord. If someone needs me to. But this is the saving part here:
Code:
function saveFarm(p: player):
    set {_slot} to 0
    loop 45 times:
        set {autofarmer::%{_slot}%::%{_p}%} to slot {_slot} of {_p}'s current inventory
        add 1 to {_slot}          
       
function loadFarm(P: player):
    open chest inventory with 6 rows named "&c&lAuto farming" to {_P}
    set {_slot} to 0
    set {_var} to -1
    set {_var2} to 45
    loop 45 times:
        set slot {_slot} of {_P}'s current inventory to {autofarmer::%{_slot}%::%{_P}%}
        add 1 to {_slot}
    loop 10 times:
        set slot {_var2} of {_P}'s current inventory to black stained glass pane named ""
        add 1 to {_var2}
    set {carrot::%{_P}%} to 0
    set {wheat::%{_P}%} to 0
    set {potato::%{_P}%} to 0
    set slot 53 of {_P}'s current inventory to chest named "&b&lClick to claim all!" with lore "&c&lMake sure your inventory", "&ccan hold all the items" and "&cbefore you click!"
    set slot 51 of {_P}'s current inventory to glowing paper named "&aAutofarmer time left: &c%{autofarm::time::%{_P}%}%" with lore "&b&lTotal Crops farmed:", "&dCarrots: &a%{carrot::%{_P}%}%", "&dWheat: &a%{wheat::%{_P}%}%" and "&dPotato: &a%{potato::%{_P}%}%"
    set slot 45 of {_P}'s current inventory to glowing lever named "&a&lStart farm"
    set slot 47 of {_P}'s current inventory to glowing tnt named "&c&lStop farm"
    set slot 49 of {_P}'s current inventory to glowing barrier named "&c&lMain Page"
on inventory close:
    if {farm::%Player%} is true:
        saveFarm(player)
[doublepost=1591371456,1591284038][/doublepost]bump
[doublepost=1591547955][/doublepost]bump
 
Status
Not open for further replies.