Beginner: events and commands
Every script is built from triggers: a header line ending in a colon, and indented lines that run when it fires.
Your first event
on join:
send "&aWelcome, %player%!" to playeron join fires when any player joins. Inside it, player is the player who joined. &a is a Minecraft colour code for green, and %player% inserts the player's name.
Your first command
command /discord:
trigger:
send "&bJoin our community: discord.gg/yourserver"The trigger: section holds the code. Save, run /sk reload discord, and type /discord.
Intermediate: variables, conditions and loops
Variables and conditions
on death of player:
attacker is a player
add 25 to {coins::%attacker's uuid%}
send "&e+25 coins" to attacker{coins::...} is a saved list variable keyed by UUID. The line attacker is a player is a condition; if it is false, the rest of the trigger is skipped.
If, else and loops
every 1 hour:
loop all players:
if loop-player has permission "rank.vip":
give loop-player 3 diamond
else:
give loop-player 1 diamondloop all players repeats the block once per online player, with loop-player as the current one.
Advanced: functions, options and structure
Functions
function reward(p: player, amount: number):
add {_amount} to {coins::%{_p}'s uuid%}
send "&a+%{_amount}% coins" to {_p}
command /claim:
cooldown: 1 day
trigger:
reward(player, 50)Functions take typed parameters, which become local variables inside the function. Any script can call them after they load.
Options
options:
prefix: &8[&6Shop&8]
price: 50
command /price:
trigger:
send "{@prefix} &7Each diamond sells for &f{@price} coins."Options are replaced when the script is parsed, so one change updates every use.
Keep scripts organised
Use one file per feature, put shared functions in their own file, and comment anything clever with # so future you understands it.