1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved skQuery not working?

Discussion in 'Skript' started by Shroomz, Jul 12, 2017.

Thread Status:
Not open for further replies.
  1. Shroomz

    Supporter +

    Joined:
    Jun 22, 2017
    Messages:
    44
    Likes Received:
    0
    I was doing custom GUI with skQuery but some reason it does not want to work (or I am shitting on myself)

    It does close it if I want it to but it does not run the command..

    Small snip from my skript:
    Code (Skript):
    1. format slot 1 of player with book named "&6New account book" with lore "&5With this you can create a copy of the existing||&5bank account's book. Remember to get||&5the new account book fee!" to run "/account book"
    2. format slot 3 of player with player head named "&6Add User" with lore "&5You can add user to bank account||&5Remember to check that account's owner is asking this!" to close then run "account add"


     
  2. Best Answer:
    Post #10 by ShaneBee, Jul 12, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    If you really want to use skQuery's format slot expression, you'll need to use lambdas; something like this:
    Code (Skript):
    1.  
    2. format slot 1 of player with book named "&6New account book" with lore "&5With this you can create a copy of the existing||&5bank account's book. Remember to get||&5the new account book fee!" to run [make player execute command "/account book"]
    3. format slot 3 of player with player head named "&6Add User" with lore "&5You can add user to bank account||&5Remember to check that account's owner is asking this!" to close then run [make player execute command "/account add"]
    4.  
    But honestly, don't use format slot (unless you really really really need to use lambdas, which most of the time is unnecessary).

    Use Skript's set slot function; it's more reliable. As for converting to it, it's syntax is pretty similar to skQuery's:

    Code (Skript):
    1.  
    2. set slot 1 of player to book named "&6New account book" with lore "&5With this you can create a copy of the existing||&5bank account's book. Remember to get||&5the new account book fee!"
    3. set slot 3 of player to player head named "&6Add User" with lore "&5You can add user to bank account||&5Remember to check that account's owner is asking this!"
    4.  
    5. on inventory click:
    6.     name of player's current inventory is "Inventory Name!"
    7.     cancel event
    8.     clicked slot is 1:
    9.         make player execute command "/account book"
    10.     clicked slot is 3:
    11.         make player execute command "/account add"
    12.  
    All the command stuffs is done in an "on inventory click" event
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Well that "set" works super badly... when you close the "GUI" the blocks and items stay in players inventory :I
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Whoops; sorry.

    Code (Skript):
    1.  
    2. set slot 1 of player's current inventory to book named "&6New account book" with lore "&5With this you can create a copy of the existing||&5bank account's book. Remember to get||&5the new account book fee!"
    3. set slot 3 of player's current inventoryto player head named "&6Add User" with lore "&5You can add user to bank account||&5Remember to check that account's owner is asking this!"
    4.  
    5. on inventory click:
    6.     name of player's current inventory is "Inventory Name!"
    7.     cancel event
    8.     clicked slot is 1:
    9.         make player execute command "/account book"
    10.     clicked slot is 3:
    11.         make player execute command "/account add"
    12.  
    If you do ever plan on using set slot, formatting a gui needs player's current inventory rather than just player
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    and one more thing... it puts those items in players hotbar. Not in the opened GUI :I formatting slot has worked well... only the running commands is the not working part
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Eh, to each their own; player's current inventory shouldn't format the slots in the player's hotbar, as it's not the player's actual inventory. Maybe it's an addon, idk.

    Honestly, if you want to use format slot, go ahead; it can be useful, despite what people say about it. Using lambdas should make running commands work though, as I did in my original reply
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Some reason its buggy? Its not still working ... anyone know why I cant run command when I click item on SkQuery GUI
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    I suggest you to use Tuske for these things.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    What is Tuske?
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Well.... This did not work
    Code (Skript):
    1. open virtual chest inventory with size 1 named "Bank Management" to player
    2. wait 1 tick
    3. format gui slot 0 of player with book and quill named "&6Create new bank account" with lore "&5By pressing this you can create||&5bank account for player. Remember to get||&5the new account fee!" to close then run "/account create"
     
  13. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    @Scarlet

    Examples codes of what you can do with Tuske.

    Code (Skript):
    1. open virtual chest inventory with size 6 named "Hi, this is the title" to player
    2. #The size is only for chest and goes from 1 to 6. (You can use others numbers, but it will be a glitched inventory).
    3. create a gui slot 1 of player with potato to close with left click
    4. create a gui slot 2 of player with paper to run player command "opCommandHere" with permission "*"
    5. create a gui slot 3 of player with diamond to run console command "CommandHere"
    6. create a gui slot 4 of player with gravel to run function giveItems(player) with cursor item stone
    7.  
    8. on right click on enchantment table:
    9.     make a gui slot 1 of player with lapis lazuli to do nothing
    10. on enchant:
    11.     wait a tick  
    12.     make a gui slot 1 of player with lapis lazuli to do nothing
     
  14. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    How can I do that it runs command and then closes the GUI?
     
  15. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Just put that in every command.
    Code (Skript):
    1. close player's inventory
     
  16. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
  17. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Read above
     
Thread Status:
Not open for further replies.

Share This Page

Loading...