#disable removing the gui after reset

1 messages · Page 1 of 1 (latest)

dawn pike
#

how can i save a gui so it does not reset on a restart i have this gui

#
    set {_location} to location of the entity
    if {gui.%{_location}%} is not set:
        set {gui.%{_location}%} to a chest inventory with 3 rows named "&6GUI"
        open {gui.%{_location}%} for player
    else:
        open {gui.%{_location}%} for player

on inventory close:
    if event-inventory is {gui.%{_location}%}:
        clear {gui.%{_location}%}```
dawn pike
#

disable removing the gui after reset

stable drift
#

it's not resetting on restart, it's resetting when you close the gui.

dawn pike
#

When i open and Close it the stuff is there

stable drift
#

what is the gui supposed to do?

dawn pike
#

When i place a armor stand and click it it will make a gui where i can put anything i want

#

When i Close it and then open it again the stuff will be there

#

But its giving me an error that the stuff in the guys will be removed after reload

#

And the armor stands are different on the every location

dawn pike
stable drift
#

yeah...that's normal behavior. Information in a gui based on an entity will be different when the server restarts.

dawn pike
stable drift
#

you can make it so the gui is based on a location instead of an entity

dawn pike
#

How

stable drift
#

by getting the location of the block instead of the entity

#

x-coordinate of block at location of event-entity
etc.

dawn pike
#

I try then send you a code OK

dawn pike
#

i did this and it still does not save after reset

dawn pike
#
    set {_x} to x-coordinate of block at location of event-block
    set {_y} to y-coordinate of block at location of event-block
    set {_z} to z-coordinate of block at location of event-block
    set {_location} to "%{_x}% %{_y}% %{_z}%"
    if {gui.%{_location}%} is not set:
        set {gui.%{_location}%} to a chest inventory with 3 rows named "&6GUI"
        open {gui.%{_location}%} for player
    else:
        open {gui.%{_location}%} for player
        send "hi"

on inventory close:
    if event-inventory is {gui.%{_location}%}:
        clear {gui.%{_location}%}

on break of an chiseled stone bricks:
    set {_x} to x-coordinate of block at location of event-block
    set {_y} to y-coordinate of block at location of event-block
    set {_z} to z-coordinate of block at location of event-block
    set {_location} to "%{_x}% %{_y}% %{_z}%"
    clear {gui.%{_location}%}
    broadcast "hiiii"```
stable drift
#

you are still deleting the variable that contains the items whenever you close the gui, so with that logic the items shouldn't be there

clear sapphire
#

^ you’re using a local var across events

#

Skript wont be able to save the armour stand entity, but would it be able to retain the uuid since its a string?

stable drift
topaz echo
clear sapphire
#

^ the other 2 events it does get set

#

Although i would set it in one line; ”% x-coord% % y-coord% %z-coord%”

#

or honestly just event-location

dawn pike
#

i still deletes it

#

so i should remove the clear part ?

clear sapphire
dawn pike
#

ok so what should i do

#

like when i close it it stays but on restart of the server it deletes itself

clear sapphire
dawn pike
#

if im not storing them how do they stay in the gui

clear sapphire
#

they dont, thats why they are dissapearing

dawn pike
#

ok how can i do it

#

should i use functions or make it to a string?

clear sapphire
#

on inventory close you can set the variable again

dawn pike
#

ok

#

like this ?

#
  if event-inventory is {gui.%{_location}%}:
    set {_x} to x-coordinate of block at location of event-block
    set {_y} to y-coordinate of block at location of event-block
    set {_z} to z-coordinate of block at location of event-block
    set {_location} to "%{_x}% %{_y}% %{_z}%"
    clear {gui.%{_location}%}```
clear sapphire
#

theres no block on inventory close

#

and i would use lists

dawn pike
#

ok now it will work ?

#

it saves the items in it

#

im going to try to reset

#

but on reload it still says it will not be saved

clear sapphire
#

if you're using event-location on inventory close it's probably using the player's location which would cause issues if the player cant get in the exact same spot

dawn pike
#

yea

#

targeted-block gives an error too

clear sapphire
#

player's target block i think

dawn pike
#

if someone click the block in shift he will not be targeting the block

#

on the edge of the block

#

so idk

#

i could just prevent them from sneak clicking

#

there is still a problem that it does not save after restart

clear sapphire
#

maybe serialized inventory would work but I have no experience with that

dawn pike
#

{*::list} ?

#

like this ?

clear sapphire
#

noooo

#

{list::*}

#

backwards

#

you could look at some backpack scripts/functions online, those are pretty close so good examples for that you want

dawn pike
#

i tried

#

but it per player

#

the backpacks

#

and it uses functions

dawn pike
#

ok

dawn pike
clear sapphire
#

i suppose yes

#

set {slot::23} to diamond

dawn pike
#

How can I check for the inventory

clear sapphire
#

i would just use a list

#

of itesm

dawn pike
#

lets say you have a cobble generator that should generates 1 cobblstone every 5 seconds

dawn pike
#

Can I put 1 cobblestone every 5 seconds in it ?

clear sapphire
#

You can just use a variable

#

Then give that many cobble

dawn pike
#

here is the code