Jump to content

How to use Skript


_iZ_
 Share

Recommended Posts

M I N E H U T  C O M M U N I T Y  F A Q

HOW TO USE SKRIPT

REQUIREMENTS: Skript
DIFFICULTY: Medium

 

Introduction to Skript

Skript is one of the many plugins available to users on Minehut. It is used by many servers to create anything from custom commands to fully customizable mini-games, and it uses a custom syntax that’s nearly as easy as plain English. In this tutorial, you will learn about the basic utilities Skript offers and how to put them to use.

 

Events

Events are things that occur when something happens in Minecraft. This can be anything from joining the game, breaking a block, or even moving your mouse around. Each event has different expressions that can be used, which we will get to soon.

Examples:

on join
on quit
on any movement
on mine

 

Effects

Effects, not to be confused with potion effects, are things that can be triggered using Skript’s syntax. There are many different effects that can be used to customize your server, and a full list will be at the end of this post.

Examples:

kill %player(s)/entit(y|ies)%
send %string% to %player(s)%

 

Expressions

Expressions are different placeholders that you can call within the different Skript syntax types to make your script function as intended. Many expressions can also be set to different values, such as the join and quit message and more. Some events have different expressions, so people often run into errors when it comes to using the wrong expressions.

Examples: 

%player%
%item%
%message%

 

Conditions

Conditions are one of the most useful syntax types in Skript. It makes sure that events can only trigger effects if certain expressions or variables have a value.

Examples:

%player% has permission
%player%'s game mode

 

Variables

Variables are what Skript uses to store data. The two main types of variables in Skript are static variables and list variables. Static variables can only have one value while list variables can have multiple values. There are also variables called local variables, which are only saved for each specific event. (TIP: Use a player’s UUID when storing data for them, using their name will result in lost data when/if they change it.)

Static Variables: {balance.%uuid of player%}
List Variables: {joinList::*}, {balance::%uuid of player%}
Local Variables: {_l}, {_list::*}

 

 

Commands

Commands are one of the most useful things in Skript. They can be used to trigger different effects to do basically anything on a Minecraft server. When defining commands, you can include different arguments so that the commands can do different things depending on these arguments. Arguments can be booleans, text, players, and so on. 

Required Arguments: <text> <player> <integer>
Optional Arguments: [<text>] [<player>] [<integer>]

 

 

Functions

Functions are similar to commands in the sense that they trigger effects, but they cannot be triggered unless told to do so within Skript. A good use for this is a making chest GUI that you only want to be opened when a player joins the server. When recalling arguments in a function, they are stored in local variables.

Example:

function killPlayer(p: player):
	kill {_p}
	broadcast "&b%{_p}% &7died mysteriously"

 

Putting these all to use

Now that we know what all of these different syntax types are, we can put them all to use!

# Using a hashtag tells Skript not to parse anything after it on that same line! (This is useful for adding notes)

# Defining a command
command /minehut <text>: # Using [<text>] would tell Skript that the argument is not required. 
	permission: server.minehut # This can be anything or nothing at all
	permission message: &cNo permissions. # You can customize this message for every command
	usage: Usage: /minehut <platform> # This tells the user the correct usage for the command when they mess it up.
	aliases: mh, mhut # Executing these commands will do the same thing as the original
	description: Minehut Command # Pretty self-explanitory, a description of the command.
	executable by: players # The console cannot do this command now.
	trigger: # All commands must have this line!
		if arg-1 is "forums": # Condition - Seeing what the first argument is
			send "&bhttps://forums.minehut.com/" to player # This is the effect
		else if arg-1 is "discord":
			send "&bhttps://discord.gg/minehut" to player
		else: # Else statements mean that none of the other conditions have been met
			send "&cUnknown argument" to player


# Defining a function

function alert(p: player, m: text): # {_p} will be the player, {_m} will be the text string, in this case the message

	send "&bAlert:&r %{_m}%" to {_p} # You cannot use %player%, you will get an error


# Detecting events

on damage: # This is when a player gets hurt

	if victim is a player: # Condition to make sure the entity being damaged is a player

		# Recalling our function from above

		alert(victim, "You got hurt!") # You must use attacker or victim in a damage or death event

 


 

Additional Information

 

Skript has a TON of addons that can be added to your server. These provide additional syntax to add more possibilities to your scripts. To find addons, just search for “Skript” on the plugins tab of your panel and everything should be there! A list and explanation of common Skript addons can be found here: https://forums.minehut.com/topic/26809-what-is-the-purpose-of-common-skript-addons/

 

A full list of Skript syntax can be found here: https://skripthub.net/docs/

You can also test check your scripts for errors here: https://parser.skunity.com

If you need more help with Skript, head over to the Skript discussion on the forums, or join our Discord!

 

Compiled by the Minehut Staff Team

Edited by _iz_
Added better descriptions
  • Like 3

» IGN: _iZ_ «

» Joined: 12/18/2016 «

» VIP: 1/13/2018 «

» Helper: 1/29/2021 «

» [<3]: 5/8/2021 «

» Skript dev «

» Discord: iZz#0420 «

I have diabetes

React to this if I was helpful, found this interesting, or you're just nice 🙂

Link to comment
Share on other sites

Excellent job! This is going to be a super useful CFAQ for users who want to get into Skript! 🙂

  • Thanks 1

𝚄𝚗𝚝𝚛𝚎𝚊𝚝𝚎𝚍

𝔻𝕚𝕤𝕔𝕠𝕣𝕕: @𝕌𝕟𝕥𝕣𝕖𝕒𝕥𝕖𝕕#𝟘𝟘𝟘𝟙

News & Updates  Rules • Helper Application

Reports • Appeals

𝚂𝚝𝚊𝚏𝚏 𝚘𝚗 𝙼𝚒𝚗𝚎𝚑𝚞𝚝 𝚜𝚒𝚗𝚌𝚎 𝙹𝚞𝚗𝚎 𝟹𝟶𝚝𝚑, 𝟸𝟶𝟸𝟶

Link to comment
Share on other sites

  • 11 months later...
  • 4 months later...
  • 4 weeks later...
Guest Hans

i need a command that kills all items on the floor.

i tried multiple things and it's not working… need help!

command /fps:

  trigger:

    kill ?????????????

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...