Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,9 @@
[submodule "vendor/grammars/shaders-tmLanguage"]
path = vendor/grammars/shaders-tmLanguage
url = https://github.com/tgjones/shaders-tmLanguage
[submodule "vendor/grammars/skript-grammar"]
path = vendor/grammars/skript-grammar
url = https://github.com/SkriptLang/skript-grammar.git
[submodule "vendor/grammars/slang-vscode-extension"]
path = vendor/grammars/slang-vscode-extension
url = https://github.com/shader-slang/slang-vscode-extension.git
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,8 @@ vendor/grammars/selinux-policy-languages:
vendor/grammars/shaders-tmLanguage:
- source.hlsl
- source.shaderlab
vendor/grammars/skript-grammar:
- source.skript
vendor/grammars/slang-vscode-extension:
- source.slang
vendor/grammars/slint-tmLanguage:
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7182,6 +7182,14 @@ Singularity:
- Singularity
ace_mode: text
language_id: 987024632
Skript:
type: programming
color: "#FF9800"
extensions:
- ".sk"
tm_scope: source.skript
ace_mode: text
language_id: 754733364
Slang:
type: programming
color: "#1fbec9"
Expand Down
62 changes: 62 additions & 0 deletions samples/Skript/chest menus.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

#
# An example of opening a chest inventory with an item.
# Players will be able to take the item out.
#

command /simplechest:
permission: skript.example.chest
trigger:
set {_chest} to a new chest inventory named "Simple Chest"
set slot 0 of {_chest} to apple # Slots are numbered 0, 1, 2...
open {_chest} to player

#
# An example of listening for click events in a chest inventory.
# This can be used to create fancy button-style interfaces for users.
#

command /chestmenu:
permission: skript.example.menu
trigger:
set {_menu} to a new chest inventory with 1 row named "Simple Menu"
set slot 4 of {_menu} to stone named "Button" # Slots are numbered 0, 1, 2...
open {_menu} to player

on inventory click: # Listen for players clicking in an inventory.
name of event-inventory is "Simple Menu" # Make sure it's our menu.
cancel event
if index of event-slot is 4: # The button slot.
send "You clicked the button."
else:
send "You didn't click the button."

#
# An example of making and filling a fancy inventory with a function.
# This demonstrates another way you can use chest inventories, and a safe way of listening to specific ones.
#

aliases:
menu items = TNT, lava bucket, string, coal, oak planks

function make_menu(name: text, rows: number) :: inventory:
set {_gui} to a new chest inventory with {_rows} rows with name {_name}
loop {_rows} * 9 times: # Fill the inventory with random items.
set slot loop-number - 1 of {_gui} to random item out of menu items
return {_gui}

command /fancymenu:
permission: skript.example.menu
trigger:
set {_menu} to make_menu("hello", 4)
add {_menu} to {my inventories::*} # Prepare to listen to this inventory.
open {_menu} to player

on inventory click: # Listen for players clicking in any inventory.
if {my inventories::*} contains event-inventory: # Make sure it's our menu.
cancel event
send "You clicked slot %index of event-slot%!"

on inventory close: # No longer need to listen to this inventory.
{my inventories::*} contains event-inventory
remove event-inventory from {my inventories::*}
38 changes: 38 additions & 0 deletions samples/Skript/text formatting.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# This example is for colours and formatting in Skript.
# Skript allows the old-style Minecraft codes using `&`, like &0 for black and &l for bold.
# You can also use <> for colours and formats, like `<red>` for red and `<bold>` for bold
#
# In Minecraft 1.16, support was added for 6-digit hexadecimal colors to specify custom colors other than the 16 default color codes.
# The tag for these colors looks like this: <#hex code> e.g. `<#123456>`
#

command /color:
permission: skript.example.color
trigger:
send "&6This message is golden."
send "<light red><bold>This message is light red and bold."
send "<#FF0000>This message is red."

#
# Other formatting options are also available.
# You can create clickable text, which opens a website or execute a command, or even show a tool tip when hovering over the text.
#

command /forum:
permission: skript.example.link
trigger:
send "To visit the website, [<link:https://google.com><tooltip:click here>click here<reset>]"

command /copy <text>:
permission: skript.example.copy
trigger:
# Insertion: when the player shift clicks on the message, it will add the text to their text box.
# To use variables and other expressions with these tags, you have to send the text as `formatted`.
send formatted "<insertion:%arg-1%>%arg-1%"

command /suggest:
permission: skript.example.suggest
trigger:
send "<cmd:/say hi>Click here to run the command /say hi"
send "<sgt:/say hi>Click here to suggest the command /say hi"
53 changes: 53 additions & 0 deletions samples/Skript/variables.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

#
# This example stores a time-stamp in the global `{timer}` variable.
# This variable is accessible everywhere, and will be saved when the server stops.
#
# The `{_difference}` variable is local and is different for each use of the command.
#

command /timer:
permission: skript.example.timer
trigger:
if {timer} is set:
send "This command was last run %time since {timer}% ago."
else:
send "This command has never been run."
set {timer} to now

#
# This example stores two items in a global list variable `{items::%uuid of player%::*}`.
# These items can then be recalled with the example `/outfit` command, which then clears the list.
#

on join:
set {items::%uuid of player%::helmet} to player's helmet
set {items::%uuid of player%::boots} to player's boots
send "Stored your helmet and boots."

command /outfit:
executable by: players
permission: skript.example.outfit
trigger:
give player {items::%uuid of player%::*} # gives the contents of the list
clear {items::%uuid of player%::*} # clears this list
send "Gave you the helmet and boots you joined with."

#
# An example of adding, looping and removing the contents of a list variable.
# This list variable is local, and so will not be kept between uses of the command.
#

command /shoppinglist:
permission: skript.example.list
trigger:
add "bacon" to {_shopping list::*}
add "eggs" to {_shopping list::*}
add "oats" and "sugar" to {_shopping list::*}
send "You have %size of {_shopping list::*}% things in your shopping list:"
loop {_shopping list::*}:
send "%loop-index%. %loop-value%"
send "You bought some %{_shopping list::1}%!"
remove "bacon" from {_shopping list::*}
send "Removing bacon from your list."
send "You now have %size of {_shopping list::*}% things in your shopping list."
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Sieve:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)
- **Simple File Verification:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)
- **Singularity:** [onnovalkering/vscode-singularity](https://github.com/onnovalkering/vscode-singularity)
- **Skript:** [SkriptLang/skript-grammar](https://github.com/SkriptLang/skript-grammar)
- **Slang:** [shader-slang/slang-vscode-extension](https://github.com/shader-slang/slang-vscode-extension)
- **Slash:** [slash-lang/Slash.tmbundle](https://github.com/slash-lang/Slash.tmbundle)
- **Slice:** [zeroc-ice/vscode-slice](https://github.com/zeroc-ice/vscode-slice)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/skript-grammar
Submodule skript-grammar added at 2cef6b
31 changes: 31 additions & 0 deletions vendor/licenses/git_submodule/skript-grammar.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: skript-grammar
version: 2cef6b9a4f8200e34134aed0da0ab56854b4582c
type: git_submodule
homepage: https://github.com/SkriptLang/skript-grammar.git
license: mit
licenses:
- sources: LICENSE
text: |
MIT License

Copyright (c) 2022 SkriptLang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []