Jump to content

Skript: Make a GUI Unclosable?


thevirtualpotato

Recommended Posts

I'm very much a beginner at this so please help. I'm trying to make it so that if my gui is closed it opens again. Basically make it so that the gui is unclosable until the very end. This is going to be a setup type of thing where the player must going a clan and select a kit before playing on the survival server. I have looked at other old forums on unclosable guis but nothing seems to work. Maybe its because its an older version? This is what I have so far:

Spoiler

 

on join:
  if {Joins::*} does not contain player's uuid:
    give player stone sword
    give player compass
    give player 16 torch
    give player crafting table
    give player oak boat
    add player's uuid to {Joins::*}
    set join message to "&7(&a+&7) &b%player%"
    execute player command "/join"
  else:
    set join message to "&7(&a+&7) &r%player%"
    wait 3 ticks
    send "&bWelcome back &a%player%&b!&r"

on quit:
    set leave message to "&7(&4-&7) &r%player%"

command /join:
  trigger:
    open virtual chest inventory with size 5 named "&0Set Up" to player
    format gui slot 8 of player with paper named "&4&lImportant!" with lore "&c&lDO NOT CLOSE THIS GUI"
    format gui slot 20 of player with map named "Clans" to run:
      execute player command "/1"
    format gui slot 22 of player with iron sword named "Kits" to run:
      execute player command "/2"
    format gui slot 24 of player with book named "Receive Books" to run:
      execute player command "/3"

 

Also I have Skript, SkQuery, and TuSKe.

Edited by thevirtualpotato
Link to comment
Share on other sites

on inventory close:
    if name of event-inventory contains "<name here>":
        cancel event

Give that a go 🙂

Edited by iOmega__

––––––––––––––––––––––––––––––––––––––––––––––––––

Please leave a reaction if my assistance was satisfactory!

 

Link to comment
Share on other sites

3 hours ago, thevirtualpotato said:

it says that an on inventory close event cannot be cancelled?

You can make the GUI into a function, and activate the function when you close it.

Example:

 

function openGUI(p: player):
    open virtual chest inventory with size 5 named "&0Set Up" to {_p}
    format gui slot 8 of {_p} with paper named "&4&lImportant!" with lore "&c&lDO NOT CLOSE THIS GUI"
    format gui slot 20 of {_p} with map named "Clans" to run:
        execute {_p} command "/1"
    format gui slot 22 of {_p} with iron sword named "Kits" to run:
        execute {_p} command "/2"
    format gui slot 24 of {_p} with book named "Receive Books" to run:
        execute {_p} command "/3"

on inventory close:
    if name of event-inventory contains "&0Set Up":
        openGUI(player)

command /gui:
    trigger:
        openGUI(player)

 

Edited by iOmega__
  • Thanks 1

––––––––––––––––––––––––––––––––––––––––––––––––––

Please leave a reaction if my assistance was satisfactory!

 

Link to comment
Share on other sites

3 minutes ago, thevirtualpotato said:

it says that an on inventory close event cannot be cancelled?

They indeed cannot be cancelled. This is an option

on inventory close:
	if name of event-inventory contains "<name here>":
		open event-inventory to player

 

  • Like 1

VIP since January 7th, 2020

Support since September 19th, 2020

Helper since November 3rd, 2020

Moderator since March 8th, 2021

unknown.png

5.png.e14b1bf83edf0ac2edc1bfb822177184.png

image.png.fe30b7b2c0be5a541ba4ed2187b23030.png

Link to comment
Share on other sites

10 minutes ago, TheGoose said:

They indeed cannot be cancelled. This is an option



on inventory close:
	if name of event-inventory contains "<name here>":
		open event-inventory to player

 

ok that kinda worked. When I try to close the inventory it reopens once. then if i try to close it again it closes like normal.

 

it is also saying that the script infinitely (or excessively) repeated itsself.

Edited by thevirtualpotato
Link to comment
Share on other sites

20 minutes ago, thevirtualpotato said:

ok that kinda worked. When I try to close the inventory it reopens once. then if i try to close it again it closes like normal.

 

it is also saying that the script infinitely (or excessively) repeated itsself.

You can try the function based one I sent.

 

  • Thanks 1

––––––––––––––––––––––––––––––––––––––––––––––––––

Please leave a reaction if my assistance was satisfactory!

 

Link to comment
Share on other sites

1 hour ago, iOmega__ said:

You can make the GUI into a function, and activate the function when you close it.

Example:

 


function openGUI(p: player):
    open virtual chest inventory with size 5 named "&0Set Up" to player
    format gui slot 8 of player with paper named "&4&lImportant!" with lore "&c&lDO NOT CLOSE THIS GUI"
    format gui slot 20 of player with map named "Clans" to run:
        execute player command "/1"
    format gui slot 22 of player with iron sword named "Kits" to run:
        execute player command "/2"
    format gui slot 24 of player with book named "Receive Books" to run:
        execute player command "/3"

on inventory close:
    if name of event-inventory contains "&0Set Up":
        openGUI(player)

command /gui:
    trigger:
        openGUI(player)

 

2021-01-02_14_52_11.thumb.png.116a3e5602490a42b8a2db32c7ae1c2d.pngat this point I have no idea what is going on lol it gave me this when i reloaded the script.

Link to comment
Share on other sites

3 minutes ago, thevirtualpotato said:

2021-01-02_14_52_11.thumb.png.116a3e5602490a42b8a2db32c7ae1c2d.pngat this point I have no idea what is going on lol it gave me this when i reloaded the script.

Whoops, forgot to edit the GUI after copy pasting; just change all the parts with "player" to {_p} and it should function. Sorry about that!

  • Thanks 1

––––––––––––––––––––––––––––––––––––––––––––––––––

Please leave a reaction if my assistance was satisfactory!

 

Link to comment
Share on other sites

i mean this is my personal opinion but you should use vanilla guis

 

function gui(p:player):
	set (metadata tag "gui" of {_p}) to chest inventory with 3 rows named "gui"
	set slot 0 of (metadata tag "gui" of {_p}) to stick named "this is a stick"
	open (metadata tag "gui" of {_p}) to {_p}

on inventory close:
	event-inventory is (metadata tag "gui" of {_p}):
		gui(player)

command gui:
	trigger:
		gui(player)

again its your opinion but idk its a good skill to know 

https://forums.skunity.com/threads/vanilla-guis.8939/ for more info

 


[PATRON] Echology

image.png.25b196fc30999f9133398315a98c2b11.png

Sponk = Weeb


 

Link to comment
Share on other sites

alright so i figured out how to make it unclosable but now after it reopens the gui is completely blank...

Spoiler

command /join:
  trigger:
    open virtual chest inventory with size 5 named "&0Set Up" to player
    format gui slot 8 of player with paper named "&4&lImportant!" with lore "&c&lDO NOT CLOSE THIS GUI"
    format gui slot 20 of player with glowing map named "Clans" to run:
      execute player command "/1"
    format gui slot 22 of player with glowing iron sword named "Kits" to run:
      execute player command "/2"
    format gui slot 24 of player with glowing book named "Receive Books" to run:
      execute player command "/3"

on inventory close:
    if name of event-inventory contains "&0Set Up":
        wait 1 tick
        open event-inventory to player

 

Link to comment
Share on other sites

function gui(p:player):
	set (metadata tag "gui" of {_p}) to chest inventory with 3 rows named "gui"
	set slot 0 of (metadata tag "gui" of {_p}) to stick named "this is a stick"
	open (metadata tag "gui" of {_p}) to {_p}

on inventory close:
	event-inventory's name is "gui":
		gui(player)

on inventory click:
	event-inventory is (metadata tag "gui" of {_p}):
		index of event-slot is 0:
			send "&cYou clicked on da stick" 

command gui:
	trigger:
		gui(player)

 

seems to work for me, I mean you'd have to edit it but I mean for the purposes of an unlosable gui this seems fine.

 

2 minutes ago, thevirtualpotato said:

alright so i figured out how to make it unclosable but now after it reopens the gui is completely blank...

  Hide contents

command /join:
  trigger:
    open virtual chest inventory with size 5 named "&0Set Up" to player
    format gui slot 8 of player with paper named "&4&lImportant!" with lore "&c&lDO NOT CLOSE THIS GUI"
    format gui slot 20 of player with glowing map named "Clans" to run:
      execute player command "/1"
    format gui slot 22 of player with glowing iron sword named "Kits" to run:
      execute player command "/2"
    format gui slot 24 of player with glowing book named "Receive Books" to run:
      execute player command "/3"

on inventory close:
    if name of event-inventory contains "&0Set Up":
        wait 1 tick
        open event-inventory to player

 

 

1 hour ago, BluBoy3ch0 said:

i mean this is my personal opinion but you should use vanilla guis

 


function gui(p:player):
	set (metadata tag "gui" of {_p}) to chest inventory with 3 rows named "gui"
	set slot 0 of (metadata tag "gui" of {_p}) to stick named "this is a stick"
	open (metadata tag "gui" of {_p}) to {_p}

on inventory close:
	event-inventory is (metadata tag "gui" of {_p}):
		gui(player)

command gui:
	trigger:
		gui(player)

again its your opinion but idk its a good skill to know 

https://forums.skunity.com/threads/vanilla-guis.8939/ for more info

 

 


[PATRON] Echology

image.png.25b196fc30999f9133398315a98c2b11.png

Sponk = Weeb


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...