Solved Problem with inventory click

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

FishRekt

Active Member
Jan 26, 2017
87
0
0
25
When i try to click a slot in the inventory, when i click it, it does what the next slot of the inventory do. See what i'm doing wrong:
code_language.skript:
if inventory name of player's current inventory is "&bEnchantements":
        if clicked inventory is not player's inventory:
            cancel event
            if clicked slot is 11:
                wait a tick
                open chest with 3 rows named "&9Affilatezza" to player
                set slot 10 of player's current inventory to 1 of shiny paper named "&eAffilatezza 1"
                set slot 11 of player's current inventory to 2 of shiny paper named "&eAffilatezza 2"
                set slot 12 of player's current inventory to 3 of shiny paper named "&eAffilatezza 3"
                set slot 13 of player's current inventory to 4 of shiny paper named "&eAffilatezza 4"
                set slot 14 of player's current inventory to 5 of shiny paper named "&eAffilatezza 5"
                set slot 26 of player's current inventory to sign named "&e<- &7Ritorna al menù precedente"
 
Already done but it's still the same thing.. It does what the next slot of the inventory do.
 
I see that you have something very similar to the post I solved this in,
code_language.skript:
on inventory click:
    if inventory type of player's current inventory is "WORKBENCH":
        if clicked item is iron axe:
            if clicked inventory is not player's inventory:
                if clicked slot is 0:
                    if {axe.%player%} = 3:
                        cancel event
                        send "You cannot craft any more axes!"
                        stop
                    add 1 to {axe.%player%}
                    send "successfully crafted axe"
take a very close look, you're missing
code_language.skript:
on inventory click:
small but effective mistake, that is unless you just didn't paste that part above.
 
I've already put "inventory click" before this all. It's not this the problem i think, because i put it good.
 
Well , for one, you mis-spelled "Enchantments", you have "Enchantements".
[doublepost=1514423307,1514423207][/doublepost]You could also try this, your tabs were incorrect when you are checking for the clicked slot number, I think, also I have better luck when using "contains" instead of "name of ___ is ___"

code_language.skript:
on inventory click:
    if name of player's current inventory contains "&bEnchantments":
            if clicked inventory is not player's inventory:
                cancel event
            if clicked slot is 11:
                wait a tick
                open chest with 3 rows named "&9Affilatezza" to player
                set slot 10 of player's current inventory to 1 of shiny paper named "&eAffilatezza 1"
                set slot 11 of player's current inventory to 2 of shiny paper named "&eAffilatezza 2"
                set slot 12 of player's current inventory to 3 of shiny paper named "&eAffilatezza 3"
                set slot 13 of player's current inventory to 4 of shiny paper named "&eAffilatezza 4"
                set slot 14 of player's current inventory to 5 of shiny paper named "&eAffilatezza 5"
                set slot 26 of player's current inventory to sign named "&e<- &7Ritorna al menù precedente"
            if clicked inventory is not player's inventory:
                cancel event
                if clicked slot is 11:
                    wait a tick
                    open chest with 3 rows named "&9Affilatezza" to player
                    set slot 10 of player's current inventory to 1 of shiny paper named "&eAffilatezza 1"
                    set slot 11 of player's current inventory to 2 of shiny paper named "&eAffilatezza 2"
                    set slot 12 of player's current inventory to 3 of shiny paper named "&eAffilatezza 3"
                    set slot 13 of player's current inventory to 4 of shiny paper named "&eAffilatezza 4"
                    set slot 14 of player's current inventory to 5 of shiny paper named "&eAffilatezza 5"
                    set slot 26 of player's current inventory to sign named "&e<- &7Ritorna al menù precedente"
 
I just mis-spelled the name of the inventory, but it's the same for all inventories that are doing the things that they do...
 
Whoops, my fault I just realized when I pasted your code I accidentally duped part of it and thought you typed it all weird..

code_language.skript:
on inventory click:
    if name of player's current inventory contains "&bEnchantments":
            if clicked inventory is not player's inventory:
                cancel event
                if clicked slot is 11:
                    wait a tick
                    open chest with 3 rows named "&9Affilatezza" to player
                    set slot 10 of player's current inventory to 1 of shiny paper named "&eAffilatezza 1"
                    set slot 11 of player's current inventory to 2 of shiny paper named "&eAffilatezza 2"
                    set slot 12 of player's current inventory to 3 of shiny paper named "&eAffilatezza 3"
                    set slot 13 of player's current inventory to 4 of shiny paper named "&eAffilatezza 4"
                    set slot 14 of player's current inventory to 5 of shiny paper named "&eAffilatezza 5"
                    set slot 26 of player's current inventory to sign named "&e<- &7Ritorna al menù precedente"
 
  • Like
Reactions: FishRekt
What is your server version, skript version, and what addons do you have?
 
WHOOPS AGAIN, I am about to type some code for another person, try using
code_language.skript:
format slot NUMBER of player with ITEM to be unstealable
instead of
code_language.skript:
set slot NUMBER of player to ITEM
 
I think that the clicked slot condition is the one that is bugging this all. Btw, i have all the latest versions of skript and server version, and i use: Skript, Umbaska, SkRayFall, SkQuery-Lime, RandomSk, MundoSk etc
 
Some stuff might be buggy in the newer versions, I don't know, I'm a spigot 1.8.9, Bensku dev 25 user, all this works for me.. but try using "format slot" instead of "set slot"
 
Explain the issue? Is it because the clicked slot is always going triggering on the slot after one you wanted?
 
Status
Not open for further replies.