Help with TUSKE 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.
Apr 6, 2018
4
0
0
27
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_language.skript:
    trigger:
        if arg 1 is "shop":
            if arg 2 is not set:
                if arg 3 is not set:
                    open virtual chest inventory with size 3 named "{@mshop}" to player
                    wait 1 ticks
                    loop {VotePointShop::*}:
                        add 1 to {_gui.shop.slots}
                        loop {VotePointShopItem::%loop-value-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:
                    
                                if {votepoints.%player's uuid%} >= {VotePointShopPrice::%loop-value-1%::*}:

                                    give {VotePointShopItem::%{loop-value-1}%::*} to player
                                    remove {VotePointShopPrice::%{loop-value-1}%::*} from {votepoints.%player's uuid%}

                                    close inventory of player

                                    send "{@doneline}"
                                    send ""
                                    message centered "{@dcolor}Congratulations you have bought &c%{VotePointShopItem::%loop-value-1%::*}% {@dcolor}for &9%{VotePointShopPrice::%loop-value-1%::*}%" to player
                                    message centered "{@icolor}Now you have&f&l: &9%{votepoints.%player's uuid%}% VotePoints" to player
                                    send ""
                                    send "{@doneline}"
                                else:

                                    close inventory of player

                                    send "{@infoline}"
                                    send ""
                                    message centered "{@icolor}You don't have enough {@prefix} {@icolor}to purchase &b%{VotePointShopItem::%loop-value-1%::*}%" to player
                                    message centered "&7The item price is&f&l: &9%{VotePointShopPrice::%loop-value-1%::*}% {@prefix} &8&l❙ {@YouHave}" to player
                                    send ""
                                    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_language.skript:
command /testbuy [<text>]:
    trigger:
        if arg is not set:
            loop {VotePointShop::*}:
                json("%player%", "&c&l&%loop-value%||ttp: &aClick Me &c;) ||cmd:/testbuy %loop-value%")
        else:
            if {votepoints.%player's uuid%} >= {VotePointShopPrice::%arg%::*}:
                give {VotePointShopItem::%arg%::*} to player
                remove {VotePointShopPrice::%arg%::*} from {votepoints.%player's uuid%}
                send "Yes you buy that item!"
            else:
                send "nope point !"
                send "You need: &7%{VotePointShopPrice::%arg%::*}%"
                

command /testmainmenu [<text>]:
    trigger:
        if arg is not set:
            open virtual chest inventory with size 1 named "test" to player
            wait 1 ticks
            loop {VotePointShop::*}:
            add 1 to {_gui.shop.slots}
                loop {VotePointShopItem::%loop-value-1%::*}:
                    format gui slot {_gui.shop.slots} -1 of player with loop-value-2 to run player command "/testbuy %loop-value-1%"
 
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:
    trigger:
        if arg 1 is "shop":
            if arg 2 is not set:
                if arg 3 is not set:
                    open virtual chest inventory with size 3 named "{@mshop}" to player
                    wait 1 ticks
                    loop {VotePointShop::*}:
                        add 1 to {_gui.shop.slots}
                        set {_loopValue} to loop-value-1
                        loop {VotePointShopItem::%loop-value-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:
                 
                                if {votepoints.%player's uuid%} >= {VotePointShopPrice::%{_loopValue}%::*}:

                                    give {VotePointShopItem::%{{_loopValue}}%::*} to player
                                    remove {VotePointShopPrice::%{{_loopValue}}%::*} from {votepoints.%player's uuid%}

                                    close inventory of player

                                    send "{@doneline}"
                                    send ""
                                    message centered "{@dcolor}Congratulations you have bought &c%{VotePointShopItem::%{_loopValue}%::*}% {@dcolor}for &9%{VotePointShopPrice::%{_loopValue}%::*}%" to player
                                    message centered "{@icolor}Now you have&f&l: &9%{votepoints.%player's uuid%}% VotePoints" to player
                                    send ""
                                    send "{@doneline}"
                                else:

                                    close inventory of player

                                    send "{@infoline}"
                                    send ""
                                    message centered "{@icolor}You don't have enough {@prefix} {@icolor}to purchase &b%{VotePointShopItem::%{_loopValue}%::*}%" to player
                                    message centered "&7The item price is&f&l: &9%{VotePointShopPrice::%{_loopValue}%::*}% {@prefix} &8&l❙ {@YouHave}" to player
                                    send ""
                                    send "{@infoline}"

EDIT: Original Thread: LINK
 
Last edited:
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_language.skript:
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:
 
Status
Not open for further replies.