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.

Help with TUSKE GUI

Discussion in 'Skript' started by Aleksandar Ovcharov, Dec 17, 2018.

Thread Status:
Not open for further replies.
  1. Aleksandar Ovcharov

    Joined:
    Apr 6, 2018
    Messages:
    4
    Likes Received:
    0
    Hello everybody, I am making my own skript for voting points | shop but I have a few problem with the GUI of Tuskie or even dont know how to do it.

    So this is my code for buy an item from the Shop

    Code (Skript):
    1.     trigger:
    2.         if arg 1 is "shop":
    3.             if arg 2 is not set:
    4.                 if arg 3 is not set:
    5.                     open virtual chest inventory with size 3 named "{@mshop}" to player
    6.                     wait 1 ticks
    7.                     loop {VotePointShop::*}:
    8.                         add 1 to {_gui.shop.slots}
    9.                         loop {VotePointShopItem::%loop-value-1%::*}:
    10.                             format gui slot {_gui.shop.slots} -1 of player with loop-value-2 with lore "" and "{@itembuying}" and  "&7&l{@itemprice}&f&l: &b%{VotePointShopPrice::%loop-value-1%::*}% {@prefix}" to run:
    11.                    
    12.                                 if {votepoints.%player's uuid%} >= {VotePointShopPrice::%loop-value-1%::*}:
    13.  
    14.                                     give {VotePointShopItem::%{loop-value-1}%::*} to player
    15.                                     remove {VotePointShopPrice::%{loop-value-1}%::*} from {votepoints.%player's uuid%}
    16.  
    17.                                     close inventory of player
    18.  
    19.                                     send "{@doneline}"
    20.                                     send ""
    21.                                     message centered "{@dcolor}Congratulations you have bought &c%{VotePointShopItem::%loop-value-1%::*}% {@dcolor}for &9%{VotePointShopPrice::%loop-value-1%::*}%" to player
    22.                                     message centered "{@icolor}Now you have&f&l: &9%{votepoints.%player's uuid%}% VotePoints" to player
    23.                                     send ""
    24.                                     send "{@doneline}"
    25.                                 else:
    26.  
    27.                                     close inventory of player
    28.  
    29.                                     send "{@infoline}"
    30.                                     send ""
    31.                                     message centered "{@icolor}You don't have enough {@prefix} {@icolor}to purchase &b%{VotePointShopItem::%loop-value-1%::*}%" to player
    32.                                     message centered "&7The item price is&f&l: &9%{VotePointShopPrice::%loop-value-1%::*}% {@prefix} &8&l❙ {@YouHave}" to player
    33.                                     send ""
    34.                                     send "{@infoline}"
    This is how its look http://prntscr.com/lvw2q5 but the problem become when I try to buy something I have enough points but it show me this http://prntscr.com/lvw32a even it does not show the item as should.
    But when I am doing it this way below its working great... But I want to made it streat from the GUI above not with two commands.. Can somebody help me.
    Note! I am not from UK or any other country where the 1st language is English ! I am sorry for my english know its not well, hope somebody can help me.


    Code (Skript):
    1. command /testbuy [<text>]:
    2.     trigger:
    3.         if arg is not set:
    4.             loop {VotePointShop::*}:
    5.                 json("%player%", "&c&l&%loop-value%||ttp: &aClick Me &c;) ||cmd:/testbuy %loop-value%")
    6.         else:
    7.             if {votepoints.%player's uuid%} >= {VotePointShopPrice::%arg%::*}:
    8.                 give {VotePointShopItem::%arg%::*} to player
    9.                 remove {VotePointShopPrice::%arg%::*} from {votepoints.%player's uuid%}
    10.                 send "Yes you buy that item!"
    11.             else:
    12.                 send "nope point !"
    13.                 send "You need: &7%{VotePointShopPrice::%arg%::*}%"
    14.                
    15.  
    16. command /testmainmenu [<text>]:
    17.     trigger:
    18.         if arg is not set:
    19.             open virtual chest inventory with size 1 named "test" to player
    20.             wait 1 ticks
    21.             loop {VotePointShop::*}:
    22.             add 1 to {_gui.shop.slots}
    23.                 loop {VotePointShopItem::%loop-value-1%::*}:
    24.                     format gui slot {_gui.shop.slots} -1 of player with loop-value-2 to run player command "/testbuy %loop-value-1%"
    25.  
     
  2. Ayham Alali

    Supporter Dev Programme

    Joined:
    Jan 25, 2017
    Messages:
    51
    Likes Received:
    13
    Medals:
    Hey,

    When using (to run: ) code you you must use local variables instead of loop values or any value that isn't saved as a permanent or local data.. in other words TuSKe can't get points of loop-value-1 because loop-value-1 isn't a saved data it's just an instant data that will be unknown when your code runs later because (to run: ) code may get ran at anytime so it won't be able to get loop-value-1 nor it's variables/data.

    Solution:

    Code (Text):
    1.  
    2.     trigger:
    3.         if arg 1 is "shop":
    4.             if arg 2 is not set:
    5.                 if arg 3 is not set:
    6.                     open virtual chest inventory with size 3 named "{@mshop}" to player
    7.                     wait 1 ticks
    8.                     loop {VotePointShop::*}:
    9.                         add 1 to {_gui.shop.slots}
    10.                         set {_loopValue} to loop-value-1
    11.                         loop {VotePointShopItem::%loop-value-1%::*}:
    12.                             format gui slot {_gui.shop.slots} -1 of player with loop-value-2 with lore "" and "{@itembuying}" and  "&7&l{@itemprice}&f&l: &b%{VotePointShopPrice::%loop-value-1%::*}% {@prefix}" to run:
    13.                  
    14.                                 if {votepoints.%player's uuid%} >= {VotePointShopPrice::%{_loopValue}%::*}:
    15.  
    16.                                     give {VotePointShopItem::%{{_loopValue}}%::*} to player
    17.                                     remove {VotePointShopPrice::%{{_loopValue}}%::*} from {votepoints.%player's uuid%}
    18.  
    19.                                     close inventory of player
    20.  
    21.                                     send "{@doneline}"
    22.                                     send ""
    23.                                     message centered "{@dcolor}Congratulations you have bought &c%{VotePointShopItem::%{_loopValue}%::*}% {@dcolor}for &9%{VotePointShopPrice::%{_loopValue}%::*}%" to player
    24.                                     message centered "{@icolor}Now you have&f&l: &9%{votepoints.%player's uuid%}% VotePoints" to player
    25.                                     send ""
    26.                                     send "{@doneline}"
    27.                                 else:
    28.  
    29.                                     close inventory of player
    30.  
    31.                                     send "{@infoline}"
    32.                                     send ""
    33.                                     message centered "{@icolor}You don't have enough {@prefix} {@icolor}to purchase &b%{VotePointShopItem::%{_loopValue}%::*}%" to player
    34.                                     message centered "&7The item price is&f&l: &9%{VotePointShopPrice::%{_loopValue}%::*}% {@prefix} &8&l❙ {@YouHave}" to player
    35.                                     send ""
    36.                                     send "{@infoline}"
    37.  
    EDIT: Original Thread: LINK
     
    #2 Ayham Alali, Dec 17, 2018
    Last edited: Dec 17, 2018
  3. Aleksandar Ovcharov

    Joined:
    Apr 6, 2018
    Messages:
    4
    Likes Received:
    0
    Yes I have try it but it give me the item with the lore info in the line down, somehow it should not give me the item in my list with the lore of gui slot but it does

    Code (Skript):
    1. format gui slot {_gui.shop.slots} -1 of player with loop-value-2 with lore "" and "{@itembuying}" and  "&7&l{@itemprice}&f&l: &b%{VotePointShopPrice::%loop-value-1%::*}% {@prefix}" to run:
    2.                  
     
  4. Ayham Alali

    Supporter Dev Programme

    Joined:
    Jan 25, 2017
    Messages:
    51
    Likes Received:
    13
    Medals:
    That's because you're storing the item with all it's data (name, lore etc.) in the second looped variable.. if you only want to get the item type and set it's lores in GUI separately use
    Code (Text):
    1. type of loop-value-2
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...