xWires Posted August 27, 2023 Share Posted August 27, 2023 For some reason all the items have <none> as the cost (example: "Tier 1 Generator ($<none>)" I don't have much experience with functions in skript, so I don't know why it's happening. command /servershop: permission: wirednetwork.servershop permission message: &cYou don't have permission to run this command. executable by: players trigger: shopGUI(player) function shopGUI(p: player): set {_gui} to chest inventory with 6 rows named "WiredGens Shop" set slot (integers between 0 and 54) of {_gui} to gray stained glass pane named " " set slot 10 of {_gui} to white stained glass named "&rTier 1 Generator (&a$%{getGenCost()}%&r)" set slot 12 of {_gui} to command block named "&rGen Slot (&a%{getSlotCost(%{_p}%)}% tokens&r)" set slot 14 of {_gui} to blaze rod named "&rSellwand (&a%{getSellwandCost()}% tokens&r)" set slot 16 of {_gui} to paper named "&rRanks" open {_gui} to {_p} on inventory click: name of event-inventory is "WiredGens Shop" cancel event event-inventory is not player's inventory if clicked slot is 10: make player execute command "/buygen" if clicked slot is 12: make player execute command "/buygenslots" if clicked slot is 14: make player execute command "/buysellwand" if clicked slot is 16: close player's inventory make player execute command "/ranks" #This is what one of the functions looks like function getGenCost() :: number: #cost is set in the options at the beginning of this script return {@cost} Owner of WiredGens (wiredgens.minehut.gg) Plugin Developer and Skripter Link to comment Share on other sites More sharing options...
JoshG Posted August 27, 2023 Share Posted August 27, 2023 I don't see why you need to run a function that just returns {@cost}, I would replace the function with just simply {@cost}. But, I can see maybe it being run when the cost option is not set in another file, so I think the easiest fix is function getGenCost() :: number: return "{@cost}" Remember skript see's options as a text, which is the reason the below works options: command: skriptcommand message: Message set in options command /{@command}: trigger: send "{@message}" Let me know If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol. Link to comment Share on other sites More sharing options...
xWires Posted August 28, 2023 Author Share Posted August 28, 2023 (edited) 15 hours ago, JoshG said: I don't see why you need to run a function that just returns {@cost}, I would replace the function with just simply {@cost}. But, I can see maybe it being run when the cost option is not set in another file, so I think the easiest fix is function getGenCost() :: number: return "{@cost}" Remember skript see's options as a text, which is the reason the below works options: command: skriptcommand message: Message set in options command /{@command}: trigger: send "{@message}" Let me know It still does the same thing. It also give me this error: This function is declared to return a number, but "250" is not of that type. Edited August 28, 2023 by xWires Owner of WiredGens (wiredgens.minehut.gg) Plugin Developer and Skripter Link to comment Share on other sites More sharing options...
JoshG Posted August 30, 2023 Share Posted August 30, 2023 Odd, try this function getGenCost(): return "{@cost}" If I helped you at all please consider boosting my account with the follow button! Minehut ♥ [VIP] 12/19/2020 - Present I am either extremely active or not lol. Link to comment Share on other sites More sharing options...
xWires Posted August 30, 2023 Author Share Posted August 30, 2023 5 hours ago, JoshG said: Odd, try this function getGenCost(): return "{@cost}" Now I get this: [08:55:57 INFO]: [Skript] Reloading buyGen.sk... [08:55:57 INFO]: Line 19: (buyGen.sk) [08:55:57 INFO]: This function doesn't return any value. Please use 'stop' or 'exit' if you want to stop the function. [08:55:57 INFO]: Line: return "{@cost}" [08:55:57 INFO]: [08:55:57 INFO]: [Skript] Encountered 1 error while reloading buyGen.sk! (7ms) Owner of WiredGens (wiredgens.minehut.gg) Plugin Developer and Skripter Link to comment Share on other sites More sharing options...
xWires Posted September 1, 2023 Author Share Posted September 1, 2023 (edited) I fixed it by setting a variable to the result of the function then using that in the string instead. Example: set {_genCost} to getGenCost() set slot 10 of {_gui} to white stained glass named "&rTier 1 Generator (&a$%{_genCost}%&r)" Edited September 1, 2023 by xWires Owner of WiredGens (wiredgens.minehut.gg) Plugin Developer and Skripter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now