• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

Difference between revisions of "Skript"

From Minecraft插件百科
Jump to: navigation, search
(介绍)
(介绍)
Line 27: Line 27:
 
on break of glass:
 
on break of glass:
 
     drop glass
 
     drop glass
 
 
译者注:
 
译者注:
 
当打破玻璃的时候:
 
当打破玻璃的时候:

Revision as of 19:42, 14 August 2016

Icon-info.png
本条目已有一定量的内容,但仍需完善

欢迎参与本条目的完善工作

你可以从以下几个方面入手

  • 参阅格式化手册,并对该页面进行相应格式排版工作;
  • 日常检查是否内容有更新版本并更新该页面;
  • 修复该页面中已出现/潜在的问题

原文地址

http://njol.ch/projects/skript/

介绍

Skript是一个流行的服务器插件。

它允许服务器管理员在不写任何Java语言的情况下简单的管理Minecraft。

这是用触发器、条件和效果三个部分做到的。

当触发器触发,所有条件均满足,效果就会被触发。

Skript的基础想法是——自定义 —— 每个服务器都能在没有自定义插件的情况下表现不同。

这比你自己钻研插件和找人写插件快的多。

同时你也不需要那么多小插件了,这一个插件就够了。

你可以在<ref=原问给的是DropBox地址无法访问,这里是作者的GitHub地址>[这里 https://github.com/bensku/Skript/releases]</ref>下载最新版本的Skript

已经提及了,Skript的触发器提供了这个插件的基本功能。

触发器很普通,并由一些条件和效果组成,就像这个简单的掉落修复脚本:

on break of glass:

   drop glass

译者注: 当打破玻璃的时候:

   掉落玻璃

Skript也能用来做自定义命令。

These are basically triggers which are executed once a specific command has been typed. The following defines a simple command which allows to get the ID of an item by holding it in the hand and typing /id: command /id: description: Find the ID of the item you're holding trigger: message "You're holding a %type of tool% whose ID is %id of tool%." Skript also comes with an option to directly execute effects from the chat, by interpreting chat messages that start with a configurable character (‘!’ by default) as effects. This essentially allows to use effects as ‘commands’, e.g. !repair tool will do what it implies. Because these commands are very powerful (and can thus be abused) only players with the permission skript.effectcommands can use them if they are enabled at all (this does not default to OPs!).

Skript's syntax is not limited to such simple examples as above, but has several other features like loops, conditionals, etc. The following is an example of a more advanced trigger which refuels furnaces using fuel from surrounding chests: on burn of fuel: fuel slot of the block is empty loop blocks in radius 1: loop-block is chest loop items of type fuel: loop-block contains loop-item remove loop-item from loop-block set fuel of the event-block to loop-item stop trigger More information on this plugin can be found on Skript's BukkitDev page, and please also read the tutorial and documentation linked below. Tutorial If you're new to Skript you should read the basic tutorial. It explains how to write a new script with all required steps. There is also another tutorial at BukkitDev. Documentation If you are already using this plugin, you should take a look at the documentation. It is helpful if you want to know whether a certain event exists or what arguments a specific condition takes. And of course it's also useful if you just want to find out what can be done with this plugin. The documentation also contains a lot of examples to demonstrate the usage of the different conditions, effects, expressions, etc. Links BukkitDev plugin page Forum

辅导

Getting Started Before you can start writing scripts you should download and install Skript: Download the latest Skript.jar Put the jar into your server's ‘plugin’ directory start & stop the server once to generate the config files and some example scripts Writing a trigger Before you even open an editor I recommend that you already know what kind of trigger you want to write, but you can also simply start writing. In this tutorial I will explain how to write a trigger similar to the one in plant with hoe.sk which is included in the download: a trigger which plants seeds when one right-clicks soil with a hoe. To start, open a text editor, e.g. Notepad. Now think about when you want your trigger to activate. In this example we need a right click, so we write that on the first line: on right click: If you can't think of an event or need inspiration you can find a list of all events here.

But we don't want to activate the trigger every time someone right-clicks, but only if a player right-clicks on farmland holding a hoe, thus we should change the event: on right click on soil holding a hoe: We could also leave the event as-is and add two conditions instead: on right click:

   block is soil
   player is holding a hoe

It is up to you which version you like more, I will continue using the first one in this tutorial.

Now we should check whether the player actually has seeds he could plant: on right click on soil holding a hoe:

   player has seeds

Please note that the next line after the event is indented. This makes the line belong to the trigger we're writing and also makes scripts much easier to read. If you do not correctly indent conditions and effects you will get errors when the script loads as they do not belong to any trigger. After that we should be able to plant the seeds as we made sure that the player did everything correctly, right? on right click on soil holding a hoe:

   player has seeds
   set block above the clicked block to crops

This is not exactly true as there might be a block where we want to plant the seeds: [_] <- some block [_] <- clicked soil block If we simply set that block to crops we might override a block. This could be used by griefers to break into other people's houses or even destroy bedrock. Such problems are not always obvious but can cause triggers to misbehave. You can eliminate many problems by testing the triggers on a test server before using them on your main server. This particular problem is solved by testing whether the block above the soil is empty before setting it to crops: on right click on soil holding a hoe:

   player has seeds
   block above the clicked block is air
   set block above the clicked block to crops

Now don't forget to remove the seeds from the player if you don't want your players to plant seeds for free: on right click on soil holding a hoe:

   player has seeds
   block above the clicked block is air
   set block above the clicked block to crops
   remove seeds from player

The last thing remaining is to save the trigger in the plugins/Skript/scripts/ directory. You can choose any name you want, but it should not start with a hyphen, as files starting with a hyphen are not loaded, and the file extension has to be .sk. You could e.g. save this tutorial's trigger as simple plant with hoe.sk.

Now start your server (which is preferably a test server, i.e. not your main server), check whether any errors appear in the console and fix them if there are any. Then log into the server and test the script to find out whether everything works as intended. When you're done testing copy the script to your main server to let your players use it.

You can also use the command ‘/skript reload’ to make Skript reload all scripts or a specific script, which is useful if you don't want to restart the server after changing a script. All errors that occur during the reload will be sent to the player that uses the command, or logged to the console if the console used the command.

WIKI帮助文档

Njol.ch » Projects » Skript Yggdrasil Markup » Skript: DocumentationEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Writing a trigger for Skript is not much more than describing what should be done when some conditions are met. Because many things you would want to do are linked to events, such as placing a block or pulling a lever, every trigger has to define when it should be called. This is called the event of the trigger. Whenever this event occurs, e.g. when a player places a block, the trigger's conditions are checked one by one. If all conditions are met, the effects of the trigger are executed. The following is a simple example of a trigger with an event, one condition and one effect:

  1. event:

on place of sand: # condition: block below is air # effect: send "Watch the sand falling!" to player In case you didn't already figure out what this trigger does: It informs players who place sand in midair that the sand they just placed will fall down as there's no block below it.

To create a new trigger, start a text editor (e.g. Notepad), write the trigger, and then save it in the Skript/scripts/ directory as ‘name of the trigger.sk’, e.g. ‘plant with hoe.sk’. You can give it any name you want, but it should be meaningful so that you'll later still know what kind of triggers it contains.

After creating or changing a trigger you must either restart your server or use the command /skript reload for the changes to take effect. If you restarted the server you should check the server log for [Skript] errors, while errors will be directly sent to you if you use /skript reload. If you get any errors this means that Skript couldn't understand parts of your trigger, and it will usually tell you what is wrong. If you get a general error like can't understand '...' or '...' is not a(n) ... you should check your spelling.

You can find lists of all events, conditions and effects by clicking on the links on the top of the page.

If you need help you can post on Skript's help forum. As usual, please use the search function before posting and read this documentation, it might answer your questions. Taking a look at what others have accomplished with Skript can also help a lot in case my style of writing does not suit you well. Advanced Syntax Skript's syntax is not limited to simple statements, but can also be more complex like set fuel of block to player's tool To make things like ‘tool of …’ or ‘block below/north of/above …’ possible, so-called expressions are used. You can find a list of all expressions here.

As well as the basic syntax the trigger syntax is also more advanced. The following sections cover these special cases. Conditionals A nice feature are conditional statements. Such a statement is a part of a trigger which is only executed/checked if the section's main condition is met, which looks like this: the first line is the main condition followed by a colon: followed by one or more indented lines which are only executed if the main condition is met if a condition is not met within these lines the trigger will continue after the end of the section the trigger continues as normal after the indented lines You can also add an ‘else:’ just after the indented lines end and one or more indented lines afterwards which will be executed if the main condition isn't met. The following example demonstrates the usage of conditionals: on login: chance of 50%: give a cake to the player send "You got a gift for logging in =)" to the player else: send "You were not fortunate enough to get a gift this time. Try again next time!" to the player This script gives each player a 50% chance of receiving a cake upon logging in, notifying them of their gift or that they didn't receive a gift if they were not lucky. Loops Loops help to reduce repetitive tasks within triggers. There are currently a few loopable values, including items, blocks and players.

Loops are pretty straightforward. You say what to loop and then use that within the loop: loop values to loop: do something with the loop-value Please note that conditions behave differently in loops. If a condition is not met, only the current execution of the loop is terminated and the loop will continue with the next item. If you want conditions to exit the loop, use a conditional: condition: exit loop You can also stop the whole trigger with ‘exit’ or ‘exit trigger’.

As examples are always nice here's one. It defines a command /find which finds a block of a certain type near the player: command /find <material>: description: Find a block of the given material trigger: loop blocks in radius 10: loop-block is argument message "Found a %argument% block at %location of loop-block%" stop trigger send "There's no %argument% block around!" to player About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Týr's Day, 1st October 2013, 08:25

Events

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: EventsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents At Time On Bed Enter On Bed Leave On Block Damage On Break / Mine On Bucket Empty On Bucket Fill On Burn On Can Build Check On Chat On Chunk Generate On Chunk Load On Chunk Unload On Click On Combust On Command On Connect On Consume On Craft On Creeper Power On Damage On Death On Dispense On Drop On Enderman/Sheep On Experience Spawn On Explode On Explosion Prime On Fade On First Join On Fishing On Flow On Form On Fuel Burn On Gamemode Change On Grow On Heal On Hunger Meter Change On Ignition On Item Break On Item Spawn On Join On Kick On Leaves Decay On Level Change On Lightning Strike On Move On On Physics On Pick Up On Pig Zap On Piston Extend On Piston Retract On Place On Portal On Portal Create On Portal Enter On Pressure Plate / Trip On Projectile Hit On Quit On Redstone On Region Enter/Leave On Respawn On Script Load/Unload On Shoot On Sign Change On Skript Start/Stop On Smelt On Sneak Toggle On Spawn On Spawn Change On Spread On Sprint Toggle On Tame On Target On Teleport On Throwing of an Egg On Tool Change On Vehicle Create On Vehicle Damage On Vehicle Destroy On Vehicle Enter On Vehicle Exit On Weather Change On World Init On World Load On World Save On World Unload On Zombie Break Door Periodical Filter for version:

=>

The following is a listing of all possible events you can use to start a trigger with. Each trigger can only have one single event, i.e. you cannot create triggers that are called when any of several events occurrs.

Please also note that the ‘on’ at the start of an event is entirely optional but it just looks better in my opinion, and that most events don't have examples since there is only one way to use them. At Time patterns[?]: at %time% [in %worlds%] since: 1.3.4 An event that occurs at a given minecraft time in every world or only in specific worlds. examples: at 18:00 at 7am in "world" On Bed Enter patterns[?]: [on] bed enter[ing] [on] [player] enter[ing] [a] bed since: 1.0 Called when a player starts sleeping. On Bed Leave patterns[?]: [on] bed leav(e|ing) [on] [player] leav(e|ing) [a] bed since: 1.0 Called when a player leaves a bed. On Block Damage patterns[?]: [on] block damage since: 1.0 Called when a player starts to break a block. You can usually just use the leftclick event for this. On Break / Mine patterns[?]: [on] [block] (min(e|ing)) [[of] %item types%] since: 1.0 (break), unknown (mine) Called when a block is broken by a player. If you use 'on mine', only events where the broken block dropped something will call the trigger. examples: on mine on break of stone on mine of any ore On Bucket Empty patterns[?]: [on] bucket empty[ing] [on] [player] empty[ing] [a] bucket since: 1.0 Called when a player empties a bucket. You can also use the place event with a check for water or lava. On Bucket Fill patterns[?]: [on] bucket fill[ing] [on] [player] fill[ing] [a] bucket since: 1.0 Called when a player fills a bucket. Like the bucket empty event, you can also use the break event with a check for water or lava. On Burn patterns[?]: [on] [block] burn[ing] [[of] %item types%] since: 1.0 Called when a block is destroyed by fire. examples: on burn on burn of wood, fences, or chests On Can Build Check patterns[?]: [on] [block] can build check since: 1.0 (basic), 2.0 ([un]cancellable) Called when a player rightclicks on a block while holding a block or a placeable item. You can either cancel the event to prevent the block from being built, or uncancel it to allow it. Please note that the data value of the block to be placed is not available in this event, only its ID. On Chat patterns[?]: [on] chat since: 1.4.1 Called whenever a player chats. On Chunk Generate patterns[?]: [on] chunk (generat|populat)(e|ing) since: 1.0 Called after a new chunk was generated. On Chunk Load patterns[?]: [on] chunk load[ing] since: 1.0 Called when a chunk loads. The chunk might or might not contain mobs when it's loaded. On Chunk Unload patterns[?]: [on] chunk unload[ing] since: 1.0 Called when a chunk is unloaded due to not being near any player. Cancel the event to force the server to keep the chunk loaded and thus keep simulating the chunk (e.g. physics, plant growth, minecarts, etc. will keep working and won't freeze). On Click patterns[?]: [on] [(right|left)[( |-)]][mouse[( |-)]]click[ing] [on %entity type/item type%] [(with|using|holding) %item type%] [on] [(right|left)[( |-)]][mouse[( |-)]]click[ing] (with|using|holding) %item type% on %entity type/item type% since: 1.0 Called when a user clicks on a block, an entity or air with or without an item in their hand. Please note that rightclick events with an empty hand while not looking at a block are not sent to the server, so there's no way to detect them. examples: on click on rightclick holding a fishing rod on leftclick on a stone or obsidian on rightclick on a creeper on click with a sword On Combust patterns[?]: [on] combust[ing] since: 1.0 Called when an entity is set on fire, e.g. by fire or lava, a fireball, or by standing in direct sunlight (zombies, skeletons). See also: on ignition - called when a block catches fire. On Command patterns[?]: [on] command [%text%] since: 2.0 Called when a player enters a command (not necessarily a Skript command). Please define a custom command if possible instead of using this event. Use this event only if you need to perform some action on multiple command, e.g. to prevent commands under certain circumstances, to log commands, or to add Skript checks to commands from other plugins that cannot be solved by changing the permissions of the player(s). examples: on command on command "/stop" on command "pm Njol " On Connect patterns[?]: [on] [player] connect[ing] since: 2.0 Called when a player connects to the server. This event is called before the player actually joins the server, so if you want to prevent players from joining you should prefer this event over on join. examples: on connect: player doesn't have permission "VIP" number of players is larger than 20 kick the player due to "The last 5 slots are reserved for VIP players." On Consume patterns[?]: [on] [player] ((eat|drink)[ing]|consum(e|ing)) [[of] %item types%] since: 2.0 Called when a player is done eating/drinking something, e.g. an apple, bread, meat, milk or a potion. On Craft patterns[?]: [on] [player] craft[ing] [[of] %item types%] since: unknown Called when a player crafts an item. On Creeper Power patterns[?]: [on] creeper power since: 1.0 Called when a creeper is struck by lighting and gets powered. Cancel the event to prevent the creeper from being powered. See also: on lightning strike On Damage patterns[?]: [on] damag(e|ing) [of %entity type%] since: 1.0 Called when an entity receives damage, e.g. by an attack from another entity, lava, fire, drowning, fall, suffocation, etc. examples: on damage on damage of a player On Death patterns[?]: [on] death [of %entity types%] since: 1.0 Called when a living entity (including players) dies. examples: on death on death of player on death of a wither or ender dragon: broadcast "A %entity% has been slain in %world%!" On Dispense patterns[?]: [on] dispens(e|ing) [[of] %item types%] since: unknown Called when a dispenser dispenses an item. On Drop patterns[?]: [on] [player] drop[ing] [[of] %item types%] since: unknown Called when a player drops an item from his inventory. On Enderman/Sheep patterns[?]: [on] enderman place [on] enderman pickup [on] sheep eat since: unknown Called when an enderman places or picks up a block, or a sheep eats grass respectively. On Experience Spawn patterns[?]: [on] [e]xp[erience] [orb] spawn [on] spawn of [a[n]] [e]xp[erience] [orb] since: 2.0 Called whenever experience is about to spawn. This is a helper event for easily being able to stop xp from spawning, as all you can currently do is cancel the event. Please note that it's impossible to detect xp orbs spawned by plugins (including Skript) with Bukkit, thus make sure that you have no such plugins if you don't want any xp orbs to spawn. (Many plugins that only change the experience dropped by blocks or entities will be detected without problems though) examples: on xp spawn: world is "minigame_world" cancel event On Explode patterns[?]: [on] explo(d(e|ing)|sion) since: 1.0 Called when an entity (a primed TNT or a creeper) explodes. On Explosion Prime patterns[?]: [on] explosion prime since: 1.0 Called when an explosive is primed, i.e. an entity will explode shortly. Creepers can abort the explosion if the player gets too far away, while TNT will explode for sure after a short time. On Fade patterns[?]: [on] [block] fad(e|ing) [[of] %item types%] since: 1.0 Called when a block 'fades away', e.g. ice or snow melts. examples: on fade of snow or ice On First Join patterns[?]: [on] first (join|login) since: 1.3.7 Called when a player joins the server for the first time. On Fishing patterns[?]: [on] [player] fish[ing] since: 1.0 Called when a player fishes something. This is not of much use yet. On Flow patterns[?]: [on] [block] flow[ing] [on] block mov(e|ing) since: 1.0 Called when a blocks flows or teleports to another block. This not only applies to water and lava, but teleporting dragon eggs as well. On Form patterns[?]: [on] [block] form[ing] [[of] %item types%] since: 1.0 Called when a block is created, but not by a player, e.g. snow forms due to snowfall, water freezes in cold biomes, or a block spreads (see spread event). examples: on form of snow on form of a mushroom On Fuel Burn patterns[?]: [on] fuel burn[ing] since: 1.0 Called when a furnace burns an item from its fuel slot. On Gamemode Change patterns[?]: [on] game[ ]mode change [to %gamemode%] since: 1.0 Called when a player's gamemode changes. examples: on gamemode change on gamemode change to adventure On Grow patterns[?]: [on] grow [of %tree type%] since: 1.0 Called when a tree or giant mushroom grows to full size. examples: on grow on grow of a tree on grow of a huge jungle tree On Heal patterns[?]: [on] heal[ing] since: 1.0 Called when an entity is healed, e.g. by eating (players), being fed (pets), or by the effect of a potion of healing (overworld mobs) or harm (nether mobs). On Hunger Meter Change patterns[?]: [on] (food|hunger) (level|met(er|re)|bar) chang(e|ing) since: 1.4.4 Called when the hunger bar of a player changes, i.e. either increases by eating or decreases over time. On Ignition patterns[?]: [on] [block] ignit(e|ion) since: 1.0 Called when a block starts burning, i.e. a fire block is placed next to it and this block is flammable. The burn event will be called when the block is about do be destroyed by the fire. See also: on combust - called when an entity is set on fire. On Item Break patterns[?]: [on] [player] tool break[ing] [on] [player] break[ing] [(a|the)] tool since: 2.1.1 Called when a player breaks his tool because its damage reached the maximum value. This event cannot be cancelled. On Item Spawn patterns[?]: [on] item spawn[ing] [[of] %item types%] since: unknown Called whenever an item stack is spawned in a world, e.g. as drop of a block or mob, a player throwing items out of his inventory, or a dispenser dispensing an item (not shooting it). On Join patterns[?]: [on] [player] (login|logging in|join[ing]) since: 1.0 Called when a player joins the server. The player is already in a world when this event is called, so if you want to prevent players from joining you should prefer on connect over this event. examples: on join: message "Welcome on our awesome server!" broadcast "%player% just joined the server!" On Kick patterns[?]: [on] [player] (kick|being kicked) since: 1.0 Called when a player is kicked from the server. You can change the kick message or cancel the event entirely. On Leaves Decay patterns[?]: [on] leaves decay[ing] since: 1.0 Called when a leaf block decays due to not being connected to a tree. On Level Change patterns[?]: [on] [player] level [change] since: unknown Called when a player's level changes, e.g. by gathering experience or by enchanting something. On Lightning Strike patterns[?]: [on] lightning [strike] since: 1.0 Called when lightning strikes. Use on creeper power and on pig zap to find out if one or more creepers and/or pigs were hit. On Move On patterns[?]: [on] (step|walk)[ing] (on|over) %*item types% since: 2.0 Called when a player moves onto a certain type of block. Please note that using this event can cause lag if there are many players online. examples: on walking on dirt or grass on stepping on stone On Physics patterns[?]: [on] [block] physics since: 1.4.6 Called when a physics check is done on a block. By cancelling this event you can prevent some things from happening, e.g. sand falling, dirt turning into grass, torches dropping if their supporting block is destroyed, etc. Please note that using this event might cause quite some lag since it gets called extremely often. examples:

  1. prevents sand from falling

on block physics: block is sand cancel event On Pick Up patterns[?]: [on] [player] (pick[ ]up|picking up) [[of] %item types%] since: unknown Called when a player picks up an item. The item is still on the ground when this event is called. On Pig Zap patterns[?]: [on] pig[ ]zap since: 1.0 Called when a pig is struck by lightning and transforms into a zombie pigman. Cancel the event to prevent the transformation. See also: on lightning strike On Piston Extend patterns[?]: [on] piston extend[ing] since: 1.0 Called when a piston is about to extend. On Piston Retract patterns[?]: [on] piston retract[ing] since: 1.0 Called when a piston is about to retract. On Place patterns[?]: [on] [block] (plac(e|ing)|build[ing]) [[of] %item types%] since: 1.0 Called when a player places a block. examples: on place on place of a furnace, workbench or chest On Portal patterns[?]: [on] [player] portal since: 1.0 Called when a player uses a nether or end portal. Cancel the event to prevent the player from teleporting. On Portal Create patterns[?]: [on] portal create since: 1.0 Called when a portal is created, either by a player or mob lighting an obsidian frame on fire, or by a nether portal creating its teleportation target in the nether/overworld. Please note that it's not possible to use the player in this event. On Portal Enter patterns[?]: [on] portal enter [on] entering [a] portal since: 1.0 Called when a player enters a nether portal and the swirly animation starts to play. On Pressure Plate / Trip patterns[?]: [on] [step[ping] on] [a] [pressure] plate [on] (trip|[step[ping] on] [a] tripwire) since: 1.0 (pressure plate), 1.4.4 (tripwire) Called when a player steps on a pressure plate or tripwire respectively. On Projectile Hit patterns[?]: [on] projectile hit since: 1.0 Called when a projectile hits an entity or a block. Use the damage event with a check for a projectile to be able to use the entity that got hit in the case when the projectile hit a living entity. A damage event will even be fired if the damage is 0, e.g. when throwing snowballs at non-nether mobs. On Quit patterns[?]: [on] (quit[ting]|disconnect[ing]|log[ ]out|logging out) since: 1.0 Called when a player leaves the server. Starting with Skript 2.0 this also includes kicked players. On Redstone patterns[?]: [on] redstone [current] [chang(e|ing)] since: 1.0 Called when the redstone current of a block changes. This event is of not much use yet. On Region Enter/Leave patterns[?]: cannot be used directly since: 2.1 Called when a player enters or leaves a region. This event requires a supported regions plugin to be installed. examples: on region exit: message "Leaving %region%." On Respawn patterns[?]: [on] [player] respawn[ing] since: 1.0 Called when a player respawns. You should prefer this event over the death event as the player is technically alive when this event is called. On Script Load/Unload patterns[?]: [on] [script] (load|init|enable) [on] [script] (unload|stop|disable) since: 2.0 Called directly after the trigger is loaded, or directly before the whole script is unloaded. examples: on load: set {running.%script%} to true on unload: set {running.%script%} to false On Shoot patterns[?]: [on] [projectile] shoot since: 1.0 Called whenever a projectile is shot. Use the shooter expression to get who shot the projectile. On Sign Change patterns[?]: [on] sign (chang[e]|edit)[ing] [on] [player] (chang[e]|edit)[ing] [a] sign since: 1.0 As signs are placed empty, this event is called when a player is done editing a sign. examples: on sign change: line 2 is empty set line 1 to "<red>%line 1%" On Skript Start/Stop patterns[?]: [on] (server|skript) (start|load|enable) [on] (server|skript) (stop|unload|disable) since: 2.0 Called when the server starts or stops (actually, when Skript starts or stops, so a /reload will trigger these events as well). examples: on Skript start on server stop On Smelt patterns[?]: [on] [ore] smelt[ing] [on] smelt[ing] of ore since: 1.0 Called when a furnace smelts an item in its ore slot. On Sneak Toggle patterns[?]: [on] [player] toggl(e|ing) sneak [on] [player] sneak toggl(e|ing) since: 1.0 Called when a player starts or stops sneaking. Use is sneaking to get whether the player was sneaking before the event was called. examples:

  1. make players that stop sneaking jump

on sneak toggle: player was sneaking push the player upwards at speed 0.5 On Spawn patterns[?]: [on] spawn[ing] [of %entity types%] since: 1.0 Called when an creature spawns. examples: on spawn of a zombie on spawn of an ender dragon: broadcast "A dragon has been sighted in %world%!" On Spawn Change patterns[?]: [on] [world] spawn change since: 1.0 Called when the spawn point of a world changes. On Spread patterns[?]: [on] spread[ing] since: 1.0 Called when a new block forms as a result of a block that can spread, e.g. water or mushrooms. On Sprint Toggle patterns[?]: [on] [player] toggl(e|ing) sprint [on] [player] sprint toggl(e|ing) since: unknown Called when a player starts or stops sprinting. Use is sprinting to get whether the player was sprinting before the event was called. On Tame patterns[?]: [on] [entity] tam(e|ing) since: 1.0 Called when a player tames a wolf or ocelot. Can be cancelled to prevent the entity from being tamed. On Target patterns[?]: [on] [entity] target [on] [entity] un[-]target since: 1.0 Called when a mob starts/stops following/attacking another entity, usually a player. Please note that even though the target expression also works for a player's target this event is not called for players. On Teleport patterns[?]: [on] [player] teleport[ing] since: 1.0 Called whenever a player is teleported, either by a nether/end portal or other means (e.g. by plugins). On Throwing of an Egg patterns[?]: [on] throw[ing] [of] [an] egg [on] [player] egg throw since: 1.0 Called when a player throws an egg. You can just use the shoot event in most cases, as this event is intended to support changing the hatched mob and its chance to hatch, but Skript does not yet support that. On Tool Change patterns[?]: [on] [player['s]] (tool|item held|held item) chang(e|ing) since: 1.0 Called whenever a player changes his held item by selecting a different slot (e.g. the keys 1-9 or the mouse wheel), but not by dropping or replacing the item in the current slot. On Vehicle Create patterns[?]: [on] vehicle create [on] creat(e|ing|ion of) [a] vehicle since: 1.0 Called when a new vehicle is created, e.g. when a player places a boat or minecart. On Vehicle Damage patterns[?]: [on] vehicle damage [on] damag(e|ing) [a] vehicle since: 1.0 Called when a vehicle gets damage. Too much damage will destroy the vehicle. On Vehicle Destroy patterns[?]: [on] vehicle destroy [on] destr(oy[ing]|uction of) [a] vehicle since: 1.0 Called when a vehicle is destroyed. Any passenger will be ejected and the vehicle might drop some item(s). On Vehicle Enter patterns[?]: [on] vehicle enter [on] enter[ing] [a] vehicle since: 1.0 Called when an entity enters a vehicle, either deliberately (players) or by falling into them (mobs). On Vehicle Exit patterns[?]: [on] vehicle exit [on] exit[ing] [a] vehicle since: 1.0 Called when an entity exits a vehicle. On Weather Change patterns[?]: [on] weather change [to %weather types%] since: 1.0 Called when a world's weather changes. examples: on weather change on weather change to sunny On World Init patterns[?]: [on] world init since: 1.0 Called when a world is initialised. As all default worlds are initialised before any scripts are loaded, this event is only called for newly created worlds. World management plugins might change the behaviour of this event though. On World Load patterns[?]: [on] world load[ing] since: 1.0 Called when a world is loaded. As with the world init event, this event will not be called for the server's default world(s). On World Save patterns[?]: [on] world sav(e|ing) since: 1.0 Called when a world is saved to disk. Usually all worlds are saved simultaneously, but world management plugins could change this. On World Unload patterns[?]: [on] world unload[ing] since: 1.0 Called when a world is unloaded. This event might never be called if you don't have a world management plugin. On Zombie Break Door patterns[?]: [on] zombie break[ing] [a] [wood[en]] door since: unknown Called when a zombie is done breaking a wooden door. Can be cancelled to prevent the zombie from breaking the door. Periodical patterns[?]: every %time span% in [world[s]] %worlds% since: 1.0 An event that is called periodically. The event is used like 'every <timespan>', e.g. 'every second' or 'every 5 minutes'. examples: every second every minecraft hour every tick # warning: lag! every minecraft day in "world" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:42

Conditions

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: ConditionsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents Can Build Can Hold Chance Comparison Contains Damage Cause Exists/Is Set Has Permission Has Played Before Is Alive Is Banned Is Blocking Is Burning Is Empty Is Enchanted Is Flying Is Holding Is in World Is Member/Owner of Region Is of Type Is Online Is Poisoned Is Riding Is Sleeping Is Sneaking Is Sprinting Is Wearing PvP Region Contains Time Weather Filter for version:

=>

Can Build patterns[?]: cannot be used directly since: 2.0 Tests whether a player is allowed to build at a certain location. This condition requires that a supported regions plugin is installed. examples: command /setblock <material>: description: set the block at your crosshair to a different type trigger: player cannot build at the targeted block: message "You do not have permission to change blocks there!" stop set the targeted block to argument Can Hold patterns[?]: %inventories% (can hold|ha(s|ve) [enough] space (for|to hold)) %item types% %inventories% (can(no|')t hold|(ha(s|ve) not|ha(s|ve)n't|do[es]n't have) [enough] space (for|to hold)) %item types% since: 1.0 Tests whether a player or a chest has enough free space to hold the given item. This includes trying to fill existing stacks of the tested item(s). examples: block can hold 200 cobblestone player has enough space for 64 feathers Chance patterns[?]: chance of %number%[\%] since: 1.0 A condition that randomly succeeds or fails. Valid values are between 0% and 100%, or if the percent sign is omitted between 0 and 1. examples: chance of 50%: drop a diamond chance of {var}% # {var} between 0 and 100 chance of {var} # {var} between 0 and 1 Comparison patterns[?]: [neither] %objects% ((is|are) ((greater|more|higher|bigger|larger) than|above)|>) %objects% [neither](neither)|isn't|aren't) ((less|smaller) than|below)|>=) %objects% [neither] %objects% ((is|are) ((less|smaller) than|below)|<) %objects% [neither](neither)|isn't|aren't) ((greater|more|higher|bigger|larger) than|above)|<=) %objects% [neither](neither)|isn't|aren't|!=) [equal to] %objects% [neither] %objects% (is|are|=) [(equal to|the same as)] %objects% [neither] %objects% (is|are) between %objects% and %objects% [neither](is not|are not|isn't|aren't) between %objects% and %objects% since: 1.0 A very general condition, it simply compares two values. Usually you can only compare for equality (e.g. block is/isn't of <type>), but some values can also be compared using greater than/less than. In that case you can also test for whether an object is between two others. Note: This is the only element where not all patterns are shown. It has actually another two sets of similar patters, but with (was|were) or will be instead of (is|are) respectively, which check different time states of the first expression. examples: the clicked block is a stone slab or a double stone slab time in the player's world is greater than 8:00 the creature is not an enderman or an ender dragon Contains patterns[?]: %inventories% ha(s|ve) %item types% [in [(the[ir]|his|her|its)] inventory] %inventories/texts/objects% contain[s] %item types/texts/objects% %inventories% do[es](n't| not) have %item types% [in [(the[ir]|his|her|its)] inventory] %inventories/texts/objects% do[es](n't| not) contain %item types/texts/objects% since: 1.0 Checks whether an inventory contains the given item, a text contains another piece of text, or a list of objects (e.g. a {list variable::*}) contains another object. examples: block contains 20 cobblestone player has 4 flint and 2 iron ingots Damage Cause patterns[?]: [the] damage [(n('|o)]t) [been] (caused|done|made) by %damage cause% since: 2.0 Tests what kind of damage caused a damage event. Refer to the Damage Cause type for a list of all possible causes. examples:

  1. make players use their potions of fire resistance whenever they take any kind of fire damage

on damage: damage was caused by lava, fire or burning victim is a player victim has a potion of fire resistance cancel event apply fire resistance to the victim for 30 seconds remove 1 potion of fire resistance from the victim

  1. prevent mobs from dropping items under certain circumstances

on death; entity is not a player damage wasn't caused by a block explosion, an attack, a projectile, a potion, fire, burning, thorns or poison clear drops Exists/Is Set patterns[?]: %~objects% (exist[s]|(is|are) set) %~objects% (do[es](n't| not) exist|(is|are)(n't| not) set) since: 1.2 Checks whether a given expression or variable is set. examples: {teamscript.%player%.preferred team} is not set on damage: projectile exists broadcast "%attacker% used a %projectile% to attack %victim%!" Has Permission patterns[?]: [%players/console%] (do[es]n't|don't|do[es] not) have [the] permission[s] %texts% [%players/console%] ha(s|ve) [the] permission[s] %texts% since: 1.0 Test whether a player has a certain permission. examples: player has permission "skript.tree" victim has the permission "admin": send "You're attacking an admin!" to attacker Has Played Before patterns[?]: %offline player% [(has|did)] [already] play[ed] [on (this|the) server] (before|already) %offline player% (has not|hasn't|did not|didn't) [(already|yet)] play[ed] [on (this|the) server] (before|already|yet) since: 1.4 Checks whether a player has played on this server before. You can also use on first join if you want to make triggers for new players. examples: player has played on this server before player hasn't played before Is Alive patterns[?]: %living entities% (alive|dead) %living entities% (alive|dead) since: 2.0 Checks whetehr an entity is alive. This is mostly useful to check whether an entity stored in a variable does still exist examples: {villagerbuddy.%player%} is dead Is Banned patterns[?]: %offline players/texts% (is|are) banned %players/texts% [(is|are) IP(-| )]banned %offline players/texts% (isn't|is not|aren't|are not) banned %players/texts% [(isn't|is not|aren't|are not) IP(-| )]banned since: 1.4 Checks whether a player or IP is banned. examples: player is banned victim is not IP-banned "127.0.0.1" is banned Is Blocking patterns[?]: %players% (is|are) (blocking|defending) %players% (isn't|is not|aren't|are not) (blocking|defending) since: unknown Checks whether a player is blocking with his sword. examples: victim is blocking Is Burning patterns[?]: %entities% (is|are) (burning|ignited|on fire) %entities% (isn't|is not|aren't|are not) (burning|ignited|on fire) since: 1.4.4 Checks whether an entity is on fire, e.g. a zombie due to being in sunlight, or any entity after falling into lava. examples:

  1. increased attack against buring targets

victim is burning: increase damage by 2 Is Empty patterns[?]: %inventories/slots/texts% (is|are) empty %inventories/slots/texts% (isn't|is not|aren't|are not) empty since: unknown Checks whether an inventory, an inventory slot, or a text is empty. examples: player's inventory is empty Is Enchanted patterns[?]: %item types% (is|are) enchanted [with %enchantment type%] %item types% (isn't|is not|aren't|are not) enchanted [with %enchantment type%] since: 1.4.6 Checks whether an item is enchanted. examples: tool of the player is enchanted with efficiency 2 helm, chestplate, leggings or boots are enchanted Is Flying patterns[?]: %players% (is|are) flying %players% (isn't|is not|aren't|are not) flying since: 1.4.4 Checks whether a player is flying examples: player is not flying Is Holding patterns[?]: [%living entities%] ha(s|ve) %item types% in hand [%living entities%] (is|are) holding %item types% [%living entities%] (ha(s|ve) not|do[es]n't have) %item types% in hand [%living entities%] (is not|isn't) holding %item types% since: 1.0 Checks whether a player is holdign a specific item. Cannot be used with endermen, use 'entity is [not] an enderman holding <item type>' instead. examples: player is holding a stick victim isn't holding a sword of sharpness Is in World patterns[?]: %entities% (is|are) in [[the] world[s]] %worlds% %entities% (is not|isn't|are not|aren't) in [[the] world[s]] %worlds% since: 1.4 Checks whether an entity is in a specific world examples: player is in "world" argument isn't in world "world_nether" the attacker is in the world of the victim Is Member/Owner of Region patterns[?]: cannot be used directly since: 2.1 Checks whetehr a player is a member or owner of a particular region. This condition requires a supported regions plugin to be installed. examples: on region enter: player is the owner of the region message "Welcome back to %region%!" send "%player% just entered %region%!" to all members of the region Is of Type patterns[?]: %item stacks/entities% (is|are) of type[s] %item types/entity types% %item stacks/entities% (isn't|is not|aren't|are not) of type[s] %item types/entity types% since: 1.4 Checks whether an item of entity is of the given type. This is mostly useful for variables, as you can use the general 'is' condition otherwise (e.g. 'victim is a creeper'). examples: tool is of type {*selected type} victim is of type {villager type} Is Online patterns[?]: %offline players% ((is|are) online|(is not|isn't|are not|aren't) offline) %offline players% ((is|are) offline|(is not|isn't|are not|aren't) online) since: 1.4 Checks whether a player is online. examples: player is online player-argument is offline Is Poisoned patterns[?]: %living entities% (is|are) poisoned %living entities% (isn't|is not|aren't|are not) poisoned since: 1.4.4 Checks whether an entity is poisoned. examples: player is poisoned: cure the player from posion message "You have been cured!" Is Riding patterns[?]: %entities% (is|are) riding [%entity types%] %entities% (isn't|is not|aren't|are not) riding [%entity types%] since: 2.0 Tests whether an entity is riding another or is in a vehicle. examples: player is riding a saddled pig Is Sleeping patterns[?]: %players% (is|are) sleeping %players% (isn't|is not|aren't|are not) sleeping since: 1.4.4 Checks whether a player is sleeping. examples:

  1. cut your enemies' throats in their sleep >=)

on attack: attacker is holding a sword victim is sleeping increase the damage by 1000 Is Sneaking patterns[?]: %players% (is|are) sneaking %players% (isn't|is not|aren't|are not) sneaking since: 1.4.4 Checks whether a player is sneaking examples:

  1. prevent mobs from seeing sneaking players if they are at least 4 meters apart

on target: target is sneaking distance of target and the entity is bigger than 4 cancel the event Is Sprinting patterns[?]: %players% (is|are) sprinting %players% (isn't|is not|aren't|are not) sprinting since: 1.4.4 Checks whether a player is sprinting examples: player is not sprinting Is Wearing patterns[?]: %living entities% (is|are) wearing %item types% %living entities% (isn't|is not|aren't|are not) wearing %item types% since: 1.0 Checks whether a player is wearing some armour. examples: player is wearing an iron chestplate and iron leggings player is wearing all diamond armour PvP patterns[?]: (is PvP|PvP is) enabled [in %worlds%] (is PvP|PvP is) disabled [in %worlds%] since: 1.3.4 Checks the PvP status of a world. examples: PvP is enabled PvP is disabled in "world" Region Contains patterns[?]: cannot be used directly since: 2.1 Checks whether a location is contained in a particular region. This condition requires a supported regions plugin to be installed. examples: player is in the region {regions::3} on region enter: region contains {flags.%world%.red} message "The red flag is near!" Time patterns[?]: %date% (was|were)( more|(n't| not) less) than %time span% [ago] %date% (was|were)((n't| not) more| less) than %time span% [ago] since: 2.0 Tests whether a given real time was more or less than some time span ago. examples: command /command_with_cooldown: trigger: {command.%player%.lastused} was less than a minute ago: message "Please wait a minute between uses of this command." stop set {command.%player%.lastused} to now # ... actual command trigger here ... Weather patterns[?]: is %weather types% [in %worlds%] since: 1.0 Checks whether the weather in a world is of a specific type. I welcome any ideas how to write this condition differently. examples: is thundering is raining in "world" or "world2" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:42

Effects

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: EffectsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents Ban Broadcast Cancel Event Change: Set/Add/Remove/Delete/Reset Colour Armour Command Damage/Heal/Repair Delay Drop Enchant/Disenchant Equip Exit Explosion Ignite/Extinguish Kick Kill Lightning Log Message op/deop Open Inventory Play Effect Poison/Cure Potion Effects Push PvP Replace Shear Shoot Spawn Teleport Toggle Tree Vehicle Filter for version:

=>

Ban patterns[?]: ban %texts/offline players% [(by reason of|because [of]|on account of|due to) %text%] unban %texts/offline players% ban %players% by IP [(by reason of|because [of]|on account of|due to) %text%] unban %players% by IP IP(-| )ban %players% [(by reason of|because [of]|on account of|due to) %text%] (IP(-| )unban|un[-]IP[-]ban) %players% since: 1.4, 2.1.1 (ban reason) Bans/unbans a player or IP. Starting with Skript 2.1.1 and Bukkit 1.7.2 R0.4, one can also ban players with a reason. If an invalid reason is supplied (e.g. a non-existent variable) the player will still be banned, but the default reason will be used. examples: unban player ban "127.0.0.1" IP-ban the player because "he is an idiot" Broadcast patterns[?]: broadcast %texts% [(to|in) %worlds%] since: 1.0 Broadcasts a message to the server. examples: broadcast "Welcome %player% to the server!" broadcast "Woah! It's a message!" Cancel Event patterns[?]: cancel [the] event uncancel [the] event since: 1.0 Cancels the event (e.g. prevent blocks from being placed, or damage being taken). examples: on damage: victim is a player victim has the permission "skript.god" cancel the event Change: Set/Add/Remove/Delete/Reset patterns[?]: (add|give) %objects% to %~objects% increase %~objects% by %objects% give %~objects% %objects% set %~objects% to %objects% remove (all|every) %objects% from %~objects% (remove|subtract) %objects% from %~objects% reduce %~objects% by %objects% (delete|clear) %~objects% reset %~objects% since: 1.0 (set, add, remove, delete), 2.0 (remove all) A very general effect that can change many expressions. Many expressions can only be set and/or deleted, while some can have things added to or removed from them. examples:

  1. set:

Set the player's display name to "<red>%name of player%" set the block above the victim to lava

  1. add:

add 2 to the player's health # preferably use '<a href='#heal'>heal</a>' for this add argument to {blacklist::*} give a diamond pickaxe of efficiency 5 to the player increase the data value of the clicked block by 1

  1. remove:

remove 2 pickaxes from the victim subtract 2.5 from {points.%player%}

  1. remove all:

remove every iron tool from the player remove all minecarts from {entitylist::*}

  1. delete:

delete the block below the player clear drops delete {variable}

  1. reset:

reset walk speed of player reset chunk at the targeted block Colour Armour patterns[?]: (dye|colo[u]r|paint) %slots/item stack% %color% (dye|colo[u]r|paint) %slots/item stack% (%number%, %number%, %number%) since: 2.0 Colours leather armour in a given colour. You can also use RGB codes if you feel limited with the 16 default colours. RGB codes are three numbers from 0 to 255 in the order (red, green, blue), where (0,0,0) is black and (255,255,255) is white. examples: dye player's helmet blue colour the player's tool red Command patterns[?]: [execute] [the] command %texts% [by %players/console%] [execute] [the] %players/console% command %texts% (let|make) %players/console% execute [[the] command] %texts% since: 1.0 Executes a command. This can be useful to use other plugins in triggers. examples: make player execute command "/suicide" execute console command "/say Hello everyone!" Damage/Heal/Repair patterns[?]: damage %slots/living entities/item stack% by %number% [heart[s]] heal %living entities% [by %number% [heart[s]]] repair %slots/item stack% [by %number%] since: 1.0 Damage/Heal/Repair an entity, or item stack. examples: damage player by 5 hearts heal the player repair tool of player Delay patterns[?]: (wait|halt) [for] %time span% since: 1.4 Delays the script's execution by a given timespan. Please note that delays are not persistent, e.g. trying to create a tempban script with ban player → wait 7 days → unban player will not work if you restart your server anytime within these 7 days. You also have to be careful even when using small delays! examples: wait 2 minutes halt for 5 minecraft hours wait a tick Drop patterns[?]: drop %item types/experience point% [%directions% %locations%] since: 1.0 Drops one or more items. examples: on death of creeper: drop 1 TNT Enchant/Disenchant patterns[?]: enchant %~item stack% with %enchantment types% disenchant %~item stack% since: 2.0 Enchant or disenchant an existing item examples: enchant the player's tool with sharpness 5 disenchant the player's tool Equip patterns[?]: equip [%living entity%] with %item types% make %living entity% wear %item types% since: 1.0 Equips a player with some given armor. This will replace any armor that the player is wearing. Starting with Skript 2.1 mobs can be equipped with armour as well, pigs can be equipped with saddles, and horses can be equipped with saddles, horse armour, and chests. examples: equip player with diamond helmet equip player with all diamond armour equip the clicked horse with diamond horse armour and a saddle make the last spawned pig wear a saddle Exit patterns[?]: (exit|stop) [trigger] (section|loop|conditional) (section|loop|conditional)s (section|loop|conditional)s since: unknown Exits a given amount of loops and conditionals, or the entire trigger. examples: if player has any ore: stop message "%player% has no ores!" loop blocks above the player: loop-block is not air: exit 2 sections set loop-block to water Explosion patterns[?]: [(create|make)] [an] explosion (of|with) (force|strength|power) %number% [%directions% %locations%] [(create|make)] [a] safe explosion (of|with) (force|strength|power) %number% [%directions% %locations%] [(create|make)] [a] fake explosion [%directions% %locations%] [(create|make)] [an] explosion[ ]effect [%directions% %locations%] since: 1.0 Creates an explosion of a given force. The Minecraft Wiki has an article on explosions which lists the explosion forces of TNT, creepers, etc. Use a force of 0 to create a fake explosion that does no damage whatsoever, or use the explosion effect introduced in Skript 2.0. Starting with Bukkit 1.4.5 and Skript 2.0 you can also create "safe explosions" which will damage entities but won't destroy any blocks. examples: create an explosion of force 10 at the player create a fake explosion at the victim Ignite/Extinguish patterns[?]: (ignite|set fire to) %entities% [for %time span%] (set|light) %entities% on fire [for %time span%] extinguish %entities% since: 1.4 Lights entities on fire or extinguishes them. examples: ignite the player extinguish the player Kick patterns[?]: kick %players% [(by reason of|because [of]|on account of|due to) %text%] since: 1.0 Kicks a player from the server. examples: on place of TNT, lava, or obsidian: kick the player due to "You may not place %block%!" cancel the event Kill patterns[?]: kill %entities% since: 1.0 Kills one or more entities. Note: This effect does not set the entity's health to 0 as that would make the entity disappear without the death animation and without dropping any items, but damages the entity by 100 times its maximum health. examples: kill the player kill all creepers in the player's world kill all endermen, witches and bats Lightning patterns[?]: [[ ]effect] %directions% %locations% since: 1.4 Strikes lightning at a given location. You can use 'lightning effect' to create a lightning strike that does not harm entities or start fires (a fake fire block may be created for any client within range though). examples: strike lightning at the player strike lightning effect at the victim Log patterns[?]: log %texts% [(to|in) [file[s]] %texts%] since: 2.0 Writes text into a .log file. Skript will write these files to /plugins/Skript/logs. NB: Using 'server.log' as the log file will write to the default server log. Omitting the log file altogether will log the message as '[Skript] [<script>.sk] <message>' in the server log. examples: on place of TNT: log "%player% placed TNT in %world% at %location of block%" to "tnt/placement.log" Message patterns[?]: (message|send [message]) %texts% [to %players/console%] since: 1.0 Sends a message to the given player. examples: message "A wild %player% appeared!" message "This message is a distraction. Mwahaha!" send "Your kill streak is %{kill streak.%player%}%." to player if the targeted entity exists: message "You're currently looking at a %type of the targeted entity%!" op/deop patterns[?]: [de[-]]op %offline players% since: 1.0 Grant/revoke a user operator status. examples: op the player deop all players Open Inventory patterns[?]: [(open|show) ((crafting [table]|workbench) (view|window|inventory)]|%inventory%) (to|for) %players% close [the] inventory [view] (to|of|for) %players% close %players%'[s] inventory [view] since: 2.0, 2.1.1 (closing) Opens or closes an inventory to a player. If opened, the player can then access and modify the inventory as if it was a chest that he just opened. Closing will close any inventory the player has currently open. Please note that currently 'show' and 'open' have the same effect, but 'show' will eventually show an unmodifiable view of the inventory in the future. examples: show the victim's inventory to the player open the player's inventory for the player close the player's inventory Play Effect patterns[?]: (play|show) %visual effects% (on|%directions%) %entities/locations% [to %players%] since: 2.1 Plays a visual effect at a given location or on a given entity. Please note that some effects can only be played on entities, e..g wolf hearts or the hurt effect, and that these are always visible to all players. examples: play wolf hearts on the clicked wolf show mob spawner flames at the targeted block to the player Poison/Cure patterns[?]: poison %living entities% [for %time span%] (cure|unpoison) %living entities% [(from|of) poison] since: 1.3.2 Poison or cure a creature. examples: poison the player poison the victim for 20 seconds cure the player from poison Potion Effects patterns[?]: apply [potion of] %potions% [potion] [[[of] tier] %number%] to %living entities% [for %time span%] since: 2.0 Apply or remove potion effects to/from entities. examples: apply swiftness 2 to the player remove haste from the victim on join: apply potion of strength of tier {strength.%player%} to the player for 999 days Push patterns[?]: (push|thrust) %entities% %direction% [(at|with) (speed|velocity|force) %number%] since: 1.4.6 Push entities around. examples: push the player upwards push the victim downwards at speed 0.5 PvP patterns[?]: enable PvP [in %worlds%] disable PVP [in %worlds%] since: 1.3.4 Set the PvP status for a given world. examples: enable PvP #(current world only) disable PvP in all worlds Replace patterns[?]: replace [(all|every)] %texts% in %text% with %text% replace [(all|every)] %texts% with %text% in %text% since: 2.0 Replaces all occurrences of a given text with another text. Please note that you can only change variables and a few expressions, e.g. a message or a line of a sign. examples: replace "<item>" in {textvar} with "%tool of player%" replace every "&" with "§" in line 1

  1. The following acts as a simple chat censor, but it will e.g. censor mass, hassle, assassin, etc. as well:

on chat: replace all "fuck", "bitch" and "ass" with "****" in the message Shear patterns[?]: shear %living entities% un[-]shear %living entities% since: 2.0 Shears or 'un-shears' a sheep. Please note that no wool is dropped, this only sets the 'sheared' state of the sheep. examples: on rightclick on a sheep holding a sword: shear the clicked sheep Shoot patterns[?]: shoot %entity types% [from %living entities/locations%] [(at|with) (speed|velocity) %number%] [%direction%] (make|let) %living entities/locations% shoot %entity types% [(at|with) (speed|velocity) %number%] [%direction%] since: 1.4 Shoots a projectile (or any other entity) from a given entity. examples: shoot an arrow make the player shoot a creeper at speed 10 shoot a pig from the creeper Spawn patterns[?]: spawn %entity types% [%directions% %locations%] spawn %number% of %entity types% [%directions% %locations%] since: 1.0 Spawns an entity. examples: spawn 3 creepers at the targeted block spawn a ghast 5 meters above the player Teleport patterns[?]: teleport %entities% (to|%direction%) %location% since: 1.0 Teleports an entity to a specific location. If the location has a yaw or pitch set, the entity will be made facing that direction after the teleport, otherwise the entity will face the same direction as before. examples: teleport the player to {homes.%player%} teleport the attacker to the victim Toggle patterns[?]: (close|turn off|de[-]activate) %blocks% (toggle|switch) [[the] state of] %blocks% (open|turn on|activate) %blocks% since: 1.4 Toggles the state of a block, e.g. switches a lever or opens a door. examples:

  1. use arrows to toggle levers, doors, etc.

on projectile hit:

   projectile is arrow
   toggle the block at the arrow

Tree patterns[?]: (grow|create|generate) tree [of type %tree type%] %directions% %locations% (grow|create|generate) %tree type% [tree] %directions% %locations% since: 1.0 Creates a tree. This may require that there is enough space above the given location and that the block below is dirt/grass, but it is possible that the tree will just grow anyway, possibly replacing every block in its path. examples: grow a tall redwood tree above the clicked block Vehicle patterns[?]: (make|let|force) %entities% [to] (ride|mount) [(in|on)] %entity/entity types% [(make|let|force) %entities% [to] (dismount|(dismount|leave) (from|of)] [(any|the[ir]|his|her)] vehicle[s]) [(eject|dismount) (any|the)] passenger[s] (of|from) %entities% since: 2.0 Makes an entity ride another entity, e.g. a minecart, a saddled pig, an arrow, etc. examples: make the player ride a saddled pig make the attacker ride the victim About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:42

Expressions

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: ExpressionsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents Altitude Amount Amount of Items Argument Arithmetic Armour Slot Attacked Attacker Bed Biome Block Block Sphere Blocks Blocks in Region Chunk Clicked Block/Entity Colour of Coloured / Uncoloured Command Command Sender Compass Target Console Coordinate Creature/Entity/Player/Projectile/Villager/Powered Creeper/etc. Damage Damage Cause Data Value Difference Direction Distance Drops Element of Enchantment Level Ender Chest Entities Experience Facing Food Level Former/Future State Furnace Slot Game Mode Hash Head location Health Id Index Of Inventory IP Item Items Items In Join & Split Last Spawned/Shot Entity Length Level Level Progress Light Level Location Location At Location Of Loop value Lore Max Health Maximum Stack Size Me Message Money Name / Display Name Named Item Now Numbers Parse Parse Error Passenger Prefix/Suffix Random Random Number Region Region Members & Owners Regions At Remaining Air Rounding Script Name Shooter Sign Text Skull Spawn Speed Subtext Target Targeted Block Time Tool Type of UUID Vehicle Version Weather World Worlds X of Item Yaw / Pitch Filter for version:

=>

Expressions are syntax elements that represent a certain object, e.g. a player or a number, or multiple objects, e.g. the server's worlds or a list of blocks. Expressions can be used anywhere where Skript expects a value, e.g. in set {var} to <value> or teleport <entity expression> to <location expression>. The other possibility for values is to use a static value, e.g. ‘6’ or ‘a pickaxe and a shovel’.

There are basically two kinds of expressions: simple expressions, which are usually one or a few words like ‘player’, ‘world’, or ‘last spawned entity’, and are usually event-dependent, i.e. their value will change depending on the event. The ‘player’ expression for example will hold the current event's player, which depends on which player triggered the event. property expressions, which get a value from another expression, e.g. data value of <item>, altitude of <location>, or <entity>'s world. There are a few exceptions though, e.g. distance between <location> and <location> or the direction expression.

Expressions that represent multiple values can be looped to execute some code for each element of the expression with loop <expression>:. Please refer to the loops page for more information. Advanced Starting with Skript 2.0, expressions can be grouped with parentheses to denote their relation, e.g. set {var} to 10 emeralds and an apple or 5 stone is ambiguous while set {var} to 10 emeralds and (an apple or 5 stone) is not (this particular example will even result in a warning if no brackets are used). You should also use brackets when using lists of expressions inside other expressions, e.g. all players in "world" and "world_nether" should be written as all players in ("world" and "world_nether"), as otherwise it might be parsed as (all players in "world") and ("world_nether"). Altitude patterns[?]: [the] altitude[s] of %locations% %locations%'[s] altitude[s] since: 1.4.3 Effectively an alias of 'y-coordinate of …', it represents the height of some object above bedrock. examples: on damage: altitude of the attacker is higher that the altitude of the victim set damage to damage * 1.25 Amount patterns[?]: (amount|number|size) of %objects% since: 1.0 The amount of something. Please note that amount of <items> will not return the number of items, but the number of stacks, e.g. 1 for a stack of 64 torches. examples: message "There are %number of all players% players online!" Amount of Items patterns[?]: [the] (amount|number) of %item types% (in|of) %inventories% since: 2.0 Counts how many of a particular item type are in a given inventory. examples: message "You have %number of ores in the player's inventory% ores in your inventory." Argument patterns[?]: [the] last arg[ument][s] [the] arg[ument][s](-| )<(d+)> [the] <(d*1)st|(d*2)nd|(d*3)rd|(d*[4-90])th> arg[ument][s] [the] arg[ument][s] [the] %*type%( |-)arg[ument][( |-)<d+>] [the] arg[ument]( |-)%*type%[( |-)<d+>] since: 1.0 Only available in command events. Holds the value of the nth argument given to the command, e.g. if the command "/tell " is used like "/tell Njol Hello Njol!", argument 1 is the player named "Njol" and argument 2 is "Hello Njol!". One can also use the type of the argument instead of its index to address the argument, e.g. in the above example 'player-argument' is the same as 'argument 1'. examples: give the item-argument to the player-argument damage the player-argument by the number-argument give a diamond pickaxe to the argument add argument 1 to argument 2 heal the last argument Arithmetic patterns[?]: %number%[ ]+[ ]%number% %number%[ ]-[ ]%number% %number%[ ]*[ ]%number% %number%[ ]/[ ]%number% %number%[ ]^[ ]%number% since: 1.4.2 Arithmetic expressions, e.g. 1+2, (2 - health of player)/3, etc. Available operands are addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (^). Negation is not available yet, use 0 - expr instead. examples: set the player's health to 10 - the player's health loop (argument + 2)/5 times: message "Two useless numbers: %loop-num*2 - 5%, %2^loop-num - 1%" message "You have %health of player * 2% half hearts of HP!" Armour Slot patterns[?]: [the] (boot[s]|shoe[s]|leg[ging][s]|chestplate[s]|helm[et][s]) [slot] of %living entities% %living entities%'[s] (boot[s]|shoe[s]|leg[ging][s]|chestplate[s]|helm[et][s]) [slot] since: 1.0 A part of a player's armour, i.e. the boots, leggings, chestplate or helmet. As of Skript 2.1 this expression can be used for mobs as well, e.g. to equip zombies with armour. examples: set chestplate of the player to a diamond chestplate helmet of player is neither a helmet nor air # player is wearing a block, e.g. from another plugin Attacked patterns[?]: [the] (attacked|damaged|victim) [<(.+)>] since: 1.3 The victim of a damage event, e.g. when a player attacks a zombie this expression represents the zombie. examples: on damage: victim is a creeper damage the attacked creeper by 1 heart Attacker patterns[?]: [the] (attacker|damager) since: 1.3 The attacker of a damage event, e.g. when a player attacks a zombie this expression represents the player. Please note that the attacker can also be a block, e.g. a cactus or lava, but this expression will not be set in these cases. examples: on damage: attacker is a player health of attacker is less than or equal to 2 damage victim by 1 heart Bed patterns[?]: [the] bed[s] [location[s]] of %players% %players%'[s] bed[s] [location[s]] since: 2.0 The bed location of a player, i.e. the spawn point of a player if he ever slept in a bed and the bed still exists and is unobstructed. examples: bed of player exists: teleport player the the player's bed else: teleport the player to the world's spawn point Biome patterns[?]: [the] biome (of|%direction%) %location% %location%'[s] biome since: 1.4.4 The biome at a certain location. Please note that biomes are only defined for x/z-columns, i.e. the altitude (y-coordinate) doesn't matter. examples:

  1. damage player in deserts constantly

every real second: loop all players: biome at loop-player is desert damage the loop-player by 1 Block patterns[?]: [the] [event-]block [the] block %direction% [%location%] since: 1.0 The block involved in an event, e.g. the clicked block or the placed block. Can optionally include a direction as well, e.g. 'block above' or 'block in front of the player'. examples: block is ore set block below to air spawn a creeper above the block loop blocks in radius 4: loop-block is obsidian set loop-block to water block is a chest: clear the inventory of the block Block Sphere patterns[?]: [(all|the)] blocks in radius %number% [(of|around) %location%] [(all|the)] blocks around %location% in radius %number% since: 1.0 All blocks in a sphere around a center, mostly useful for looping. examples: loop blocks in radius 5 around the player: set loop-block to air set all blocks in radius 5 around the player to air Blocks patterns[?]: [the] blocks %direction% [%locations%] [the] blocks from %location% [on] %direction% [the] blocks from %block% to %block% [the] blocks between %block% and %block% since: 1.0 Blocks relative to other blocks or between other blocks. Can be used to get blocks relative to other blocks or for looping. examples: loop blocks above the player: loop blocks between the block below the player and the targeted block: set the blocks below (the player, the victim and the targeted block) to air Blocks in Region patterns[?]: cannot be used directly since: 2.1 All blocks in a region. This expression requires a supported regions plugin to be installed. examples: loop all blocks in the region {arena.%{faction.%player%}%}: clear the loop-block Chunk patterns[?]: [the] chunk[s] (of|%directions%) %locations% %locations%'[s] chunk[s] since: 2.0 The chunk a block, location or entity is in. examples: add the chunk at the player to {protected chunks::*} Clicked Block/Entity patterns[?]: [the] clicked (block|%*item type/entity type%) since: 1.0 Only available in click events: Represents the clicked block or entity. examples: message "You clicked on a %type of clicked entity%!" clicked block is a chest: show the inventory of the clicked block to the player Colour of patterns[?]: [the] colo[u]r[s] of %item stacks/entities% %item stacks/entities%'[s] colo[u]r[s] since: 1.2 The colour of an item, can also be used to colour chat messages with "<%colour of ...%>this text is coloured!". examples: on click on wool: message "This wool block is <%colour of block%>%colour of block%<reset>!" set the colour of the block to black Coloured / Uncoloured patterns[?]: (colo[u]r-|colo[u]red )%texts% (un|non)[-](colo[u]r-|colo[u]red )%texts% since: 2.0 Parses <colour>s (including chat styles) in a message or removes any colours & chat styles from the message. This expression replaces localised colours & chat styles, i.e. it doesn't replace english ones, which makes it appropriate to colour command arguments and chat messages. examples: on chat: set message to coloured message command /fade <player>: trigger: set display name of the player-argument to uncoloured display name of the player-argument Command patterns[?]: [the] (full|complete|whole) command [the] command [label] [the] arguments since: 2.0 The command that caused an 'on command' event (excluding the leading slash and all arguments). Use 'full command' for the command including arguments, or 'arguments' for the arguments only. Please note that this event is not adequate for creating custom commands. See the article on custom commands to find out how to define new commands. examples:

  1. prevent any commands except for the /exit command during some game

on command: {game.%player%.is playing} is true command is not "exit" message "You're not allowed to use commands during the game" cancel the event Command Sender patterns[?]: [the] [command['s]] (sender|executor) since: 2.0 The player or the console who sent a command. Mostly useful in commands and command events. examples: make the command sender execute "/say hi!" on command: log "%executor% used command /%command% %arguments%" to "commands.log" Compass Target patterns[?]: [the] compass target of %players% %players%'[s] compass target since: 2.0 The location a player's compass is pointing at. Please note that wile you can set a player's compass target to an entity, it will actually be set to the location of the entity at the time when the effect is executed, and thus the compass won't automatically follow the entity. examples:

  1. make all player's compasses target a player stored in {compass target.%player%}

every 5 seconds: loop all players: set the loop-player's compass target to location of {compass target.%loop-player%} Console patterns[?]: [the] (console|server) since: 1.3.1 Represents the server's console which can receive messages and execute commands. examples: execute console command "/stop" send "message to console" to the console Coordinate patterns[?]: [the] (x|y|z)(-| )(coord[inate]|pos[ition]|loc[ation])[s] of %locations% %locations%'[s] (x|y|z)(-| )(coord[inate]|pos[ition]|loc[ation])[s] since: 1.4.3 Represents a given coordinate of a location. examples: player's y-coordinate is smaller than 40: message "Watch out for lava!" Creature/Entity/Player/Projectile/Villager/Powered Creeper/etc. patterns[?]: [the] [event-]<.+> since: 1.0 The entity involved in an event (an entity is a player, a creature or an inanimate object like ignited TNT, a dropped item or an arrow). You can use the specific type of the entity that's involved in the event, e.g. in a 'death of a creeper' event you can use 'the creeper' instead of 'the entity'. examples: give a diamond sword of sharpness 3 to the player kill the creeper kill all powered creepers in the wolf's world projectile is an arrow Damage patterns[?]: [the] damage since: 1.3.5 How much damage is done in a damage event, possibly ignoring armour, criticals and/or enchantments. Can be changed (remember that in Skript '1' is one full heart, not half a heart). examples: increase the damage by 2 Damage Cause patterns[?]: [the] damage (cause|type) since: 2.0 The damage cause of a damage event. Please click on the link for more information. examples: damage cause is lava, fire or burning Data Value patterns[?]: [the] ((data|damage)[s] [value[s]]|durabilit(y|ies)) of %item stacks/slots% %item stacks/slots%'[s] ((data|damage)[s] [value[s]]|durabilit(y|ies)) since: 1.2 The data value of an item. You usually don't need this expression as you can check and set items with aliases easily, but this expression can e.g. be used to "add 1 to data of <item>", e.g. for cycling through all wool colours. examples: add 1 to the data value of the clicked block Difference patterns[?]: difference (between|of) %object% and %object% since: 1.4 The difference between two values, e.g. numbers, dates or times. Use distance for locations. examples: difference between {command.%player%.lastuse} and now is smaller than a minute:

 message "You have to wait a minute before using this command again!"
 stop

Direction patterns[?]: [%number% [(north[(east|west)][(south[(east|west)][(east|west)[(above|over|up|down)[ward(below|under[neath]|beneath) [%direction%] [%number% [[(direction|horizontal direction|facing|horizontal facing) of %entity/block% (of|from)] [%number% [[(direction|horizontal direction|facing|horizontal facing) (of|from)] [%number% [(in[ ]front [of]|forward[s]|behind|backwards|right|left) [of]) [%number% [(in[ ]front [of]|forward[s]|behind|backwards|right|left) [of]) since: 1.0 (basic), 2.0 (extended) A helper expression for the direction type. examples: thrust the player upwards set the block behind the player to water loop blocks above the player: set {_rand} to a random integer between 1 and 10 set the block {_rand} meters south east of the loop-block to stone block in horizontal facing of the clicked entity from the player is air spawn a creeper 1.5 meters horizontally behind the player spawn a TNT 5 meters above and 2 meters horizontally behind the player thrust the last spawned TNT in the horizontal direction of the player with speed 0.2 push the player upwards and horizontally forward at speed 0.5 push the clicked entity in in the direction of the player at speed -0.5 open the inventory of the block 2 blocks below the player to the player teleport the clicked entity behind the player grow a regular tree 2 meters horizontally behind the player Distance patterns[?]: [the] distance between %location% and %location% since: 1.0 The distance between two points, measured in meters (i.e. blocks). Like in other expressions, the location of a block is understood to be at its center, while the location of an entity is usually at its feet. examples: distance between the player and {%player%.home} is smaller than 20: message "You're very close to your home!" Drops patterns[?]: [the] drops since: 1.0 Only available in death events: Represents the drops of the dying creature. Drops can be prevented from dropping by removing them with "remove ... from drops", e.g. "remove all pickaxes from the drops", or "clear drops" if you don't want any drops at all. examples: clear drops remove 4 planks from the drops Element of patterns[?]: ([the] first|[the] last|[a] random) element [out] of %objects% since: 2.0 The first, last or a random element of a set, e.g. a list variable. See also: random examples: give a random element out of {free items::*} to the player Enchantment Level patterns[?]: [the] (%enchantment% level|level of [[the] enchant[ment]] %enchantment%) o(f|n) %item types% %item types%'[s] (%enchantment% level|level of [[the] enchant[ment]] %enchantment%) since: 2.0 The level of a particular enchantment on an item examples: player' tool is a sword of sharpness: message "You have a sword of sharpness %level of sharpness of the player's tool% equipped" Ender Chest patterns[?]: [the] ender[ ]chest[s] of %players% %players%'[s] ender[ ]chest[s] since: 2.0 The ender chest of a player. This can be used wherever an inventory can be used, in particular its items can be modified, and it can be shown to any player (not only the owning player). examples: open the player's ender chest to the player Entities patterns[?]: [all] %*entity types% [(in|of) [world[s]] %worlds%] [all] entities of type[s] %entity types% [(in|of) [world[s]] %worlds%] [all] %*entity types% (within|[with]in radius) %number% [(block[s]|met(er|re)[s])] (of|around) %location% [all] entities of type[s] %entity types% in radius %number% (of|around) %location% since: 1.2.1 All entities in all world, in a specific world or in a radius around a certain location, e.g. 'all players', 'all creepers in the player's world', or 'players in radius 100 of the player'. examples: kill all creepers in the player's world send "Psst!" to all players witin 100 meters of the player give a diamond to all ops heal all tamed wolves in radius 2000 around {town center} Experience patterns[?]: [the] [(spawned|dropped)] [e]xp[erience] [orb[s]] since: 2.1 How much experience was spawned in an experience spawn event. Can be changed. examples: on experience spawn: add 5 to the spawned experience Facing patterns[?]: [the] [horizontal] facing of %living entities/blocks% %living entities/blocks%'[s] [horizontal] facing since: 1.4 The facing of an entity or block, i.e. exactly north, south, east, west, up or down (unlike direction which is the exact direction, e.g. '0.5 south and 0.7 east') examples:

  1. makes a bridge

loop blocks from the block below the player in the horizontal facing of the player: set block to cobblestone Food Level patterns[?]: [the] (food|hunger)[[ ](level|met(er|re)|bar)] [of %player%] %player%'[s] (food|hunger)[[ ](level|met(er|re)|bar)] since: 1.0 The food level of a player from 0 to 10. Has several aliases: food/hunger level/meter/bar. examples: set the player's food level to 10 Former/Future State patterns[?]: [the] (former|past|old) [state] [of] %~object% %~object% before [the event] [the] (future|to-be|new) [state] [of] %~object% %~object%(-to-be| after[(wards| the event)]) since: 1.1 Represents the value of an expression before an event happened or the value it will have directly after the event, e.g. the old or new level respectively in a level change event. Note: The past, future and present states of an expression are sometimes called 'time states' of an expression. Note 2: If you don't specify whether to use the past or future state of an expression that has different values, its default value will be used which is usually the value after the event. examples: on teleport: former world was "world_nether" # or 'world was' world will be "world" # or 'world after the event is' on tool change: past tool is an axe the tool after the event will be air on weather change: set {weather.%world%.old} to past weather set {weather.%world%.current} to the new weather Furnace Slot patterns[?]: [the] (ore|fuel|result)[s] [slot[s]] of %blocks% %blocks%'[s] (ore|fuel|result)[s] [slot[s]] since: 1.0 A slot of a furnace, i.e. either the ore, fuel or result slot. Remember to use 'block' and not 'furnace', as 'furnace' is not an existing expression. examples: set the fuel slot of the clicked block to a lava bucket set the block's ore slot to 64 iron ore give the result of the block to the player clear the result slot of the block Game Mode patterns[?]: [the] game[ ]mode of %players% %players%'[s] game[ ]mode since: 1.0 The game mode of a player, which can be either survival, creative, or adventure. examples: player's gamemode is survival set the player's gamemode to creative Hash patterns[?]: [md5][( |-)hash(ed|[( |-)]code] of) %texts% since: 2.0 Hashes the given text using the MD5 algorithm. This is useful for storing passwords or IP addresses without having to store them literally. Please note that an MD5 hash is irreversible, i.e. you won't be able to get the original text back (which is the point of storing passwords like this). Brute force and rainbow table attacks can still be performed on hashes though which can easily crack short or insecure passwords. examples: command /setpass <text>: trigger: set {password.%player%} to hashed text-argument command /login <text>: trigger: {password.%player%} is hashed text-argument: message "login successful." else: message "wrong password!" Head location patterns[?]: [the] (head|eye[s]) [location[s]] of %living entities% %living entities%'[s] (head|eye[s]) [location[s]] since: 2.0 The location of an entity's head, mostly useful for players and e.g. looping blocks in the player's line of sight. Please note that this location is only accurate for entities whose head is exactly above their center, i.e. players, endermen, zombies, skeletons, etc., but not sheep, pigs or cows. examples: set the block at the player's head to air set the block in front of the player's eyes to glass loop blocks in front of the player's head: Health patterns[?]: [the] health of %living entities% %living entities%'[s] health since: 1.0 The health of a creature, e.g. a player, mob, villager, etc. from 0 to the creature's max health, e.g. 10 for players. examples: message "You have %health% HP left." Id patterns[?]: [the] id[s] of %item type% %item type%'[s] id[s] since: 1.0 The id of a specific item. You usually don't need this expression as you can likely do everything with aliases. examples: message "the ID of %type of the clicked block% is %id of the clicked block%." Index Of patterns[?]: [the] [(first|last)] index of %text% in %text% since: 2.1 The first of last index of a character (or text) in a text, or -1 if it doesn't occur in the text. Indices range from 1 to the length of the text. examples: set {_@} to the first index of "@" in the text argument if {_s} contains "abc": set {_s} to the first (index of "abc" in {_s} + 3) characters of {_s} # removes everything after the first "abc" from {_s} Inventory patterns[?]: [the] inventor(y|ies) of %inventoryholders% %inventoryholders%'[s] inventor(y|ies) since: 1.0 The inventory of a block or player. You can usually omit this expression and can directly add or remove items to/from blocks or players. examples: add a plank to the player's inventory clear the player's inventory remove 5 wool from the inventory of the clicked block IP patterns[?]: IP[s][( |-)address[es]] of %players% %players%'[s] IP[s][( |-)address[es]] since: 1.4 The IP address of a player. examples: IP-ban the player # is equal to the next line ban the IP-address of the player broadcast "Banned the IP %IP of player%" Item patterns[?]: [the] item since: unknown The item involved in an event, e.g. in a drop, dispense, pickup or craft event. examples: on dispense: item is a clock set the time to 6:00 Items patterns[?]: [(all|every)] item(s|[ ]types) items of type[s] %item types% [(all|every)] block(s|[ ]types) blocks of type[s] %item types% since: unknown Items or blocks of a specific type, useful for looping. examples: loop items of type ore and log: block contains loop-item message "There's at least one %loop-item% in this block" stop loop drop all blocks at the player # drops one of every block at the player Items In patterns[?]: [all] items (inventor(y|ies)) %inventories% since: 2.0 All items in an inventory. Useful for looping or storing in a list variable. Please note that the positions of the items in the inventory are not saved, only their order is preserved. examples: loop all items in the player's inventory: loop-item is enchanted remove loop-item from the player set {inventory.%player%::*} to items in the player's inventory Join & Split patterns[?]: (concat[enate]|join) %texts% [(with|using|by) [[the] delimiter] %text%] split %text% (at|using|by) [[the] delimiter] %text% %text% [split] (at|using|by) [[the] delimiter] %text% since: 2.1 Joins several texts with a common delimiter (e.g. ", "), or splits a text into multiple texts at a given delimiter. examples: message "Online players: %join all players with " | "%" # %all players% would use the default "x, y, and z" set {_s::} to the string argument split at "," Last Spawned/Shot Entity patterns[?]: [the] [last[ly]] (spawned|shot) %*entity type% since: 1.3 (spawned entity), 2.0 (shot entity) Holds the entity that was spawned most recently with the spawn effect, or shot with the shoot effect. Please note that even though you can spawn multiple mobs simultaneously (e.g. with 'spawn 5 creepers'), only the last spawned mob is saved and can be used. If you spawn an entity and shoot a projectile you can however access both. examples: spawn a priest set {%spawned priest%.healer} to true shoot an arrow from the last spawned entity ignite the shot projectile Length patterns[?]: [the] length of %texts% %texts%'[s] length since: 2.1 The length of a text, in number of characters. examples: set {_l} to length of the string argument Level patterns[?]: [the] level of %players% %players%'[s] level since: unknown The level of a player. examples: reduce the victim's level by 1 set the player's level to 0 Level Progress patterns[?]: [the] level progress of %players% %players%'[s] level progress since: 2.0 The progress a player has made until the next level. Remember that this value is between 0 and 1, not 0 and 100! Changing this value can cause a player's level to change if the resulting level progess is negative or larger than 1, e.g.increase the player's level progress by 0.5 will make the player gain a level if his progress was more than 50%. examples:

  1. use the exp bar as mana

on rightclick with a blaze rod: player's level progress is larger than 0.2 shoot a fireball from the player reduce the player's level progress by 0.2 every 2 seconds: loop all players: level progress of loop-player is smaller than 0.9: increase level progress of the loop-player by 0.1 else: set level progress of the loop-player to 0.99 on xp spawn: cancel event Light Level patterns[?]: [(sky|sun|block)[ ]]light[ ]level [(of|%direction%) %location%] since: 1.3.4 Gets the light level at a certain location which ranges from 0 to 15. It can be separated into sunlight (15 = direct sunlight, 1-14 = indirect) and block light (torches, glowstone, etc.). The total light level of a block is the maximum of the two different light types. examples:

  1. set vampire players standing in bright sunlight on fire

every 5 seconds: loop all players: {vampire.%loop-player%} is true sunlight level at the loop-player is greater than 10 ignite the loop-player for 5 seconds Location patterns[?]: [the] [event-](location|position) [the] (location|position) %direction% [%location%] since: 2.0 The location where an event happened (e.g. at an entity or block), or a location relative to another (e.g. 1 meter above another location). examples: drop 5 apples at the event-location # exactly the same as writing 'drop 5 apples' set {_loc} to the location 1 meter above the player Location At patterns[?]: [the] (location|position) [at] [(][x[ ][=[ ]]]%number%, [y[ ][=[ ]]]%number%, [and] [z[ ][=[ ]]]%number%[)] [[(in|of) [[the] world]] %world%] since: 2.0 Allows to create a location from three coordinates and a world. This expression is currently not parsed correctly, and there is no ETA on a fix yet. examples: set {_loc} to the location at arg-1, arg-2, arg-3 of the world arg-4 distance between the player and the location (0, 0, 0) is less than 200 Location Of patterns[?]: (location|position) of %location% %location%'[s] (location|position) since: unknown The location of a block or entity. This not only represents the x, y and z coordinates of the location but also includes the world and the direction an entity is looking (e.g. teleporting to a saved location will make the teleported entity face the same saved direction every time). Please note that the location of an entity is at its feet, use the head location to get the location of the head. examples: set {home.%player%} to the location of the player message "Your home was set to %player's location% in %player's world%." Loop value patterns[?]: [the] loop-<.+> since: 1.0 The currently looped value. examples:

  1. countdown:

loop 10 times: message "%11 - loop-number%" wait a second

  1. generate a 10x10 floor made of randomly coloured wool below the player:

loop blocks from the block below the player to the block 10 east of the block below the player: loop blocks from the loop-block to the block 10 north of the loop-block: set loop-block-2 to any wool Lore patterns[?]: [the] line %number% of [the] lore of [%item stack/item type%] [the] line %number% of %item stack/item type%'[s] lore [the] %number%(st|nd|rd|th) line of [the] lore of [%item stack/item type%] [the] %number%(st|nd|rd|th) line of %item stack/item type%'[s] lore since: 2.1 An item's lore. examples: set the 1st line of the item's lore to "<orange>Excalibur 2.0" Max Health patterns[?]: [the] max[imum] health of %living entities% %living entities%'[s] max[imum] health since: 2.0 The maximum health of an entity, e.g. 10 for a player examples: on join: set the maximum health of the player to 100 spawn a giant set the last spawned entity's max health to 1000 Maximum Stack Size patterns[?]: [the] max[imum] stack[[ ]size] of %item stack% %item stack%'[s] max[imum] stack[[ ]size] since: 2.1 The maximum stack size of the specified material, e.g. 64 for torches, 16 for buckets, and 1 for swords. examples: send "You can only pick up %max stack size of player's tool% of %type of (player's tool)%" to player Me patterns[?]: me my[self] since: 2.1.1 A 'me' expression that can be used in effect commands only. examples: !heal me !kick myself !give a diamond axe to me Message patterns[?]: [the] [chat( |-)]message [the] (join|log[ ]in)( |-)message [the] (quit|leave|log[ ]out|kick)( |-)message [the] death( |-)message since: 1.4.6 (chat message), 1.4.9 (join & quit messages), 2.0 (death message) The (chat) message of a chat event, the join message of a join event, the quit message of a quit event, or the death message on a death event. This expression is mostly useful for being changed. examples: on chat: player has permission "admin" set message to "<red>%message%"

on first join: set join message to "Welcome %player% to our awesome server!" on join: player has played before set join message to "Welcome back, %player%!"

on quit: set quit message to "%player% left this awesome server!"

on death: set the death message to "%player% died!" Money patterns[?]: cannot be used directly since: 2.0 How much virtual money a player has (can be changed).

Like all economy elements, this expression requires that Vault and a compatible economy plugin is installed. examples: message "You have %player's money%" # the currency name will be added automatically remove 20$ from the player's balance # replace '$' by whatever currency you use add 200 to the player's account # or omit the currency alltogether Name / Display Name patterns[?]: [the] (player|tab)[ ]list name[s] of %players% %players%'[s] (player|tab)[ ]list name[s] [the] (display|nick|chat)[ ]name[s] of %slots/item stacks/living entities/players% %slots/item stacks/living entities/players%'[s] (display|nick|chat)[ ]name[s] [the] name[s] of %slots/item stacks/living entities/players% %slots/item stacks/living entities/players%'[s] name[s] since: 1.4.6 (players' name & display name), unknown (player list name), 2.0 (item name) Represents a player's minecraft account name, chat display name, or playerlist name, or the custom name of an item or a living entity.

The differences between the different names are: name: Minecraft account name of a player (unmodifiable), or the custom name of an item or mob (modifiable). display name: The name of a player as displayed in the chat. This name can be changed freely and can include colour codes, and is shared among all plugins (e.g. chat plugins will use a changed name). tab list name: The name of a player used in the player list that usually opens with the tab key. Please note that this is limited to 16 characters, including colour codes which are counted as 2 characters each, and that no two players can have the same tab list name at the same time. Starting with Skript 2.1, the name and display name of entities have a different meaning: 'Name' sets the entity's name like a name tag does, while 'display name' will not only set the entity's name, but will also make it visible through blocks just like players' names. examples: on join: player has permission "name.red" set the player's display name to "<red>[admin]<gold>%name of player%" set the player's tablist name to "<green>%name of player%" set the name of the player's tool to "Legendary Sword of Awesomeness" Named Item patterns[?]: %item types% (named|with name[s]) %text% since: 2.0 Directly names an item, useful for defining a named item in a script. If you want to (re)name existing items you can either use this expression or use set name of <item> to <text>. examples: give a diamond sword of sharpness 100 named "<gold>Excalibur" to the player set tool of player to the player's tool named "<gold>Wand" set the name of the player's tool to "<gold>Wand" Now patterns[?]: now since: 1.4 The current system time of the server. Use time to get the Minecraft time of a world. examples: broadcast "Current server time: %now%" Numbers patterns[?]: [(integers) (between|from) %number% (and|to) %number% %number% times since: 1.4.6 All numbers between two given numbers, useful for looping. Use 'numbers' if your start is not an integer and you want to keep the fractional part of the start number constant, or use 'integers' if you only want to loop integers. An integer loop from 1 to a number x can also be written as 'loop x times'. examples: loop 5 times: # loops 1, 2, 3, 4, 5 loop numbers from 2.5 to 5.5: # loops 2.5, 3.5, 4.5, 5.5 loop integers from 2.9 to 5.1: # same as '3 to 5', i.e. loops 3, 4, 5 Parse patterns[?]: %text% parsed as (%*type%|"<.*>") since: 2.0 Parses text as a given type, or as a given pattern. This expression can be used in two different ways: One which parses the entire text as a single instance of a type, e.g. as a number, and one that parses the text according to a pattern. If the given text could not be parsed, this expression will return nothing and the parse error will be set if some information is available. Some notes about parsing with a pattern: - The pattern must be a Skript pattern, e.g. percent signs are used to define where to parse which types, e.g. put a %number% or %items% in the pattern if you expect a number or some items there. - You have to save the expression's value in a list variable, e.g. set {parsed::*} to message parsed as "...". - The list variable will contain the parsed values from all %types% in the pattern in order. If a type was plural, e.g. %items%, the variable's value at the respective index will be a list variable, e.g. the values will be stored in {parsed::1::*}, not {parsed::1}. examples: set {var} to line 1 parsed as number on chat: set {var::*} to message parsed as "buying %items% for %money%" if parse error is set: message "%parse error%" else if {var::*} is set: cancel event remove {var::2} from the player's balance give {var::1::*} to the player Parse Error patterns[?]: [the] [last] [parse] error since: 2.0 The error which caused the last parse operation to fail, which might not be set if a pattern was used and the pattern didn't match the provided text at all. examples: set {var} to line 1 parsed as integer if {var} is not set: parse error is set: message "<red>Line 1 is invalid: %last parse error%" else: message "<red>Please put an integer on line 1!" Passenger patterns[?]: [the] passenger[s] of %entities% %entities%'[s] passenger[s] since: 2.0 The passenger of a vehicle, or the rider of a mob.

See also: vehicle (expression), vehicle (effect) examples: passenger of the minecart is a creeper or a cow the saddled pig's passenger is a player Prefix/Suffix patterns[?]: cannot be used directly since: 2.0 The prefix or suffix as defined in the server's chat plugin. examples: on chat: cancel event broadcast "%player's prefix%%player's display name%%player's suffix%: %message%" to the player's world set the player's prefix to "[<red>Admin<reset>] " Random patterns[?]: [a] random %*type% [out] of %objects% since: 1.4.9 Gets a random item out of a set, e.g. a random player out of all players online. examples: give a diamond to a random player out of all players give a random item out of all items to the player Random Number patterns[?]: [a] random (integer|number) (from|between) %number% (to|and) %number% since: 1.4 A random number or integer between two given numbers. Use 'number' if you want any number with decimal parts, or use use 'integer' if you only want whole numbers. Please note that the order of the numbers doesn't matter, i.e. random number between 2 and 1 will work as well as random number between 1 and 2. examples: set the player's health to a random number between 5 and 10 send "You rolled a %random integer from 1 to 6%!" to the player Region patterns[?]: cannot be used directly since: 2.1 The region involved in an event. This expression requires a supported regions plugin to be installed. examples: on region enter: region is {forbidden region} cancel the event Region Members & Owners patterns[?]: cannot be used directly since: 2.1 A list of members or owners of a region. This expression requires a supported regions plugin to be installed. examples: on entering of a region: message "You're entering %region% whose owners are %owners of region%". Regions At patterns[?]: cannot be used directly since: 2.1 All regions at a particular location. This expression requires a supported regions plugin to be installed. examples: On click on a sign: line 1 of the clicked block is "[region info]" set {_regions::*} to regions at the clicked block if {_regions::*} is empty: message "No regions exist at this sign." else: message "Regions containing this sign: <gold>%{_regions::*}%<r>." Remaining Air patterns[?]: [the] remaining air of %living entities% %living entities%'[s] remaining air since: unknown How much time a player has left underwater before starting to drown. examples: player's remaining air is less than 3 seconds: send "hurry, get to the surface!" to the player Rounding patterns[?]: floor(%number%) [(a|the)] round[ed] down %number% round(%number%) [(a|the)] round[ed] %number% ceil[ing](%number%) [(a|the)] round[ed] up %number% since: 2.0 Rounds numbers normally, up (ceiling) or down (floor) respectively. examples: set {var} to rounded health of player set line 1 of the block to round(1.5 * player's level) set {_x} to floor({_y}) - ceil({_x}) add rounded down argument to the player's health Script Name patterns[?]: [the] script[['s] name] since: 2.0 Holds the current script's name (the file name without '.sk'). examples: on script load: set {running.%script%} to true on script unload: set {running.%script%} to false Shooter patterns[?]: [the] shooter [of %projectile%] since: 1.3.7 The shooter of a projectile. As of Skript 2.1, this can be changed to fake the shooter of the projectile. examples: shooter is a skeleton add 1 to {game.points.%shooter of {game.ball}%} Sign Text patterns[?]: [the] line %number% [of %block%] [the] (1st|first|2nd|second|3rd|third|4th|fourth) line [of %block%] since: 1.3 A line of text on a sign. Can be changed, but remember that there is a 16 character limit per line (including colour codes that use 2 characters each). examples: on rightclick on sign: line 2 of the clicked block is "[Heal]": heal the player set line 3 to "%player%" Skull patterns[?]: [the] skull of %offline players/entities/entity types% %offline players/entities/entity types%'[s] skull since: 2.0 Gets a skull item representing a player or an entity. examples: give the victim's skull to the attacker set the block at the entity to the entity's skull Spawn patterns[?]: [the] spawn[s] [(point|location)[s]] [of %worlds%] %worlds%'[s] spawn[s] [(point|location)[s]] since: 1.4.2 The spawnpoint of a world. examples: teleport all players to spawn set the spawn point of "world" to the player's location Speed patterns[?]: [the] (walk[ing]|fl(y[ing]|ight))[( |-])speed of %players% %players%'[s] (walk[ing]|fl(y[ing]|ight))[( |-])speed since: unknown A player's walking or flying speed. Both can be changed, but values must be between -1 and 1 (excessive values will be changed to -1 or 1 respectively). Negative values reverse directions. Please note that changing a player's speed will change his FOV just like potions do. The default values are 0.2 for walk speed, and 0.1 for fly speed. examples: set the player's walk speed to 1 increase the argument's fly speed by 0.1 set the walk speed of the player to 0-(the player's walk speed) # reverses the player's speed Subtext patterns[?]: [the] [(part|sub[ ](text|string)) of %texts% (between|from) (ind(ex|ices)|character[s])] %number% [(and|to) (index|character)] %number% [the] (first|last) [%number%] character[s] of %texts% [the] %number% (first|last) characters of %texts% since: 2.1 Extracts part of a text. You can either get the first <x> characters, the last <x> characters, or the characters between indices <x> and <y>. The indices <x> and <y> should be between 1 and the length of the text (other values will be fit into this range). examples: set {_s} to the first 5 characters of the text argument message "%subtext of {_s} from characters 2 to (the length of {_s} - 1)%" # removes the first and last character from {_s} and sends it to the player or console Target patterns[?]: [the] target[[ed] %*entity type%] [of %living entities%] %living entities%'[s] target[[ed] %*entity type%] since: unknown For players this is the entity at the crosshair, while for mobs and experience orbs it represents the entity they are attacking/following (if any). examples: on entity target:

   entity's target is a player
   send "You're being followed by an %entity%!" to target of entity

Targeted Block patterns[?]: [the] target[ed] block[s] [of %players%] %players%'[s] target[ed] block[s] [the] actual[ly] target[ed] block[s] [of %players%] %players%'[s] actual[ly] target[ed] block[s] since: 1.0 The block at the crosshair. This regards all blocks that are not air as fully opaque, e.g. torches will be like a solid stone block for this expression. examples:

  1. A command to set the block a player looks at to a specific type:

command /setblock <material>:

   trigger:
       set targeted block to argument

Time patterns[?]: [the] time [(in|of) %worlds%] %worlds%'[s] time since: 1.0 The time of a world. examples: time in world is between 18:00 and 6:00: broadcast "It's night-time, watch out for monsters!" Tool patterns[?]: [the] (tool|held item|weapon) [of %living entities%] %living entities%'[s] (tool|held item|weapon) since: 1.0 The item a player is holding. As of Skript 2.1 this expression can also be used for mobs, e.g. to change the weapon of a zombie. examples: player is holding a pickaxe

  1. is the same as

player's tool is a pickaxe Type of patterns[?]: [the] type of %entity types/item stacks% %entity types/item stacks%'[s] type since: 1.4 The type of a block, item, or entity. The type of an item is only its id and data value, i.e. it ignores the amount, enchantments etc., and the type of an entity is e.g. 'wolf' or 'player'. examples: on rightclick on an entity: message "This is a %type of clicked entity%!" UUID patterns[?]: [the] UUID of %players/worlds% %players/worlds%'[s] UUID since: 2.1.2 The UUID of a player or world. In the future there will be an option to use a player's UUID instead of the name in variable names (i.e. when %player% is used), but for now this can be used. Please note that this expression does not work for offline players! examples:

  1. prevents people from joining the server if they use the name of a player
  2. who has played on this server at least once since this script has been added

on login: {uuids.%name of player%} exists: {uuids.%name of player%} is not UUID of player kick player due to "Someone with your name has played on this server before" else: set {uuids.%name of player%} to UUID of player Vehicle patterns[?]: [the] vehicle[s] of %entities% %entities%'[s] vehicle[s] since: 2.0 The vehicle an entity is in, if any. This can actually be any entity, e.g. spider jockeys are skeletons that ride on a spider, so the spider is the 'vehicle' of the skeleton. See also: passenger examples: vehicle of the player is a minecart Version patterns[?]: ([craft]bukkit|minecraft|skript)( |-)version since: 2.0 The version of Bukkit, Minecraft or Skript respectively. examples: message "This server is running Minecraft %minecraft version% on Bukkit %bukkit version%" message "This server is powered by Skript %skript version%" Weather patterns[?]: [the] weather [(in|of) %worlds%] %worlds%'[s] weather since: 1.0 The weather in the given or the current world. examples: set weather to clear weather in "world" is rainy World patterns[?]: [the] world [of %entity/location%] %entity/location%'[s] world since: 1.0 The world the event occurred in. examples: world is "world_nether" teleport the player to the world's spawn set the weather in the player's world to rain Worlds patterns[?]: [(the|all)] worlds since: 1.0 All worlds of the server, useful for looping. examples: loop all worlds: broadcast "You're in %loop-world%" to loop-world X of Item patterns[?]: %number% of %item stacks/entity type% since: 1.2 An expression to be able to use a certain amount of items where the amount can be any expression. Please note that is expression is not stable and might be replaced in the future. examples: give level of player of pickaxes to the player Yaw / Pitch patterns[?]: [the] (yaw|pitch) of %locations% %locations%'[s] (yaw|pitch) since: 2.0 The yaw or pitch of a location, in degrees. examples: log "%player%: %location of player%, %player's yaw%, %player's pitch%" to "playerlocs.log" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:43

Loops

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: LoopsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables A Loop is a construct that repeats code for multiple values. A typical loop looks like this: loop <expression to loop>: <condition(s)> <effect(s)> A loop will loop through all elements of the given expression, e.g. all players, worlds, items, etc. The conditions & effects inside the loop will be executed for every of those elements, which can be accessed with ‘loop-<what>’, e.g. send "hello" to loop-player. When a condition inside a loop is not fulfilled the loop will start over with the next element of the loop. You can however use stop loop to exit the loop completely and resume code execution after the end of the loop.

Simple loops can often be replaced with a single condition or effect by including the looped expression in it, e.g. use give a torch to all players instead of looping all players and giving them a torch individually. Loopable Values All expressions that represent more than one value, e.g. ‘all players’, ‘worlds’, etc., as well as list variables, can be looped. You can also use a list of expressions, e.g. loop the victim and the attacker, to execute the same code for only a few values. List Variables When looping list variables, you can also use loop-index in addition to loop-value inside the loop. loop-value is the value of the currently looped variable, and loop-index is the last part of the variable's name (the part where the list variable has its asterisk *). The following example will increase all values inside a list variable by one: loop {var::*}: set {var::%loop-index%} to loop-value + 1 While Loops Starting with version 2.0 you can use while loops, i.e. loops that will just keep repeating as long as a condition is met. A while loop looks like this: while <condition>: Please be careful with this kind of loop, as it will keep running infinitely if the condition is always met. About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Saturn's Day, 15th March 2014, 08:36

Commands

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: Custom CommandsEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Creating custom commands is not difficult with Skript, but remember that Skript is not suitable for creating aliases of other plugins' commands, only for creating completely new commands, as arguments are parsed differently than how most other plugins do it.

The basic syntax of a custom command definition is a follows: command /commandname <arguments>: # arguments are explained below description: A description of what this command does usage: How to use the command, e.g. /commandname <arguments> # If omitted this defaults to something similar to how the command was defined above. permission: required.permission.to.use.this.command # If omitted this command can be used by everyone regardless of permissions. permission message: Message to send if the player doesn't have the required permission to use this command # If omitted this defaults to "You don't have the required permission to use this command" executable by: players/console/players and console # If omitted this command can be executed by players and the console. aliases: /c, /comname. # a list of aliases of the command which are usually abbreviations of the command trigger: put conditions and effects here that will be checked/executed when the command is used. A command's arguments look like <argtype> or <argtype = default value>, e.g. <item> or <item=water bucket>. The default value can also be an expression, in which case it has to be put into percent signs: <item=%tool%>. Arguments can also be mixed with text, e.g. a /give command definition can look like the following: command /give <items> to <player>: This command could then be used like /give a diamond to Njol. You can make parts of the arguments of a command optional by putting them into [square brackets], e.g. a command that finds mobs of a certain type within a given radius can look like command /find <entity type> [in radius <integer=100>]. This command can be used like /find creepers or /find zombies in radius 20, where the radius will default to 100 if omitted.

In the likely case that this was confusing here's a simple example command:

  1. a simple ID command to get the id of the held item

command /id <item=%tool%>: description: Find the ID of the item you're holding, or any given one. usage: /id [type] executable by: players trigger: message "The ID of %arg 1% is %id of arg 1%"

Custom commands can be defined anywhere in a script file – the command basically replaces the event a trigger would normally need. If a command is related to some triggers I recommend to put the command into the same file as the triggers, otherwise put it into whatever file fits best. You could e.g. create a big file that contains all standalone commands, or create a separate file for every command.

The following is an example of a combined trigger/command script which allows you to spawn a healer villager that can heal players for gold: command /healer: permission: healer.create description: spawns a healer villager which can heal players trigger: spawn a priest set {healers::%spawned villager%} to true set the name of the spawned villager to "Healer"

on rightclick on a priest: player has permission "healer.use" player is holding a gold ingot {healers::%clicked villager%} is true player's health is below 10 heal the player by 5 hearts remove 1 gold ingot from the player About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Thor's Day, 2nd October 2014, 09:16

type

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: TypesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Table of Contents Biome Block Boolean Chunk Colour Command Sender Damage Cause Date Direction Enchantment Enchantment Type Entity Entity Type Entity Type with Amount Experience Game Mode Inventory Inventory Slot Item / Material Item Type Living Entity Location Money Number Object Offlineplayer Player Potion Effect Type Projectile Region Text Time Timeperiod Timespan Tree Type Type Visual Effect Weather Type World Filter for version:

=>

This is a list of most types that Skript uses (types that are not listed are not needed by the user). A type is a kind of object, e.g. player, number, or text. Many types can be used as command arguments (‘<type>’, e.g. <number>) and almost all types can be used as loop-values (‘loop-type’, e.g. loop-block). The patterns listed for each type below reference to this. The usage listed above the patterns for each type describe how you can define an instance of the type in a script, e.g. how to include text properly or how to write a number. The usage does usually not include any expressions that represent an instance of the type, e.g. blocks cannot be defined in a script, but you can use one of the many block expressions to get a block. Biome type usage: swampland, forest, taiga, desert, plains, hell, sky, ocean, river, extreme hills, frozen ocean, frozen river, ice plains, ice mountains, mushroom island, mushroom shore, beach, desert hills, forest hills, taiga hills, small mountains, jungle, jungle hills type name patterns[?]: biome[s] since: 1.4.4 All possible biomes Minecraft uses to generate a world. examples: biome at the player is desert Block type usage: cannot be written in scripts type name patterns[?]: block[s] since: 1.0 A block in a world. It has a location and a type, and can also have a direction (mostly a facing), an inventory, or other special properties. Boolean type usage: true/yes/on or false/no/off type name patterns[?]: boolean[s] since: 1.0 A boolean is a value that is either true or false. Other accepted names are 'on' and 'yes' for true, and 'off' and 'no' for false. examples: set {config.%player%.use mod} to false Chunk type usage: cannot be written in scripts type name patterns[?]: chunk[s] since: 2.0 A chunk is a cuboid of 16×16×<world height> (x×z×y) blocks (the world height is usually 128 or 256). Chunks are spread on a fixed rectangular grid in their world, where the chunk (0,0) contains the blocks (0,0,0) to (15,15,<world height> - 1). Colour type usage: black, dark grey/dark gray, grey/light grey/gray/light gray/silver, white, blue/dark blue, cyan/aqua/dark cyan/dark aqua, light blue/light cyan/light aqua, green/dark green, light green/lime/lime green, yellow/light yellow, orange/gold/dark yellow, red/dark red, pink/light red, purple/dark purple, magenta/light purple, brown/indigo type name patterns[?]: colo[u]r[s] since: unknown Wool, dye and chat colours. Please note that the same colours are used for chat and wool so that you can use any colour expression to colour chat, e.g. message "<%colour of sheep%>this colour". Minecraft however uses slightly different colours for chat and sheep, with the main difference being that there exists no brown chat colour, but there exists another blue one instead, thus 'brown' and 'indigo' are the same colour. examples: color of the sheep is red or black set the colour of the block to green message "You're holding a <%color of tool%>%color of tool%<reset> wool block" Command Sender type usage: use the console for the console see player for players. type name patterns[?]: [command[s]][ ](sender|executor)[s] since: 1.0 A player or the console. examples: on command /pm: command sender is not the console chance of 10% give coal to the player message "You got a piece of coal for sending that PM!" Damage Cause type usage: contact, attack, projectile, suffocation, fall, fire, burning, melting, lava, drowning, block explosion, entity explosion, void, lightning, suicide, starvation, poison, potion, wither, falling block, thorns, unknown type name patterns[?]: damage cause[s] since: 2.0 The cause/type of a damage event, e.g. lava, fall, fire, drowning, explosion, poison, etc. Please note that support for this type is very rudimentary, e.g. lava, fire and burning, as well as projectile and attack are considered different types. Date type usage: cannot be written in scripts type name patterns[?]: date[s] since: 1.4 A date is a certain point in the real world's time which can currently only be obtained with now. See time and timespan for the other time types of Skript. examples: set {_yesterday} to now subtract a day from {_yesterday}

  1. now {_yesterday} represents the date 24 hours before now

Direction type usage: see direction (expression) type name patterns[?]: direction[s] since: 2.0 A direction, e.g. north, east, behind, 5 south east, 1.3 meters to the right, etc. Locations and some blocks also have a direction, but without a length. Please note that directions have changed extensively in the betas and might not work perfectly. They can also not be used as command arguments. examples: set the block below the victim to a chest loop blocks from the block infront of the player to the block 10 below the player: set the block behind the loop-block to water Enchantment type usage: protection, respiration, punch, projectile protection, smite, fortune, infinity, feather falling, flame, knockback, sharpness, aqua affinity, looting, fire aspect, silk touch, blast protection, power, thorns, efficiency, fire protection, bane of arthropods, unbreaking, luck of the sea, lure type name patterns[?]: enchantment[s] since: 1.4.6 An enchantment, e.g. 'sharpness' or 'fortune'. Unlike enchantment type this type has no level, but you usually don't need to use this type anyway. Enchantment Type type usage: <enchantment> [<level>] type name patterns[?]: enchant(ing|ment) type[s] since: 1.4.6 An enchantment with an optional level, e.g. 'sharpness 2' or 'fortune'. examples: enchant the player's tool with sharpness 5 helmet is enchanted with waterbreathing Entity type usage: player, op, wolf, tamed ocelot, powered creeper, zombie, unsaddled pig, fireball, arrow, dropped item, item frame, etc. type name patterns[?]: entit(y|ies) since: 1.0 An entity is something in a world that's not a block, e.g. a player, a skeleton, or a zombie, but also projectiles like arrows, fireballs or thrown potions, or special entities like dropped items, falling blocks or paintings. examples: entity is a zombie or creeper player is an op projectile is an arrow shoot a fireball from the player Entity Type type usage: Detailed usage will be added eventually type name patterns[?]: entity[ ]type[s] since: 1.3 The type of an entity, e.g. player, wolf, powered creeper, etc. examples: victim is a cow spawn a creeper targeted entity is an enderman holding a rose spawn 10 red, green or blue sheep spawn a falling anvil 4 meters above the player kill all skeleton horses in all worlds Entity Type with Amount type usage: <number> <entity type> type name patterns[?]: cannot be used directly since: 1.3 An entity type with an amount, e.g. '2 zombies'. I might remove this type in the future and make a more general 'type' type, i.e. a type that has a number and a type. examples: spawn 5 creepers behind the player Experience type usage: [<number>] ([e]xp|experience) type name patterns[?]: cannot be used directly since: 2.0 Experience points. Please note that Bukkit only allows to give XP, but not remove XP from players. You can however change a player's level and level progress freely. examples: give 10 xp to the player Game Mode type usage: creative/survival/adventure type name patterns[?]: game[ ]mode[s] since: 1.0 The game modes survival, creative and adventure. examples: player's gamemode is survival set the player argument's game mode to creative Inventory type usage: cannot be written in scripts type name patterns[?]: inventor(y|ies) since: 1.0 An inventory of a player or block. Inventories have many effects and conditions regarding the items contained. An inventory has a fixed amount of slots which represent a specific place in the inventory, e.g. the helmet slot for players (Please note that slot support is still very limited but will be improved eventually). Inventory Slot type usage: cannot be written in scripts type name patterns[?]: [inventory ]slot[s] since: unknown Represents a single slot of an inventory. Notable slots are the armour slots and furnace slots. The most important property that distinguishes a slot from an item is its ability to be changed, e.g. it can be set, deleted, enchanted, etc. (Some item expressions can be changed as well, e.g. items stored in variables. Speaking of which: slots are never saved to variables, only the items they represent at the time when the variable is set). Please note that the tool is a slot, but it can actually change its position, i.e. doesn't always represent the same slot. examples: set tool of player to dirt delete helmet of the victim set the colour of the player's tool to green enchant the player's chestplate with projectile protection 5 Item / Material type usage: [<number> [of]] <alias> [of <enchantment> <level>], Where <alias> must be an alias that represents exactly one item (i.e cannot be a general alias like 'sword' or 'plant') type name patterns[?]: item material since: 1.0 An item, e.g. a stack of torches, a furnace, or a wooden sword of sharpness 2. Unlike item type an item can only represent exactly one item (e.g. an upside-down cobblestone stair facing west), while an item type can represent a whole range of items (e.g. any cobble stone stairs regardless of direction). You don't usually need this type except when you want to make a command that only accepts an exact item. Please note that currently 'material' is exactly the same as 'item', i.e. can have an amount & enchantments. examples: set {_item} to type of the targeted block {_item} is a torch Item Type type usage: [<number> [of]] [all/every] <alias> [of <enchantment> [<level>] [,/and <more enchantments...>]] type name patterns[?]: item[ ]type[s] items materials since: 1.0 An item type is an alias, e.g. 'a pickaxe', 'all plants', etc., and can result in different items when added to an inventory, and unlike items they are well suited for checking whether an inventory contains a certain item or whether a certain item is of a certain type. An item type can also have one or more enchantments with or without a specific level defined, and can optionally start with 'all' or 'every' to make this item type represent all types that the alias represents, including data ranges. examples: give 4 torches to the player add all slabs to the inventory of the block player's tool is a diamond sword of sharpness remove a pickaxes of fortune 4 from {stored items::*} set {_item} to 10 of every upside-down stair block is dirt or farmland Living Entity type usage: see entity, but ignore inanimate objects type name patterns[?]: living[ ]entit(y|ies) since: 1.0 A living entity, e.g. a mob or player, not inanimate entities like projectiles or dropped items. examples: spawn 5 powered creepers shoot a zombie from the creeper Location type usage: See location at (expression) type name patterns[?]: location[s] since: 1.0 A location in a world. Locations are world-specific and even store a direction, e.g. if you save a location and later teleport to it you will face the exact same direction you did when you saved the location.

In the case of the teleport effect you can set a location's yaw and pitch to 0 to prevent this behaviour. Money type usage: <number> $ or $ <number>, where '$' is your server's currency, e.g. '10 rupees' or '£5.00' type name patterns[?]: cannot be used directly since: 2.0 A certain amount of money. Please note that this differs from numbers as it includes a currency symbol or name, but usually the two are interchangeable, e.g. you can both add 100$ to the player's balance and add 100 to the player's balance.

Like all economy elements, this type requires that Vault and a compatible economy plugin is installed. examples: add 10£ to the player's account remove Fr. 9.95 from the player's money set the victim's money to 0 increase the attacker's balance by the level of the victim * 100 Number type usage: [-]###[.###] (any amount of digits; very large numbers will be truncated though) type name patterns[?]: num[ber][s] since: 1.0 A number, e.g. 2.5, 3, or -9812454. Please note that many expressions only need integers, i.e. will discard any frational parts of any numbers without producing an error. examples: set the player's health to 5.5 set {_temp} to 2*{_temp} - 2.5 Object type usage: cannot be written in scripts type name patterns[?]: cannot be used directly since: 1.0 The supertype of all types, meaning that if %object% is used in e.g. a condition it will accept all kinds of expressions. Offlineplayer type usage: cannot be written in scripts type name patterns[?]: offline[ ]player[s] since: unknown A player that is possibly offline. See player for more information. Please note that while all effects and conditions that require a player can be used with an offline player as well, they will not work if the player is not actually online. Player type usage: cannot be written in scripts type name patterns[?]: player[s] since: 1.0 A player. Depending on whether a player is online or offline several actions can be performed with them, though you won't get any errors when using effects that only work if the player is online (e.g. changing his inventory) on an offline player. You have two possibilities to use players as command arguments: <player> and <offline player>. The first requires that the player is online and also accepts only part of the name, while the latter doesn't require that the player is online, but the player's name has to be entered exactly. Potion Effect Type type usage: speed, slowness, haste, mining fatigue, strength, instant health, instant damage, jump boost, nausea, regeneration, resistance, fire resistance, water breathing, invisibility, blindness, night vision, hunger, weakness, poison, wither type name patterns[?]: potion[[ ]effect][[ ]type][s] since: unknown A potion effect, e.g. 'strength' or 'swiftness'. examples: apply swiftness 5 to the player apply potion of speed 2 to the player for 60 seconds remove invisibility from the victim Projectile type usage: arrow, fireball, snowball, thrown potion, etc. type name patterns[?]: projectile[s] since: 1.0 A projectile, e.g. an arrow, snowball or thrown potion. examples: projectile is a snowball shoot an arrow at speed 5 from the player Region type usage: "region name" type name patterns[?]: cannot be used directly since: 2.1 A region of a regions plugin. Skript currently supports WorldGuard, Factions, GriefPrevention and PreciousStones. Please note that some regions plugins do not have named regions, some use numerical ids to identify regions, and some may have regions with the same name in different worlds, thus using regions like "region name" in scripts may or may not work. Text type usage: simple: "..." quotes: "...""..." expressions: "...%expression%..." percent signs: "...%%..." type name patterns[?]: (text|string)[s] since: 1.0 Text is simply text, i.e. a sequence of characters, which can optionally contain expressions which will be replaced with a meaningful representation (e.g. %player% will be replaced with the player's name). Because scripts are also text, you have to put text into double quotes to tell Skript which part of the line is an effect/expression and which part is the text. Please read the article on Texts and Variable Names to learn more. examples: broadcast "Hello World!" message "Hello %player%" message "The id of ""%type of tool%"" is %id of tool%." Time type usage:

    1. [:##][ ]am/pm

type name patterns[?]: time[s] since: 1.0 A time is a point in a minecraft day's time (i.e. ranges from 0:00 to 23:59), which can vary per world. See date and timespan for the other time types of Skript. examples: at 20:00: time is 8 pm broadcast "It's %time%" Timeperiod type usage:

        1. - ##:##

dusk/day/dawn/night type name patterns[?]: time[ ]period[s] duration[s] since: 1.0 A period of time between two times. Mostly useful since you can use this to test for whether it's day, night, dusk or dawn in a specific world. This type might be removed in the future as you can use 'time of world is between x and y' as a replacement. examples: time in world is night Timespan type usage: <number> [minecraft/mc/real/rl/irl] ticks/seconds/minutes/hours/days [[,/and] <more...>] [###:]##:##[.####] ([hours:]minutes:seconds[.milliseconds]) type name patterns[?]: time[ ]span[s] since: 1.0 A timespan is a difference of two different dates or times, e.g '10 minutes'. Timespans are always displayed as real life time, but can be defined as minecraft time, e.g. '5 minecraft days and 12 hours'. See date and time for the other time types of Skript. examples: every 5 minecraft days: wait a minecraft second and 5 ticks every 10 mc days and 12 hours: halt for 12.7 irl minutes, 12 hours and 120.5 seconds Tree Type type usage: [any] <general tree/mushroom type>, e.g. tree/any jungle tree/etc. <specific tree/mushroom species>, e.g. red mushroom/small jungle tree/big regular tree/etc. type name patterns[?]: tree[ ]type[s] tree[s] since: unknown A tree type represents a tree species or a huge mushroom species. These can be generated in a world with the generate tree effect. examples: grow any regular tree at the block grow a huge red mushroom above the block Type type usage: See the type name patterns of all types - including this one type name patterns[?]: type[s] since: 2.0 Represents a type, e.g. number, object, item type, location, block, world, entity type, etc. This is mostly used for expressions like 'event-<type>', '<type>-argument', 'loop-<type>', etc., e.g. event-world, number-argument and loop-player. examples: {variable} is a number # check whether the variable contains a number, e.g. -1 or 5.5 {variable} is a type # check whether the variable contains a type, e.g. number or player {variable} is an object # will always succeed if the variable is set as everything is an object, even types. disable PvP in the event-world kill the loop-entity Visual Effect type usage: ender signal, mobspawner flames, potion break, smoke, hurt, sheep eating, wolf hearts, wolf shaking, wolf smoke type name patterns[?]: (visual|particle) effect[s] since: 2.1 A visible effect, e.g. particles. examples: show wolf hearts on the clicked wolf play mob spawner flames at the targeted block to the player Weather Type type usage: clear/sun/sunny, rain/rainy/raining, and thunder/thundering/thunderstorm type name patterns[?]: weather[ ]type[s] weather condition[s] weather[s] since: 1.0 The weather types sunny, rainy, and thundering. examples: is raining is sunny in the player's world message "It is %weather in the argument's world% in %world of the argument%" World type usage: "world_name", e.g. "world" type name patterns[?]: world[s] since: 1.0 One of the server's worlds. Worlds can be put into scripts by surrounding their name with double quotes, e.g. "world_nether", but this might not work reliably as text uses the same syntax. examples: broadcast "Hello!" to "world_nether" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 9th August 2013, 09:43

text

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: Text & Variable NamesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Using text in scripts can be really simple, e.g. to send ‘Hello!’ to some player you can use send "Hello!" to player. As you can see you have to put double quotes around whatever text you want to use (to include a double quote you'll have to double it: "What's this ""thing"" you're talking about?"). Often you'll want to include e.g. the player's name in a text which can be done by inserting %player% where you want the player's name to appear, e.g. send "Hello %player%!" to player would send ‘Hello Njol!’ to me. You can put all expressions between such percent signs, e.g. message "The block above the block you're looking at is a %block above targeted block%". Similar to quotes you have to double the percent sign if you want to use one in a text: "100%%!". Chat Colours and Styles Colours and chat styles can be included in messages in two different ways: Either with the common ‘&x’/‘§x’ colour codes or by using Skript's <colour> codes, e.g. broadcast "<red><bold>Important Information:<reset> <blue>This server needs more mods!". You can also use the colour of an item in a message, e.g. message "<%colour of tool%>this text is coloured depending on the player's held item!".

The default english colours and chat styles are: colours: black, dark grey/dark gray, grey/light grey/gray/light gray/silver, white, blue/dark blue, cyan/aqua/dark cyan/dark aqua, light blue/light cyan/light aqua, green/dark green, light green/lime/lime green, yellow/light yellow, orange/gold/dark yellow, red/dark red, pink/light red, purple/dark purple, magenta/light purple, brown/indigo chat styles: bold/b, italics/italic/i, strikethrough/strike/s, underlined/underline/u, magic, reset/r Other languages may use other colours, but those are only used rarely, e.g. by the colour expression (useful to colour command arguments), as scripts always use the english colour codes. Advanced Syntax Skript version 2.0 and above can handle nouns more advanced than by simply inserting them into the text: "a %expression" or "an %expression" will add the appropriate indefinite article to the expression, e.g. “a fish”, “an apple”, or “a pickaxe and an emerald”. The same applies to the definite article ‘the’ ("the %expression%"), though this is barely noticeable in the english language, only some nouns like ‘air’ will completely remove the article in this case. Please note that for other languages you'll have to use that language's articles, e.g. "der %expression" or "ein %expression%" in german. "%expression%s" as well as "<number> %expression%" (for numbers other than 1) causes the expression to be displayed as plural, e.g. "2 %block%" can result in “2 logs” (the number can also be another expression, e.g. "%number-argument% %item-argument%" could turn into “5 pickaxes” or “1 pickaxe”). Unlike articles this syntax is the same for all languages. Variable Names Variable names are very similar to text, except that you have to enclose them in curly brackets instead of double quotes: {variable}. Expressions also do not use the advanced syntax described above as that's useless in a variable's name. About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 17th January 2014, 22:39

Var

Njol.ch » Projects » Skript Yggdrasil Markup » Documentation Tutorial API Statistics » Skript: VariablesEventsConditionsEffectsExpressionsLoopsCustom CommandsTypesTextVariables Variables are Skript's way to save data. Every variable has a name and a value, i.e. some stored data. You can put variables anywhere in your triggers to replace something, e.g. you can replace a location with a variable that holds a location. This can for example be used for a /home command: make a variable ‘home’ and a command /home which teleports the player to the location stored in the ‘home’ variable. To distinguish variables from the rest of the trigger their name has to be put in curly brackets like this: {variable name}. A variable's name can also contain expressions, e.g. to make a ‘home’ variable for every player you can make a variable like {home.%player%} where %player% will be replaced by the player's name every time the variable is used, which essentially creates a ‘home’ variable that is different for every player.

All variables are saved in a file called ‘variables.csv’ in the plugin's folder. Please do not edit the file manually, if you do something wrong you might wipe out some variables. The variables are written to this file constantly, so a server crash will make you loose at most one variable. Starting with version 2.0 you can also choose to save variables in a database which can also be monitored for changes, e.g. if you have multiple servers and want to synchronize variables between them.

There are 3 different kinds of variables: ‘normal’ variables, local variables and options. Normal variables (usually simply called variables) are unique, i.e. there can only exist one variable with the same name, and they are saved between server restarts. Local variables (which are identified with an underscore: {_local variable}) are ‘local to the event’, which means that there can exist several of these variables with the same name simultaneously, e.g. the following trigger will send a player his name one minute after he joined: on join:

 set {_player} to player
 wait a minute
 message "%{_player}%" # the local variable is unchanged no matter how many players joined in the meantime

If a normal variable was used all players would recieve the name of the last player who joined since normal variables are unique. Local variables are also automatically deleted when they are not needed anymore and do not clutter the variables file, but their data is lost when the server stops (which does not matter that much as all scripts also stop running and won't resume where they left off when the server restarts). The last kind of variables are options which are not actually variables at all. You can add a section ‘options’ to your script like this: options:

 option name = option value

You can then use these options anywhere in your scripts with {@option name}. The reason why I stress anywhere is because options will be replaced one-to-one with their values just before the script is parsed. Thus you can put anything into options, even whole script lines or parts thereof. Remember to not use percent signs around options in text though as the percent signs will remain. List Variables List variables are variables which can hold multiple values. They look like {variable name::*} and can have elements added and removed from them using the default add and remove effects, can be deleted which will clear all values of the list, and overwritten with new values with the set effect. You can access a specific value of a list variable with {variable name::index} where ‘index’ is the index of the value you want. The index can be anything, e.g. a player name or a number, but when adding values to the list with the add effect the index of the new value will be a number.

List variables can be looped with loop {list variable::*}. Within the loop the currently looped value can be accessed with loop-value and its index with loop-index.

List variables are also useful to show a list in a message, e.g. a list of all admins online, by first adding them to the same list variable and then using that variable in the message (see the last example below). Using a local list variable for this purpose is recommended: {_local list variable::*} Examples As I'm not very good at explaining the rest of this page is filled with some examples:

Save how many players have ever logged into your server:

  1. if you add a 'variables:' section to your script, the variables defined there will be set to the given value if they don't exist
  2. when the script is loaded. You cannot change an existing variable's value this way however, in particular if you
  3. change the variables' values here the actual variables will not be changed at all.

variables: {logincount} = 0

on login: add 1 to {logincount}

command /logincount: description: Find out how many people have ever logged into this server trigger: message "Since its beginnings <green>%{logincount}%<reset> people have logged into this server"

A simple /home plugin: command /sethome: permission: skript.home description: Set your home trigger: set {home.%player%} to location of player message "Set your home to <grey>%location of player%<reset>"

command /home: permission: skript.home description: Teleport yourself to your home trigger: if {home.%player%} is not set: message "You have not set your home yet!" stop trigger teleport player to {home.%player%}

A command that shows the currently online staff: command /staff: description: Shows online staff trigger: loop all players: loop-player has permission "is.staff" add loop-player to {_online staff::*}

size of {_online staff::*} is 0: message "No staff currently online! Happy griefing ;)!" else: message "Online staff: %{_online staff::*}%" About ~ njol.ch created by Peter Güttinger ~ icons by Yusuke Kamiyamane ~ Last modified: Freyja's Day, 17th January 2014, 22:50