Can you fill slots of a skript-GUI gui with functions?

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

SpikyCrab

Member
Jun 1, 2020
2
0
1
21
I used to have a skript for a shop with TusKe but it has been broken in the new update, I have been recommended skript-GUI and wanted to know whether I could do the same thing with skript-GUI

My skript (A snippet):

if arg 1 is "6":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 1000, potion of night vision, 1, "&fNight Vision", 2)
shop(player, 20, 2000, potion of long night vision, 1, "&fNight Vision (Longer)", 2)
shop(player, 21, 1000, potion of speed, 1, "&fSpeed", 2)
shop(player, 22, 4000, potion of strong speed, 1, "&fSpeed (Stronger)", 2)
shop(player, 23, 1000, potion of jumping, 1, "&fJump Boost", 2)
shop(player, 24, 4000, potion of strong jumping, 1, "&fJump Boost (Stronger)", 2)
shop(player, 25, 1000, potion of fire resistance, 1, "&fFire Proof Potion", 2)
shop(player, 28, 1000, potion of slow falling, 1, "&fSlow Falling", 2)
shop(player, 29, 2000, potion of long slow falling, 1, "&fSlow Falling (Longer)", 2)

if arg 1 is "7":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 100000, netherrack, 64, "&fNetherrack", 2)
shop(player, 20, 100000, warped Hyphae, 16, "&fWarped Hyphae", 2)
shop(player, 21, 100000, crimson Hyphae, 64, "&fCrimson Hyphae", 2)
shop(player, 22, 100000, nether brick, 64, "&fNether Brick", 2)
shop(player, 23, 100000, cracked nether bricks, 64, "&fCracked Nether Bricks", 2)
shop(player, 24, 100000, chiseled nether bricks, 64, "&fChiseled Nether Bricks", 2)
shop(player, 25, 100000, nether brick stairs, 64, "&fNether Brick Stairs", 2)
shop(player, 28, 100000, magma block, 64, "&fMagma Block", 2)
shop(player, 29, 100000, nether wart block, 64, "&fNether Wart Block", 2)
shop(player, 30, 100000, warped wart block, 64, "&fWarped Wart Block", 2)
shop(player, 31, 100000, Gilded Blackstone, 64, "&fGuilded Blackstone", 2)
shop(player, 32, 100000, blackstone stairs, 64, "&fBlackstone Stairs", 2)
shop(player, 33, 100000, blackstone slab, 64, "&fBlackstone Slabs", 2)
shop(player, 34, 100000, blackstone, 64, "&fBlackstone", 2)
shop(player, 37, 100000, basalt, 64, "&fBasalt", 2)
shop(player, 38, 100000, polished basalt, 64, "&fPolished Basalt", 2)

#shop(player, format slot, cost, item, how much you get, "name of item") when you put the name of the item you need quotes

if arg 1 is "uuw":
create a gui with virtual chest inventory with 3 rows named "Select Your Chat Settings":


shop(player, 1, 10, dirt, 64, "&fDirt")

function shop(p: player, i: integer, c: integer, it: itemtype, a: integer, m: string, sp: number = 1):
format gui slot {_i} with {_a} named "%{_m}%" with lore "&7Cost: &6$%{_c}%" and "&7Amount: &6%{_a}%":
if {_p}'s balance is greater than or equal to {_c}:
remove {_c} from {_p}'s balance
give {_a} of {_it} named "%{_m}%" to {_p}
send "&aPurchase Completed." to {_p}
else:
send "&cPurchase Failed, Insufficient Funds" to {_p}

if {_sp} is 1:

format gui slot 1 of {_p} with honey block named "&6&lGenerators" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 0"
format gui slot 2 of {_p} with grass block named "&a&lBlocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 3 of {_p} with water bucket named "&b&lMisc" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 2"
format gui slot 4 of {_p} with netherite pickaxe named "&5&lTools" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 3"
format gui slot 5 of {_p} with stick of infinity named "&e&lSell Wands" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 4"
format gui slot 6 of {_p} with arrow named "&7Next Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
if {_sp} is 2:
format gui slot 1 of {_p} with arrow named "&7Previous Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 2 of {_p} with netherite hoe named "&2&lFarming" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
format gui slot 3 of {_p} with potion of night vision named "&e&lPotions" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 6"
format gui slot 4 of {_p} with netherrack named "&c&lNether Blocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 7"
 
I used to have a skript for a shop with TusKe but it has been broken in the new update, I have been recommended skript-GUI and wanted to know whether I could do the same thing with skript-GUI

My skript (A snippet):

if arg 1 is "6":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 1000, potion of night vision, 1, "&fNight Vision", 2)
shop(player, 20, 2000, potion of long night vision, 1, "&fNight Vision (Longer)", 2)
shop(player, 21, 1000, potion of speed, 1, "&fSpeed", 2)
shop(player, 22, 4000, potion of strong speed, 1, "&fSpeed (Stronger)", 2)
shop(player, 23, 1000, potion of jumping, 1, "&fJump Boost", 2)
shop(player, 24, 4000, potion of strong jumping, 1, "&fJump Boost (Stronger)", 2)
shop(player, 25, 1000, potion of fire resistance, 1, "&fFire Proof Potion", 2)
shop(player, 28, 1000, potion of slow falling, 1, "&fSlow Falling", 2)
shop(player, 29, 2000, potion of long slow falling, 1, "&fSlow Falling (Longer)", 2)

if arg 1 is "7":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 100000, netherrack, 64, "&fNetherrack", 2)
shop(player, 20, 100000, warped Hyphae, 16, "&fWarped Hyphae", 2)
shop(player, 21, 100000, crimson Hyphae, 64, "&fCrimson Hyphae", 2)
shop(player, 22, 100000, nether brick, 64, "&fNether Brick", 2)
shop(player, 23, 100000, cracked nether bricks, 64, "&fCracked Nether Bricks", 2)
shop(player, 24, 100000, chiseled nether bricks, 64, "&fChiseled Nether Bricks", 2)
shop(player, 25, 100000, nether brick stairs, 64, "&fNether Brick Stairs", 2)
shop(player, 28, 100000, magma block, 64, "&fMagma Block", 2)
shop(player, 29, 100000, nether wart block, 64, "&fNether Wart Block", 2)
shop(player, 30, 100000, warped wart block, 64, "&fWarped Wart Block", 2)
shop(player, 31, 100000, Gilded Blackstone, 64, "&fGuilded Blackstone", 2)
shop(player, 32, 100000, blackstone stairs, 64, "&fBlackstone Stairs", 2)
shop(player, 33, 100000, blackstone slab, 64, "&fBlackstone Slabs", 2)
shop(player, 34, 100000, blackstone, 64, "&fBlackstone", 2)
shop(player, 37, 100000, basalt, 64, "&fBasalt", 2)
shop(player, 38, 100000, polished basalt, 64, "&fPolished Basalt", 2)

#shop(player, format slot, cost, item, how much you get, "name of item") when you put the name of the item you need quotes

if arg 1 is "uuw":
create a gui with virtual chest inventory with 3 rows named "Select Your Chat Settings":


shop(player, 1, 10, dirt, 64, "&fDirt")

function shop(p: player, i: integer, c: integer, it: itemtype, a: integer, m: string, sp: number = 1):
format gui slot {_i} with {_a} named "%{_m}%" with lore "&7Cost: &6$%{_c}%" and "&7Amount: &6%{_a}%":
if {_p}'s balance is greater than or equal to {_c}:
remove {_c} from {_p}'s balance
give {_a} of {_it} named "%{_m}%" to {_p}
send "&aPurchase Completed." to {_p}
else:
send "&cPurchase Failed, Insufficient Funds" to {_p}

if {_sp} is 1:

format gui slot 1 of {_p} with honey block named "&6&lGenerators" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 0"
format gui slot 2 of {_p} with grass block named "&a&lBlocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 3 of {_p} with water bucket named "&b&lMisc" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 2"
format gui slot 4 of {_p} with netherite pickaxe named "&5&lTools" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 3"
format gui slot 5 of {_p} with stick of infinity named "&e&lSell Wands" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 4"
format gui slot 6 of {_p} with arrow named "&7Next Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
if {_sp} is 2:
format gui slot 1 of {_p} with arrow named "&7Previous Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 2 of {_p} with netherite hoe named "&2&lFarming" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
format gui slot 3 of {_p} with potion of night vision named "&e&lPotions" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 6"
format gui slot 4 of {_p} with netherrack named "&c&lNether Blocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 7"
format your code please
 
I used to have a skript for a shop with TusKe but it has been broken in the new update, I have been recommended skript-GUI and wanted to know whether I could do the same thing with skript-GUI

My skript (A snippet):

if arg 1 is "6":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 1000, potion of night vision, 1, "&fNight Vision", 2)
shop(player, 20, 2000, potion of long night vision, 1, "&fNight Vision (Longer)", 2)
shop(player, 21, 1000, potion of speed, 1, "&fSpeed", 2)
shop(player, 22, 4000, potion of strong speed, 1, "&fSpeed (Stronger)", 2)
shop(player, 23, 1000, potion of jumping, 1, "&fJump Boost", 2)
shop(player, 24, 4000, potion of strong jumping, 1, "&fJump Boost (Stronger)", 2)
shop(player, 25, 1000, potion of fire resistance, 1, "&fFire Proof Potion", 2)
shop(player, 28, 1000, potion of slow falling, 1, "&fSlow Falling", 2)
shop(player, 29, 2000, potion of long slow falling, 1, "&fSlow Falling (Longer)", 2)

if arg 1 is "7":
open virtual chest inventory with 6 rows named "Shop: &e&lPotions" to player
shop(player, 19, 100000, netherrack, 64, "&fNetherrack", 2)
shop(player, 20, 100000, warped Hyphae, 16, "&fWarped Hyphae", 2)
shop(player, 21, 100000, crimson Hyphae, 64, "&fCrimson Hyphae", 2)
shop(player, 22, 100000, nether brick, 64, "&fNether Brick", 2)
shop(player, 23, 100000, cracked nether bricks, 64, "&fCracked Nether Bricks", 2)
shop(player, 24, 100000, chiseled nether bricks, 64, "&fChiseled Nether Bricks", 2)
shop(player, 25, 100000, nether brick stairs, 64, "&fNether Brick Stairs", 2)
shop(player, 28, 100000, magma block, 64, "&fMagma Block", 2)
shop(player, 29, 100000, nether wart block, 64, "&fNether Wart Block", 2)
shop(player, 30, 100000, warped wart block, 64, "&fWarped Wart Block", 2)
shop(player, 31, 100000, Gilded Blackstone, 64, "&fGuilded Blackstone", 2)
shop(player, 32, 100000, blackstone stairs, 64, "&fBlackstone Stairs", 2)
shop(player, 33, 100000, blackstone slab, 64, "&fBlackstone Slabs", 2)
shop(player, 34, 100000, blackstone, 64, "&fBlackstone", 2)
shop(player, 37, 100000, basalt, 64, "&fBasalt", 2)
shop(player, 38, 100000, polished basalt, 64, "&fPolished Basalt", 2)

#shop(player, format slot, cost, item, how much you get, "name of item") when you put the name of the item you need quotes

if arg 1 is "uuw":
create a gui with virtual chest inventory with 3 rows named "Select Your Chat Settings":


shop(player, 1, 10, dirt, 64, "&fDirt")

function shop(p: player, i: integer, c: integer, it: itemtype, a: integer, m: string, sp: number = 1):
format gui slot {_i} with {_a} named "%{_m}%" with lore "&7Cost: &6$%{_c}%" and "&7Amount: &6%{_a}%":
if {_p}'s balance is greater than or equal to {_c}:
remove {_c} from {_p}'s balance
give {_a} of {_it} named "%{_m}%" to {_p}
send "&aPurchase Completed." to {_p}
else:
send "&cPurchase Failed, Insufficient Funds" to {_p}

if {_sp} is 1:

format gui slot 1 of {_p} with honey block named "&6&lGenerators" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 0"
format gui slot 2 of {_p} with grass block named "&a&lBlocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 3 of {_p} with water bucket named "&b&lMisc" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 2"
format gui slot 4 of {_p} with netherite pickaxe named "&5&lTools" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 3"
format gui slot 5 of {_p} with stick of infinity named "&e&lSell Wands" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 4"
format gui slot 6 of {_p} with arrow named "&7Next Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
if {_sp} is 2:
format gui slot 1 of {_p} with arrow named "&7Previous Page" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 1"
format gui slot 2 of {_p} with netherite hoe named "&2&lFarming" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 5"
format gui slot 3 of {_p} with potion of night vision named "&e&lPotions" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 6"
format gui slot 4 of {_p} with netherrack named "&c&lNether Blocks" with lore "&7Left-Click to navigate" to run:
execute player command "/shop 7"
I'm not sure what you';re trying to do here seeing as you use skript-gui, vanilla and tuske guis all together, which is not what you should do
 
Status
Not open for further replies.