Solved Format slot (virtual Chest GUI)

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

Hobbit41

Member
Jun 15, 2017
32
0
0
30
Minecraft Version: 1.8
Plugin: SKquery, TuSKe

Hello guys, im trying to open gui chest and format slot 10th with stone pickaxe.

Exception: when pressing on that pickaxe GUI must close and run "buy 1"

Issue: 1st: pickaxe does not show up and 2nd: command is not running (if type /buy 1 it works fine) and yes {toollevel.%player%} is actually 1

code_language.skript:
on right click with gold ingot:
    cancel event
    open chest with 3 rows named "&4ASK" to player
    if {toollevel.%player%} is 1:
        set {_toolslot} to "stone pickaxe named ""&cUpgrade"""
    format slot 10 of player with {_toolslot} to close then run "buy %{toollevel.%player%}%]"

   
command /buy <number>:
    trigger:
        if arg 1 is 1:
            remove wooden pickaxe from player
            give stone pickaxe to player

UPD: If I replace SKquery code with TuSke, so with line:
code_language.skript:
    create a gui slot 10 of player with {_toolslot} to run player command "buy %{toollevel.%player%}%"

Im getting no effect, and with line
code_language.skript:
    create a gui slot 10 of player with stone pickaxe named "&cUpgrade" to run player command "buy %{toollevel.%player%}%"

No pickaxe appears until Im pressing slot 10 by myself, right after that pickaxe appears.

where am I wrong?

72Hi8liZGr.png
 
code_language.skript:
on right click with gold ingot:
    cancel event
    open chest with 3 rows named "&4ASK" to player
    wait a tick
    if {toollevel.%player%} is 1:
        set {_toolslot} to stone pickaxe named "&cUpgrade"
    format slot 10 of player with {_toolslot} to close then run "buy %{toollevel.%player%}%]"

A text is not an itemstack. Using a variable that has text inside it will make no errors but it won't show.
Also, every time you open a chest to the player you have to wait a few ticks or you may be formatting his own inventory.

Also, SkQuery and format slot is really, really buggy.
I usually use
code_language.skript:
set slot 10 of current inventory of player to %itemstack%

and then use on inventory click to manage what each object executes when clicked.
code_language.skript:
on inventory click:
    inventory name of current inventory of player is "&4ASK"
    name of clicked item is "&cUpgrade"
    #stuff
 
  • Like
Reactions: Hobbit41
In the "click on <entity/block>" events, you need to wait a tick BEFORE opening the inventory. That's a Spigot bug, if you ask.
Oh well did not know that, now it works fine. Thanks!
[doublepost=1502795008,1502793292][/doublepost]very nice, Will use that line of code. Thanks!
code_language.skript:
on right click with gold ingot:
   

Also, SkQuery and format slot is really, really buggy.
I usually use
[code=Skript]set slot 10 of current inventory of player to %itemstack%

and then use on inventory click to manage what each object executes when clicked.
code_language.skript:
on inventory click:
    inventory name of current inventory of player is "&4ASK"
    name of clicked item is "&cUpgrade"
    #stuff
 
Status
Not open for further replies.