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.

Solved Replace every gui slot with item???

Discussion in 'Skript' started by VojaFTW, Sep 22, 2017.

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

    VojaFTW Active Member

    Joined:
    Jun 10, 2017
    Messages:
    42
    Likes Received:
    2
    Are is possible to apply a item to whole gui when open becouse i'm coding a free sign skript and i need that to replace whole 3 row chest with item from sign line 2.
    ex: if i write second sign line: stone to whole gui of that sign when i rightclick be stone.
    Gui get oppened but nothing is in him.

    my code:

    Code (Skript):
    1. on rightclick on sign:
    2.     if line 1 of event-block contains "Free":
    3.         set line 1 of event-block to "&3[&cFree&3]"
    4.         set {_item} to "%{freesign::item::%uncolored line 2 of event-block%}%"
    5.         wait 1 tick
    6.         open chest with 3 rows named "Free" to player
    7.         set {_slot} to 27
    8.         wait 2 tick
    9.         set slot {_slot} of player's current inventory to {_item}


     
  2. Best Answer:
    Post #4 by Donut, Sep 23, 2017
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    you need to parse the text as an item. this should maybe work
    Code (Skript):
    1. on rightclick on sign:
    2.     if line 1 of event-block contains "Free":
    3.         set line 1 of event-block to "&3[&cFree&3]"
    4.         set {_item} to "%{freesign::item::%uncolored line 2 of event-block%}%" parsed as item
    5.         wait 1 tick
    6.         open chest with 3 rows named "Free" to player
    7.         set {_slot} to 0
    8.         loop 27 times:
    9.             set slot {_slot} of player's current inventory to {_item}
    10.             add 1 to {_slot}
     
  4. VojaFTW

    VojaFTW Active Member

    Joined:
    Jun 10, 2017
    Messages:
    42
    Likes Received:
    2
    thank you, i try it.
    EDIT: i write sign and second line is "stone" or "1" and gui is empty
     
    #3 VojaFTW, Sep 22, 2017
    Last edited: Sep 22, 2017
  5. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    Im guessing there's something wrong with the variable {freesign::item::%uncolored line 2 of event-block%}. Not sure where you set that but why dont you just set {_item} to "%uncolored line 2 of event-block%" parsed as a item
     
    • Winner Winner x 1
  6. VojaFTW

    VojaFTW Active Member

    Joined:
    Jun 10, 2017
    Messages:
    42
    Likes Received:
    2
    Its working i just change variable to uncolored line 2 of event block and its working, thank you
     
Thread Status:
Not open for further replies.
Loading...