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

Chest gui

Discussion in 'Skript' started by Fridious, Jun 29, 2017.

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

    Fridious Active Member

    Joined:
    Jun 23, 2017
    Messages:
    33
    Likes Received:
    0
    Hey,
    how can I set an item on the first free slot of a chest gui and how can i sort a gui for the alphabeticfor example a to z?

    Thank you :emoji_slight_smile:
     
    #1 Fridious, Jun 29, 2017
    Last edited: Jun 29, 2017
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    A way to achieve the first part could be to loop through the slots until you find an empty slot.

    As for the second part, I don't believe Skript has a built in alphabetical sorting, so you'd have to code and implement your own algorithm.
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    for alphabet


    Code (Skript):
    1. loop alphabetical order of {_var::*}: # TuSKe  addon needed
    2.     send "%loop-object%"
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150

    Code (Skript):
    1.  
    2. command /hats2:
    3.     trigger:
    4.         open chest with 6 rows named "&bHats 2" to player
    5.         wait 3 ticks
    6.         format slot 0 of player with blue stained glass pane named "&9Sup" to be unstealable
    7.         format slot 9 of player with blue stained glass pane named "&9Sup" to be unstealable
    8.         format slot 18 of player with blue stained glass pane named "&9JrSup" to be unstealable
    9.         format slot 27 of player with yellow stained glass pane named "&eH-Build" to be unstealable
    10.         format slot 36 of player with yellow stained glass pane named "&eBuild" to be unstealable
    11.         format slot 49 of player with emerald named "&fSeite 2/3" to be unstealable
    12.         format slot 45 of player with slimeball named "&cZurück" to run [execute player command "/extras"]
    13.         format slot 52 of player with arrow named "&7Vorherige Seite" to run [execute player command "/hats"]
    14.         format slot 53 of player with arrow named "&7Nächste Seite" to run [execute player command "/hats3"]
    15.  
    How can I sort this alphabetic?
    --- Double Post Merged, Jun 30, 2017, Original Post Date: Jun 30, 2017 ---

    Can you give me an example pls? :emoji_slight_smile:
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Code (Skript):
    1.  
    2. open chest with 6 rows named "Double Chest" to player
    3. # looping all slots; assuming double chest ^
    4. loop integers between 0 and 53:
    5.     # is the item in this slot is air
    6.     if "%slot loop-integer of player's current inventory%" is "air":
    7.         # do stuff
    8.         message "test" to player
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150


    Code (Skript):
    1.  
    2. command /hatstest2:
    3.     trigger:
    4.         open chest with 6 rows named "Double Chest" to player
    5.         # looping all slots; assuming double chest ^
    6.         loop integers between 0 and 53:
    7.             # is the item in this slot is air
    8.             if "%slot loop-integer of player's current inventory%" is "air":
    9.                 if player has permission "lobby.head.fridioushd":
    10.                     wait 3 ticks
    11.                     format slot %slot loop-integer of player's current inventory% of player with arrow named "&7Nächste Seite" to run [execute player command "/hats"]
    12.  
    Can you say what is wrong, because if i execute this command there is a Error:
    Code (Skript):
    1.  
    2. [15:17:04 INFO]: [Skript] Reloading lobby.sk...
    3. [15:17:04 INFO]: Lobby wurde deaktiviert
    4. [15:17:04 INFO]: Lobby wurde aktiviert
    5. [15:17:06 ERROR]: '"/hats"]' is not a text (lobby.sk, line 315: format slot %slot loop-integer of player's current inventory% of player with arrow named "&7Nõchste Seite" to run [execute player command "/hats"]')
    6. [15:17:06 INFO]: [Skript] Encountered 1 error while reloading lobby.sk!
    7.  
    And if I open the gui with the command there is no item in it.
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    The code
    Code (Skript):
    1. %slot loop-integer of player's current inventory%
    produces the name of the item of that slot. Replace that with just "loop-integer"
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Can you send me the code with that because i don't understand it
    I am from Germany and i am not the best in english sorry :emoji_frowning:
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Code (Skript):
    1. command /hatstest2:
    2.     trigger:
    3.         open chest with 6 rows named "Double Chest" to player
    4.         # looping all slots; assuming double chest ^
    5.         loop integers between 0 and 53:
    6.             # is the item in this slot is air
    7.             if "%slot loop-integer of player's current inventory%" is "air":
    8.                 if player has permission "lobby.head.fridioushd":
    9.                     wait 3 ticks
    10.                     format slot loop-integer of player with arrow named "&7Nächste Seite" to run [execute player command "/hats"]
    11.  
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150

    Thank you but this item is not in the inventory
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Hmm; perhaps try replacing the formate line with this:
    Code (Skript):
    1. set slot loop-integer of player's current inventory to arrow named "&7Nächste Seite" to run [execute player command "/hats"]
     
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150

    No this didn't work error:
    Code (Skript):
    1.  
    2. [Skript] Reloading lobby.sk...
    3. [15:49:18 INFO]: Lobby wurde deaktiviert
    4. [15:49:18 INFO]: Lobby wurde aktiviert
    5. [15:49:20 ERROR]: 'player with arrow named "&7Nõchste Seite"' is not an entity type (lobby.sk, line 314: set slot loop-integer of player with arrow named "&7Nõchste Seite" to run [execute player command "/hats"]')
    6. [15:49:20 INFO]: [Skript] Encountered 1 error while reloading lobby.sk!
    7.  
     
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    You need to replace "with arrow" to "to arrow".

    And in german
    Mache aus dem "with arrow" ein "to arrow" dann sollte es gehen.
     
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Code (Skript):
    1.  
    2. command /hatstest2:
    3.     trigger:
    4.         open chest with 6 rows named "Double Chest" to player
    5.         # looping all slots; assuming double chest ^
    6.         loop integers between 0 and 53:
    7.             # is the item in this slot is air
    8.             if "%slot loop-integer of player's current inventory%" is "air":
    9.                 wait 10 ticks
    10.                 set slot loop-integer of player to arrow named "&7Nächste Seite" to run [execute player command "/hats"]
    11.  
    Funktioniert trotzdem nicht kannst du mir helfen?

    Error:
    Code (Skript):
    1.  
    2. [16:02:54 INFO]: [Skript] Reloading lobby.sk...
    3. [16:02:54 INFO]: Lobby wurde deaktiviert
    4. [16:02:54 INFO]: Lobby wurde aktiviert
    5. [16:02:56 ERROR]: '[execute player command "/hats"]' is not a text (lobby.sk, line 314: set slot loop-integer of player to arrow named "&7Nõchste Seite" to run [execute player command "/hats"]')
    6. [16:02:56 INFO]: [Skript] Encountered 1 error while reloading lobby.sk!
    7.  
     
  15. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Natürlich habs gerade gesehen

    Ändere die "set slot" Zeile zu dieser

    Code (Skript):
    1. format slot loop-integer of player's current inventory to arrow named "&7Nächste Seite" to run [execute player command "/hats"]
    Denn so etwas wie "run" gehört/funktioniert hinter
    set slot nicht.
     
  16. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Trotzdem Er

    Trotzdem Error:
    Code (Skript):
    1.  
    2. [16:11:26 INFO]: [Skript] Reloading lobby.sk...
    3. [16:11:26 INFO]: Lobby wurde deaktiviert
    4. [16:11:26 INFO]: Lobby wurde aktiviert
    5. [16:11:29 ERROR]: '"/hats"]' is not a text (lobby.sk, line 314: format slot loop-integer of player's current inventory to arrow named "&7Nõchste Seite" to run [execute player command "/hats"]')
    6. [16:11:29 INFO]: [Skript] Encountered 1 error while reloading lobby.sk!
    7.  
    Code:
    Code (Skript):
    1.  
    2. command /hatstest2:
    3.     trigger:
    4.         open chest with 6 rows named "Double Chest" to player
    5.         # looping all slots; assuming double chest ^
    6.         loop integers between 0 and 53:
    7.             # is the item in this slot is air
    8.             if "%slot loop-integer of player's current inventory%" is "air":
    9.                 wait 10 ticks
    10.                 format slot loop-integer of player's current inventory to arrow named "&7Nächste Seite" to run [execute player command "/hats"]
    11.  
     
  17. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Ich schaue mal kurz
    Nutze kein format slot somit werde ich mal schauen

    Code (Skript):
    1. format slot loop-integer of player's current inventory with arrow named "&7Nächste Seite" to run [make player execute command "/hats"]
     
    #17 ShaneBee, Jun 30, 2017
    Last edited by a moderator: Jun 30, 2017
  18. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Ok danke kannst mir auch gerne eine andere Methode schicken wie ich das Problem lösen kann
     
  19. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Nah

    Probiere erstmal die Zeile aus

    Kann grad nicht testen da ich im Urlaub bin^^
     
  20. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Geht auch nicht :
    Error:
    Code (Skript):
    1.  
    2. [16:22:14 INFO]: [Skript] Reloading lobby.sk...
    3. [16:22:14 INFO]: Lobby wurde deaktiviert
    4. [16:22:14 INFO]: Lobby wurde aktiviert
    5. [16:22:16 ERROR]: '"&7Nõchste Seite" to run [make player execute [SIZE=16px]command "/hats"]' is not a text (lobby.sk, line 314: format slot loop-integer of player's current inventory with arrow named "&7Nõchste Seite" to run [make player execute [SIZE=16px]command "/hats"]')
    6. [16:22:16 INFO]: [Skript] Encountered 1 error while reloading lobby.sk!
    7.  
     
Thread Status:
Not open for further replies.
Loading...