Detecting the cause of "on inventory close:"

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

Fladsaw

Member
Jul 18, 2022
31
0
6
21
Is there a condition that distinguishes whether the player closed the menu by pressing 'E'/'Esc' or if it was closed via the "close player's inventory" effect? I need a condition like:
Code:
on inventory close:
    if event-inventory is closed by player:
        #do stuff
    else:
        #do stuff
 
Last edited:
check the name of the event-inventory.
Code:
on inventory close:
    if name of event-inventory = "Hello World":
        send "This is the right inventory that is closing"
    else:
        send "Wrong Inventory that is closing"
This is an example of debugging for the name
 
Thank you for your contribution :emoji_slight_smile: I am open to new suggestions tho if anyone has any idea.
 
I just want to send a message to the player if they close the inventory by themselves. However, there is also a button in the inventory that closes it automatically and continues with the skript. If player chooses to cancel the script, they won't see the rest of it. Actually, I am surprised that no one asked this question before since this would be a really handy feature.