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

cheatchki

Supporter ++
Jun 26, 2017
49
1
8
25
So this is probably a sad question, however I am new to skript and I can not find the answer anywhere anyways
so I open a GUI as follows
code_language.skript:
command /punish <player>:
    trigger:
        set {%player%.currentpunish} to arg 1
        open chest with 6 rows named "&lPunish %arg 1%" to player
        wait 1 tick
        format slot 10 of player with cobweb named "&c&lTrolling" with lore "&6offenses: %{punishtroll.%arg 1%}%" to close then run "punishment %arg 1% troll %player%"
this works great and all however it means I can't differentiate the clicks. I would like to be able to add custom commands to each different click be it middle, shiftR, shiftL, Right, or left.

I have tried something like this
code_language.skript:
on inventory click:
    if inventory name of player's current inventory is "&lPunish %{%player%.currentpunish}%":
        cancel the event
        if clicked type is middle mouse button:
            message "middle"
        else:
            message "unconfigured"
and I set the to close then run to just to close. However whenever I try to click on the item it just closes the inventory. Yet whenever I click anywhere else my little add-on code works just fine.
I'm not exactly sure what I may be doing wrong, I have latest skript, skquery, and Umbaska installed.
 
First of all, if you have Umbaska 2, you should remove it as it's known to be buggy. And for that, you shouldn't use the format slot as this is also known to be really buggy and annoying. Your issue is that the format slot is cancelling the inventory click event, therefore, not triggering the inventory click event in the script and not running your code.

You can use set slot if you wanna do that. It should look something like this:

code_language.skript:
command punish <player>:
    trigger:

        open chest with 6 rows named "<bold>Punish %arg-1%" to player

        #with the set slot, you don't have to wait a tick.
        #Also, the use of player's name as prefix of your variable is discouraged and you shouldn't do that.
        #It's also discouraged to use single variables where you can use a list variable, keep that in mind. A better variable would be:

        set slot 10 of player's inventory to cobweb named "<light red><bold>Trolling" with lore "<brown>offenses: %{punishtroll::%arg-1's uuid%}"

on inventory click:
   
    set {_name} to subtext of display name of event-inventory from 1 to (length of "Punish" + 1)

    if uncolored {_name} is "Punish":

        cancel the event

        if type of event-slot is coweb:
            if event-click action is middle mouse button:

                send "middle"

            else:

                send "unconfigured"
 
Well, I tried out implementing most of your code into mine, however the cobweb is going into slot 10 of a default player inventory, not the chest inventory. (so cobweb is going into what should be slot 55 of the chest)
[doublepost=1498571232,1498569777][/doublepost]Cancel that, however thank you Snow-Pyon for the help, I looked around a bit more found some extra events and finally have it set up properly!
 
Status
Not open for further replies.