Detecting a gui slot

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

Yodexx

Member
Jun 13, 2020
19
0
1
By the way, I did check forums but it didn't really help me...
So what I'm trying to do is make a gui that detects if a certain item is in the empty slot and will put a "spell" on it, but for some reason it keeps popping up this error! (at the bottom)
This is my code:

Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick      

        format slot 0 of player with gray stained glass pane named "&a" to close
        format slot 1 of player with gray stained glass pane named "&a" to close
        format slot 2 of player with gray stained glass pane named "&a" to close
        format slot 3 of player with gray stained glass pane named "&a" to close
        format slot 4 of player with gray stained glass pane named "&a" to close
        format slot 5 of player with gray stained glass pane named "&a" to close
        format slot 6 of player with gray stained glass pane named "&a" to close
        format slot 7 of player with gray stained glass pane named "&a" to close
        format slot 8 of player with gray stained glass pane named "&a" to close
        format slot 9 of player with gray stained glass pane named "&a" to close
        format slot 10 of player with gray stained glass pane named "&a" to close
        format slot 11 of player with gray stained glass pane named "&a" to close
        format slot 12 of player with gray stained glass pane named "&a" to close
        format slot 14 of player with gray stained glass pane named "&a" to close
        format slot 15 of player with gray stained glass pane named "&a" to close
        format slot 16 of player with gray stained glass pane named "&a" to close
        format slot 17 of player with gray stained glass pane named "&a" to close
        format slot 18 of player with gray stained glass pane named "&a" to close
        format slot 19 of player with gray stained glass pane named "&a" to close
        format slot 20 of player with gray stained glass pane named "&a" to close
        format slot 21 of player with gray stained glass pane named "&a" to close
        format slot 23 of player with gray stained glass pane named "&a" to close
        format slot 22 of player with redstone block named "&3&lCombine" to close
        format slot 24 of player with gray stained glass pane named "&a" to close
        format slot 25 of player with gray stained glass pane named "&a" to close
        format slot 26 of player with gray stained glass pane named "&a" to close
        on inventory click:
            if inventory name of player's current inventory is "&c&lSpell Forge":
                if clicked slot is 13:
                    set {_spellforgeitem} to player's cursor
                    if lore of {_spellforgeitem} is "&fsup":
                        send "%{_spellforgeitem}%"
                        if name of {_spellforgeitem} is "&fTorch":
                            send "%{_spellforgeitem}%"

And when I reload the script it sends out this error:

Code:
Line 35: Can't understand this condition: 'on inventory click' (script.sk, line 35: on inventory click:')

How can I fix this?
 
Correcty way
Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick     
 
        format slot 0 of player with gray stained glass pane named "&a" to close
        format slot 1 of player with gray stained glass pane named "&a" to close
        format slot 2 of player with gray stained glass pane named "&a" to close
        format slot 3 of player with gray stained glass pane named "&a" to close
        format slot 4 of player with gray stained glass pane named "&a" to close
        format slot 5 of player with gray stained glass pane named "&a" to close
        format slot 6 of player with gray stained glass pane named "&a" to close
        format slot 7 of player with gray stained glass pane named "&a" to close
        format slot 8 of player with gray stained glass pane named "&a" to close
        format slot 9 of player with gray stained glass pane named "&a" to close
        format slot 10 of player with gray stained glass pane named "&a" to close
        format slot 11 of player with gray stained glass pane named "&a" to close
        format slot 12 of player with gray stained glass pane named "&a" to close
        format slot 14 of player with gray stained glass pane named "&a" to close
        format slot 15 of player with gray stained glass pane named "&a" to close
        format slot 16 of player with gray stained glass pane named "&a" to close
        format slot 17 of player with gray stained glass pane named "&a" to close
        format slot 18 of player with gray stained glass pane named "&a" to close
        format slot 19 of player with gray stained glass pane named "&a" to close
        format slot 20 of player with gray stained glass pane named "&a" to close
        format slot 21 of player with gray stained glass pane named "&a" to close
        format slot 23 of player with gray stained glass pane named "&a" to close
        format slot 22 of player with redstone block named "&3&lCombine" to close
        format slot 24 of player with gray stained glass pane named "&a" to close
        format slot 25 of player with gray stained glass pane named "&a" to close
        format slot 26 of player with gray stained glass pane named "&a" to close
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        if clicked slot is 13:
            set {_spellforgeitem} to player's cursor
            if lore of {_spellforgeitem} is "&fsup":
                send "%{_spellforgeitem}%"
                if name of {_spellforgeitem} is "&fTorch":
                    send "%{_spellforgeitem}%"
 
That did solve the error part (which thank you!), but for some reason the inventory click ain't working...
 
That did solve the error part (which thank you!), but for some reason the inventory click ain't working...
you're using ''format slot'' from skquery that doesnt works correctly, also you're using ''to close'' at the end so inventory clicks actions doesnt works, change it to ''to be unstealable'' or a better way is using vanilla format slot

Code:
set slot <int> of <target>'s current inventory to [amount] <item> [named %text%] [with lore %texts%]

Code:
set slot 23 of player's current inventory to gray stained glass pane named "&a"
set slot 22 of player's current inventory to redstone block named "&3&lCombine"
set slot 24 of player's current inventory to gray stained glass pane named "&a"
 
but how do I make it so that when an item is clicked it runs a command? is it the same as format slot just with set slot? (e.g set slot <id> of player's current inventory to gray stained glass pane named "&a" to close then run [execute player command "COMMAND HERE"])
 
but how do I make it so that when an item is clicked it runs a command? is it the same as format slot just with set slot? (e.g set slot <id> of player's current inventory to gray stained glass pane named "&a" to close then run [execute player command "COMMAND HERE"])

no, vanilla gui works with inventory clicks
Code:
on inventory click:
   if inventory name....
      cancel event # if u wanna make the item unstealable
      #do stuff

I recommend u to use Vanilla guis cuz its way better (confirmed) than SkQuery. You dont even need to use ''wait...'' in vanilla guis
 
well I mean well you hit like the redstone block (which would trigger a command, but that's still very helpful, thx)
[doublepost=1592016529,1592015140][/doublepost]Wait okay so would this work?

Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick       

        set slot 0 of player's current inventory to gray stained glass pane named "&a"
        set slot 1 of player's current inventory to gray stained glass pane named "&a"
        set slot 2 of player's current inventory to gray stained glass pane named "&a"
        set slot 3 of player's current inventory to gray stained glass pane named "&a"
        set slot 4 of player's current inventory to gray stained glass pane named "&a"
        set slot 5 of player's current inventory to gray stained glass pane named "&a"
        set slot 6 of player's current inventory to gray stained glass pane named "&a"
        set slot 7 of player's current inventory to gray stained glass pane named "&a"
        set slot 8 of player's current inventory to gray stained glass pane named "&a"
        set slot 9 of player's current inventory to gray stained glass pane named "&a"
        set slot 10 of player's current inventory to gray stained glass pane named "&a"
        set slot 11 of player's current inventory to gray stained glass pane named "&a"
        set slot 12 of player's current inventory to gray stained glass pane named "&a"
        set slot 13 of player's current inventory to gray stained glass pane named "&a"
        set slot 14 of player's current inventory to gray stained glass pane named "&a"
        set slot 15 of player's current inventory to gray stained glass pane named "&a"
        set slot 16 of player's current inventory to gray stained glass pane named "&a"
        set slot 17 of player's current inventory to gray stained glass pane named "&a"
        set slot 18 of player's current inventory to gray stained glass pane named "&a"
        set slot 19 of player's current inventory to gray stained glass pane named "&a"
        set slot 20 of player's current inventory to gray stained glass pane named "&a"
        set slot 21 of player's current inventory to gray stained glass pane named "&a"
        set slot 22 of player's current inventory to redstone block named "&3&lCombine"
        set slot 23 of player's current inventory to gray stained glass pane named "&a"
        set slot 24 of player's current inventory to gray stained glass pane named "&a"
        set slot 25 of player's current inventory to gray stained glass pane named "&a"
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to player's cursor
            if lore of {_spellforgeitem} is "&fsup":
                send "%{_spellforgeitem}%"
                if name of {_spellforgeitem} is "&fTorch":
                    send "%{_spellforgeitem}%"

Cause I feel like it wouldn't... :emoji_frowning:
 
well I mean well you hit like the redstone block (which would trigger a command, but that's still very helpful, thx)
[doublepost=1592016529,1592015140][/doublepost]Wait okay so would this work?

Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick     

        set slot 0 of player's current inventory to gray stained glass pane named "&a"
        set slot 1 of player's current inventory to gray stained glass pane named "&a"
        set slot 2 of player's current inventory to gray stained glass pane named "&a"
        set slot 3 of player's current inventory to gray stained glass pane named "&a"
        set slot 4 of player's current inventory to gray stained glass pane named "&a"
        set slot 5 of player's current inventory to gray stained glass pane named "&a"
        set slot 6 of player's current inventory to gray stained glass pane named "&a"
        set slot 7 of player's current inventory to gray stained glass pane named "&a"
        set slot 8 of player's current inventory to gray stained glass pane named "&a"
        set slot 9 of player's current inventory to gray stained glass pane named "&a"
        set slot 10 of player's current inventory to gray stained glass pane named "&a"
        set slot 11 of player's current inventory to gray stained glass pane named "&a"
        set slot 12 of player's current inventory to gray stained glass pane named "&a"
        set slot 13 of player's current inventory to gray stained glass pane named "&a"
        set slot 14 of player's current inventory to gray stained glass pane named "&a"
        set slot 15 of player's current inventory to gray stained glass pane named "&a"
        set slot 16 of player's current inventory to gray stained glass pane named "&a"
        set slot 17 of player's current inventory to gray stained glass pane named "&a"
        set slot 18 of player's current inventory to gray stained glass pane named "&a"
        set slot 19 of player's current inventory to gray stained glass pane named "&a"
        set slot 20 of player's current inventory to gray stained glass pane named "&a"
        set slot 21 of player's current inventory to gray stained glass pane named "&a"
        set slot 22 of player's current inventory to redstone block named "&3&lCombine"
        set slot 23 of player's current inventory to gray stained glass pane named "&a"
        set slot 24 of player's current inventory to gray stained glass pane named "&a"
        set slot 25 of player's current inventory to gray stained glass pane named "&a"
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to player's cursor
            if lore of {_spellforgeitem} is "&fsup":
                send "%{_spellforgeitem}%"
                if name of {_spellforgeitem} is "&fTorch":
                    send "%{_spellforgeitem}%"

Cause I feel like it wouldn't... :emoji_frowning:
ye but dont use ''if lore...'' because detecting lore always results in error, doesnt works correctly, just use:
Code:
if name of is/contains, if clicked item/slot, if etc is/contains
 
so delete the "if lore"? or just replace with something?
don't use ''lore'' to detecting items, just the name of clicked item
dont use player's cursor, too, i think doesnt work propertly

i changed these values and it works

Code:
set {_spellforgeitem} to clicked item # (instead of player's cursor)

if {_spellforgeitem} = "&fTorch": #instead of ''name of bla bla''
    send "%{_spellforgeitem}%"
 
So this is what I've got: (for inventory click)
Code:
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to clicked item # (instead of player's cursor)
            if {_spellforgeitem} = "&fTorch"
            send "%{_spellforgeitem}%"

but this came up:
Code:
Line 40: Can't compare 'if {_spellforgeitem}' with a text (script.sk, line 40: if {_spellforgeitem} = "&fTorch"')
 
Wrong usage, u forget '':'' and tab (4 spaces)

Code:
if {_spellforgeitem} = "&fTorch":
    send "%{_spellforgeitem}%"
 
so is this script suppost to message out the item name? because if so, its not working... :I
[doublepost=1592018398,1592018140][/doublepost]if you'd like to check my code here it is:
Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick       

        set slot 0 of player's current inventory to gray stained glass pane named "&a"
        set slot 1 of player's current inventory to gray stained glass pane named "&a"
        set slot 2 of player's current inventory to gray stained glass pane named "&a"
        set slot 3 of player's current inventory to gray stained glass pane named "&a"
        set slot 4 of player's current inventory to gray stained glass pane named "&a"
        set slot 5 of player's current inventory to gray stained glass pane named "&a"
        set slot 6 of player's current inventory to gray stained glass pane named "&a"
        set slot 7 of player's current inventory to gray stained glass pane named "&a"
        set slot 8 of player's current inventory to gray stained glass pane named "&a"
        set slot 9 of player's current inventory to gray stained glass pane named "&a"
        set slot 10 of player's current inventory to gray stained glass pane named "&a"
        set slot 11 of player's current inventory to gray stained glass pane named "&a"
        set slot 12 of player's current inventory to gray stained glass pane named "&a"
        set slot 14 of player's current inventory to gray stained glass pane named "&a"
        set slot 15 of player's current inventory to gray stained glass pane named "&a"
        set slot 16 of player's current inventory to gray stained glass pane named "&a"
        set slot 17 of player's current inventory to gray stained glass pane named "&a"
        set slot 18 of player's current inventory to gray stained glass pane named "&a"
        set slot 19 of player's current inventory to gray stained glass pane named "&a"
        set slot 20 of player's current inventory to gray stained glass pane named "&a"
        set slot 21 of player's current inventory to gray stained glass pane named "&a"
        set slot 22 of player's current inventory to redstone block named "&3&lCombine"
        set slot 23 of player's current inventory to gray stained glass pane named "&a"
        set slot 24 of player's current inventory to gray stained glass pane named "&a"
        set slot 25 of player's current inventory to gray stained glass pane named "&a"
        set slot 26 of player's current inventory to gray stained glass pane named "&a"
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to clicked item # (instead of player's cursor)
            if {_spellforgeitem} = "&fTorch":
                send "%{_spellforgeitem}%"
 
so is this script suppost to message out the item name? because if so, its not working... :I
[doublepost=1592018398,1592018140][/doublepost]if you'd like to check my code here it is:
Code:
command /mpsf:
    permission: minepvp.spellforge
    permission message: &cYou are not in the right lobby/game to do this!
    trigger:
        wait 1 tick
        open chest with 3 rows named "&c&lSpell Forge" to player
        wait 1 tick      

        set slot 0 of player's current inventory to gray stained glass pane named "&a"
        set slot 1 of player's current inventory to gray stained glass pane named "&a"
        set slot 2 of player's current inventory to gray stained glass pane named "&a"
        set slot 3 of player's current inventory to gray stained glass pane named "&a"
        set slot 4 of player's current inventory to gray stained glass pane named "&a"
        set slot 5 of player's current inventory to gray stained glass pane named "&a"
        set slot 6 of player's current inventory to gray stained glass pane named "&a"
        set slot 7 of player's current inventory to gray stained glass pane named "&a"
        set slot 8 of player's current inventory to gray stained glass pane named "&a"
        set slot 9 of player's current inventory to gray stained glass pane named "&a"
        set slot 10 of player's current inventory to gray stained glass pane named "&a"
        set slot 11 of player's current inventory to gray stained glass pane named "&a"
        set slot 12 of player's current inventory to gray stained glass pane named "&a"
        set slot 14 of player's current inventory to gray stained glass pane named "&a"
        set slot 15 of player's current inventory to gray stained glass pane named "&a"
        set slot 16 of player's current inventory to gray stained glass pane named "&a"
        set slot 17 of player's current inventory to gray stained glass pane named "&a"
        set slot 18 of player's current inventory to gray stained glass pane named "&a"
        set slot 19 of player's current inventory to gray stained glass pane named "&a"
        set slot 20 of player's current inventory to gray stained glass pane named "&a"
        set slot 21 of player's current inventory to gray stained glass pane named "&a"
        set slot 22 of player's current inventory to redstone block named "&3&lCombine"
        set slot 23 of player's current inventory to gray stained glass pane named "&a"
        set slot 24 of player's current inventory to gray stained glass pane named "&a"
        set slot 25 of player's current inventory to gray stained glass pane named "&a"
        set slot 26 of player's current inventory to gray stained glass pane named "&a"
on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to clicked item # (instead of player's cursor)
            if {_spellforgeitem} = "&fTorch":
                send "%{_spellforgeitem}%"
I did an error, i fixed
example https://gyazo.com/6de2c1aa64c8c1c7590ab5424a617ac7
Code:
command /x:
    trigger:
        wait 1 tick
        open chest with 2 row named "&c&lSpell forge" to player
        set slot 13 of player's current inventory to torch named "&fTorch"

on inventory click:
    if inventory name of player's current inventory is "&c&lSpell Forge":
        cancel event
        if clicked slot is 13:
            set {_spellforgeitem} to name of clicked item
            if {_spellforgeitem} = "&fTorch":
                send "%{_spellforgeitem}%"
 
Well theres not error on load, the server version is 1.8-1.5 (I'm using 1.15), and I think the latest skript version
[doublepost=1592083932,1592083890][/doublepost]It just won't do what its suppost to do... (e.g that video you showed me, I had the exact code and it did nothing... :I)
[doublepost=1592083979][/doublepost]I even ran the skript you made... :I still didn't work :emoji_frowning:
 
Well theres not error on load, the server version is 1.8-1.5 (I'm using 1.15), and I think the latest skript version
[doublepost=1592083932,1592083890][/doublepost]It just won't do what its suppost to do... (e.g that video you showed me, I had the exact code and it did nothing... :I)
[doublepost=1592083979][/doublepost]I even ran the skript you made... :I still didn't work :emoji_frowning:
try using skquery-lime by limeglass, its rlly weird tbh
 
Status
Not open for further replies.