Need help!

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

    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.

SpiderDev

New Member
Jan 27, 2017
7
0
0
I need an example code, that contains when im clicking on a example item from gui, it opens me another gui but without commands.
 
Use the 'on inventory click:' event. Close the inventory, and open a new one. :emoji_grin:
 
There are 3 different ways:
  1. You can close the menu, and open a new one.
  2. Set all the slots to air, and put new ones in it.
  3. Change a slot individually.
code_language.skript:
command /menu:
    trigger:
        open chest with 3 rows named "Test!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Click here!"
       

on inventory click:
    name of player's current inventory is "Test!" or "Hey!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            wait 2 ticks
            close player's inventory
            wait 5 ticks
            open chest with 4 rows named "Hey!" to player
            wait 2 ticks
            set slot 14 of player's current inventory to stone named "ANOTHER MENU! :o"
code_language.skript:
command /menu:
    trigger:
        open chest with 4 rows named "Extra!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Please! Click here!"

on inventory click:
    name of player's current inventory is "Extra!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            set {_x::*} to all integers between 0 and 35
            loop {_x::*}:
                set slot loop-value of player's current inventory to air
                wait 1 tick
            wait 5 ticks
            set slot 10 of player's current inventory to stone named "IT CHANGED! :o"
            set slot 11 of player's current inventory to gold block named "WOW!" with lore " ||&7Impossible!|| "
code_language.skript:
command /menu:
    trigger:
        open chest with 4 rows named "Change!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Please! Click here! PLEASE?!"
       
on inventory click:
    name of player's current inventory is "Change!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            set slot 10 of player's current inventory to shiny dirt named "NOW IT'S ENCHANTED!"

If you need help, you can always ask! :emoji_blush:
These methods are untested.
 
There are 3 different ways:
  1. You can close the menu, and open a new one.
  2. Set all the slots to air, and put new ones in it.
  3. Change a slot individually.
code_language.skript:
command /menu:
    trigger:
        open chest with 3 rows named "Test!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Click here!"
      

on inventory click:
    name of player's current inventory is "Test!" or "Hey!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            wait 2 ticks
            close player's inventory
            wait 5 ticks
            open chest with 4 rows named "Hey!" to player
            wait 2 ticks
            set slot 14 of player's current inventory to stone named "ANOTHER MENU! :o"
code_language.skript:
command /menu:
    trigger:
        open chest with 4 rows named "Extra!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Please! Click here!"

on inventory click:
    name of player's current inventory is "Extra!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            set {_x::*} to all integers between 0 and 35
            loop {_x::*}:
                set slot loop-value of player's current inventory to air
                wait 1 tick
            wait 5 ticks
            set slot 10 of player's current inventory to stone named "IT CHANGED! :o"
            set slot 11 of player's current inventory to gold block named "WOW!" with lore " ||&7Impossible!|| "
code_language.skript:
command /menu:
    trigger:
        open chest with 4 rows named "Change!" to player
        wait 2 ticks
        set slot 10 of player's current inventory to dirt named "Please! Click here! PLEASE?!"
      
on inventory click:
    name of player's current inventory is "Change!"
    cancel event
    if clicked slot is 10:
        if clicked item is dirt:
            set slot 10 of player's current inventory to shiny dirt named "NOW IT'S ENCHANTED!"

If you need help, you can always ask! :emoji_blush:
These methods are untested.
the methods are not working, which addons do i need?
 
Which addons do you have?
Because I think you only need Skript, SkQuery, and maybe Skellett.

And which errors do you get?
 
one of these methods using vanilla Skript implementation of the inventory click event:
code_language.skript:
command menu:
    trigger:
        open chest with 4 rows named "Extra!" to player #skQuery
        set slot 10 of player's current inventory to dirt named "Please! Click here!"

on inventory click:
    if display name of event-inventory is "Test!" or "Hey!":
        cancel event
        if event-slot is a dirt named "Please! Click here!":
            close player's inventory
            open chest with 4 rows named "Hey!" to player
            set slot 14 of player's current inventory to stone named "ANOTHER MENU! :o"

That needs of skQuery for open the chest though, but almost everything there can be done with vanilla Skript (using the bensku's fork of course)
 
  • Like
Reactions: martinpeeters34
Status
Not open for further replies.