#
# Custom cases below
#
function custom_case(player:player,case:string,olditem:item) :: item:
set {_item} to stone
set {_cmd} to "$cancel$"
if {_case} is "Example":
set {_item} to piston
set {_cmd} to "/say push!"
add "{runCmd:""<!CMD!>%{_cmd}%<!CMD!>""}" to nbt of {_item}
return {_item}
#
#
# I don't recommend touching the thingies below
#
#
#
#
command /sm [<string>] [<string>] [<string>]:
permission: admin
aliases: silkymenu, silky, menu
trigger:
if arg 1 is "edit":
if arg 2 is set:
send_menus(player,"Editing menu &b%arg 2%")
menu_edit(player,arg 2)
stop
send_error(player,"Incorrect usage! &7/sm edit <menu id>")
stop
if arg 1 is "open":
if arg 2 is set:
send_menus(player,"Opening menu &b%arg 2%")
menu_open(player,arg 2)
stop
send_error(player,"Incorrect usage! &7/sm open <menu id>")
stop
if arg 1 is "rows":
if arg 2 is set:
if arg 3 is set:
set {_int} to arg 3 parsed as integer
if {_int} is 1 or 2 or 3 or 4 or 5 or 6:
set {menu.rows::%arg 2%} to {_int}
send_menus(player,"Menu rows updated!")
stop
send_error(player,"Not a valid number! Use 1 to 6!")
stop
send_error(player,"Incorrect usage! &7/sm rows <menu id> <rows>")
stop
send_error(player,"Incorrect usage! &7/sm rows <menu id> <rows>")
stop
if arg 1 is "name":
if arg 2 is set:
if arg 3 is set:
set {_name} to arg 3
set {menu.name::%arg 2%} to {_name}
send_menus(player,"Menu display name set to %{_name}%!")
stop
send_error(player,"Incorrect usage! &7/sm name <menu id> <display name>")
stop
send_error(player,"Incorrect usage! &7/sm name <menu id> <display name>")
stop
if arg 1 is set:
send_error(player,"Unknown sub-command, Use /sm for the list!")
stop
message "&7 /sm edit <menu id>"
message "&7 /sm open <menu id> (Opens a menu, for quick testing)"
message "&7 /openmenu <player> <menu id> (Opens a menu, use this everything!)"
message "&7 /sm rows <menu id> <rows> (Change the number of rows of a menu)"
message "&7 /sm name <menu id> <display name> (Change the display name of a menu)"
message "&7 /setcmd (Set the click command for an item)"
message "&7 /setcustomcase (Set the custom case ID for an item)"
command /openmenu <player> <string>:
permission: admin
trigger:
menu_open(arg 1,arg 2)
on inventory close:
if {menuEdit::%player%} is set:
delete {menuEdit::%player%}
send_menus(player,"Menu edit succesful!")
if {menuOpen::%player%} is set:
delete {menuOpen::%player%}
on every tick:
loop all players:
if {menuEdit::%loop-player%} is set:
if name of loop-player's current inventory is "[Editing]":
set {_m} to {menuEdit::%loop-player%}
loop 9*{menu.rows::%{_m}%} times:
set {_n} to -1 + loop-number
set {_item} to slot {_n} of loop-player's current inventory
if {menuData.%{_m}%::%{_n}%} is not {_item}:
set {menuData.%{_m}%::%{_n}%} to {_item}
play sound "block.note_block.chime" at pitch loop-number / (9*3) to loop-player
on inventory click:
if {menuOpen::%player%} is set:
set {_m} to {menuOpen::%player%}
cancel event
set {_cmd} to nbt of clicked slot
set {_run::*} to {_cmd} split at "<!CMD!>"
set {_run} to {_run::2}
if {_cmd} is set:
if click type is left mouse:
set {_run} to replace({_run},"[player]","%player%")
set {_run} to replace({_run},"//","/$cancel$")
set {_c::*} to {_run} split at "/"
loop {_c::*}:
if {_c::%loop-index%} does not contain "$cancel$":
command {_c::%loop-index%}
if click type is right mouse:
set {_run} to replace({_run},"[player]","%player%")
set {_run} to replace({_run},"//","\")
set {_run} to replace({_run},"/","/$cancel$")
set {_run} to replace({_run},"\","/")
set {_c::*} to {_run} split at "/"
loop {_c::*}:
if {_c::%loop-index%} does not contain "$cancel$":
command {_c::%loop-index%}
function menu_edit(p:player,m:string):
set {menuEdit::%{_p}%} to {_m}
menu_define({_m})
open_chest({_p} , "[Editing]", {menu.rows::%{_m}%})
loop 9*{menu.rows::%{_m}%} times:
set {_n} to loop-number - 1
set slot {_n} of {_p}'s current inventory to {menuData.%{_m}%::%{_n}%}
function menu_open(p:player,m:string):
menu_define({_m})
if {menuOpen::%{_p}%} is not set:
open_chest({_p} , {menu.name::%{_m}%}, {menu.rows::%{_m}%})
set {menuOpen::%{_p}%} to {_m}
loop 9*{menu.rows::%{_m}%} times:
set {_n} to loop-number - 1
set {_i} to {menuData.%{_m}%::%{_n}%}
if nbt of {_i} contains "<!CASE!>":
set {_c::*} to nbt of {_i} split at "<!CASE!>"
set {_i} to custom_case({_p},{_c::2},{_i})
set slot {_n} of {_p}'s current inventory to {_i}
function menu_define(m:string):
if {menu.name::%{_m}%} is not set:
set {menu.rows::%{_m}%} to 3
set {menu.name::%{_m}%} to {_m}
command /setcmd <string>:
permission: admin
trigger:
add "{runCmd:""<!CMD!>%arg 1%<!CMD!>""}" to nbt of player's held item
message "&eTip: use / for commands, use // for rightclick commands, use [player] for the player that clicked"
command /setcustomcase <string>:
permission: admin
trigger:
add "{customCase:""<!CASE!>%arg 1%<!CASE!>""}" to nbt of player's held item
set name of player's held item to "&3[%arg 1%]"
#function renames
function open_chest(p:player,n:string,r:number):
open chest with {_r} rows named {_n} to {_p}
function send_menus(p:player,s:string):
message "&a[SilkyMenus] &8| &f%{_s}%" to {_p}
function replace(inStr:string,replaceStr:string,endStr:string) :: string:
replace all {_replaceStr} with {_endStr} in {_inStr}
return {_inStr}
function split(inStr:string,splitStr:string) :: objects:
set {_l::*} to {_inStr} split at {_splitStr}
return {_l::*}
To install Silkymenus you need the Skript Plugin and the SkBee Plugin which is an addon that's required for it to function
Once it's installed go to /plugins/skript/scripts/
In there create a new file called SilkyMenus.sk
Open up the file in a text editor and copy paste the code in the Source Code section into it and save
After go in game and type /sk reload SilkyMenu and use /silky to check if it's working, If a help message appears you are all good!
Silkymenus can be used to create menus using skript that area easy to create and are just as powerful as regular skript menus without having as many Lines
To create your first menu do /sm edit <menuName>
This will open the menu editor for your menu and also creates it
You can drag and drop items into it and they will show up when you open the menu
You can use /sm open <menuName> to open it for yourself or /openmenu <player> <menuName> to open the menu to any player
You can use this command to open the menu when someone for example rightclicks in an iron block:
on rightclick on iron block:
command "openmenu %player% SuperAnvil"
You can also add click events by attaching a command to the item by typing /setcmd /say hello
Then it will run that command and it should show [Server] hello in chat
(*Note that all commands are run from console)
If you want it to run a piece of skript code you can do something like the follow
/setcmd /push [player]
and in your script:
command /push <player>:
permission: system
trigger:
push arg 1 up at speed 1
If you want the item displayed to change based on your own code you can use Custom Cases for that
You can use /setcustomcase <caseName> to set a item to a custom case icon
Whenever a menu is opened with a custom case item it will call the function custom_case(player,case,olditem) which can be located at the top of the Silkymenus skript
Custom cases are real easy to setup, you can simply do something like:
function custom_case(player:player,case:string,olditem:item) :: item:
set {_item} to stone
set {_cmd} to "$cancel$"
+ if {_case} is "Playerskull":
+ set {_item} to red dye head named "&cYou have %{_player}'s health%"
+ set {_cmd} to "/say hello %{_player}%!"
add "{runCmd:""<!CMD!>%{_cmd}%<!CMD!>""}" to nbt of {_item}
return {_item}
If you have any questions feel free to DM me on discord (Flowwave#0269)