Solved GUI Slots with variables

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

Aberforth

Member
Jun 14, 2019
40
2
8
Canada
Hello, I have the following code:
Code:
on right click on entity:
    if name of clicked entity is "gui":
    
        set {_gui} to a new chest inventory with 6 row with name "*"
        set {_numbers::*} to "45", "46", "47", "48", "49", "50", "51", "52" and "53"
        set {_switch} to random element of {_numbers::*}
        set slot {_switch} of {_gui} to diamond pickaxe with damage 33
            
        open {_gui} to player

I wanted to have the pickaxe appear in a random slot from 45 to 53, every time the player opens the gui. However, it doesn't. The only error I get is "Numeric IDs are not supported anymore"...
 
Hey Aberforth!
This works well for me, try this:

Code:
on right click on entity:
    if name of clicked entity is "gui":

        set {_gui} to a new chest inventory with 6 row with name "*"
        set {_numbers::*} to "45", "46", "47", "48", "49", "50", "51", "52" and "53"
        set {_switch} to random element of {_numbers::*}
        set slot {_switch} of {_gui} to diamond pickaxe of sharpness 33

        open {_gui} to player
 
Hey Aberforth!
This works well for me, try this:

Code:
on right click on entity:
    if name of clicked entity is "gui":

        set {_gui} to a new chest inventory with 6 row with name "*"
        set {_numbers::*} to "45", "46", "47", "48", "49", "50", "51", "52" and "53"
        set {_switch} to random element of {_numbers::*}
        set slot {_switch} of {_gui} to diamond pickaxe of sharpness 33

        open {_gui} to player

"with damage 33" means that the durability is decreased by 33, it's not the same as it having sharpness 33, and that syntax is correct. The rest of the code remains the same, and still doesn't work because the issue is the pickaxe doesn't appear at all, not it having wrong parameters.

Are you sure this works for you? What version and what addons?

--------
Ok it seems I have figured it out. All there was to do was this:

Code:
set slot (45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53) of {_gui_divert} to diamond pickaxe with damage 33

Hope this helps someone
 
Last edited:
Status
Not open for further replies.