Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Skript language #6559

Closed
wants to merge 1 commit into from
Closed
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 @@ -1010,6 +1010,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/smali-sublime"]
path = vendor/grammars/smali-sublime
url = https://github.com/ShaneWilton/sublime-smali
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,8 @@ vendor/grammars/selinux-policy-languages:
vendor/grammars/shaders-tmLanguage:
- source.hlsl
- source.shaderlab
vendor/grammars/skript-grammar:
- source.skript
vendor/grammars/smali-sublime:
- source.smali
vendor/grammars/smalltalk-tmbundle:
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8239,6 +8239,14 @@ robots.txt:
ace_mode: text
tm_scope: text.robots-txt
language_id: 674736065
Skript:
type: programming
ace_mode: text
color: ff9800
extensions:
- ".sk"
tm_scope: none
language_id: 754733364
sed:
type: programming
color: "#64b970"
Expand Down
21 changes: 21 additions & 0 deletions samples/Skript/chatmute.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#This skript is made by XI_DEMO_IX!
#If you have any issuses please contact X̸I̶_̵D̷E̷M̷O̷_̸I̸X̴#8207 on discord!

command /mutechat:
permission: mute.chat
permission message: "&cYou do not have permission!"
trigger:
if {chatMuted} is true:
set {chatMuted} to false
broadcast "&b[&cServerName&b]&r &6Chat has been unmuted by %player%!"
else:
set {chatMuted} to true
broadcast "&b[&cServerName&b]&r &6Chat has been muted by %player%!"

on chat:
if {chatMuted} is true:
player doesn't have permission "mute.talk":
send "&b[&cServerName&b]&r &6Chat is currently muted!"
cancel event
else if player has permission "mute.talk":
uncancel event
62 changes: 62 additions & 0 deletions samples/Skript/fish.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 makeMenu(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 makeMenu("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::*}
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: []