DF Manual Patch 6.6.1

Code Blocks

PLAYER ACTION

Used to do something related to a player or multiple players.

examples

Send a message to a player
Damage or heal a player
Clear a player's inventory


IF PLAYER

Used to execute the code inside it if a certain condition related to a player is met.

examples

Check if a player is swimming
Check if a player has an item
Check a player's username


START PROCESS

Used to start processes declared by a Process block. Waits inside the Process will not stop this code line, unlike Functions.


CALL FUNCTION

Used to call functions declared by a Function block. Code will not continue past this block until the Function completes/returns.


CONTROL

Used to control the execution of some or all code blocks after it.

examples

Pause the code sequence
for a certain duration
Stop the code sequence
Skip a repeat iteration


SET VARIABLE

Used to set the value of a variable.

examples

Set a variable to a sum of numbers
Remove all instances of a certain
string from a string variable
Set a variable to a random value


ENTITY EVENT

Used to execute code when an entity does something or when something happens to an entity.

examples

Detect when a mob takes damage
Detect when a projectile kills a mob
Detect when a mob kills another mob


PLAYER EVENT

Used to execute code when something is done by (or happens to) a player.

examples

Detect when a player joins the plot
Detect when a player right clicks
Detect when a player dies


FUNCTION

Used to define a line of code that can be called with a Call Function block.

additional info

Set the function name by right clicking,the code block sign with a string.
Set the name color, icon, and lore of the,function by putting an item in the chest.
Put parameter items to specify the,parameters of the function.
Functions can also be used for continuing,lines of code that are out of space.


IF ENTITY

Used to execute the code inside it if a certain condition related to an entity or multiple entities is met.

examples

Check if an entity is a projectile
Check if an entity is a certain type
of mob
Check the name of an entity


ENTITY ACTION

Used to do something related to an entity or multiple entities.

examples

Set the age or size of a mob
Give a mob a potion effect
Delete an entity from the plot


IF VARIABLE

Used to execute the code inside it if a certain condition related to the value of a variable is met.

examples

Check if a number variable is less
than or equal to another number
Check if a string variable contains
a certain string
Check if a variable is equal
to something


SELECT OBJECT

Used to change the selection on the current line of code, which will affect the targets of most code blocks.

examples

Select all players on the plot
Select a player with a certain username
Select all players on the plot that meet
a certain condition


GAME ACTION

Used to do something related to the plot and everyone playing it.

examples

Spawn a mob or other entity
Change a block or block region


ELSE

Used to execute the code inside it if the condition directly before it was not met. Else must be placed directly after any If block's closing bracket.


PROCESS

Used to execute code when the process is started using a Start Process block.

additional info

Set the process name by right clicking,the code block sign with a string.
Set the name color, icon, and lore of the,process by putting an item in the chest.
Processes are not a replacement for,Functions. Processes are much more CPU,intensive than functions, and should only,be used when needed.


REPEAT

Used to repeat the code inside it.

examples

Repeat code forever
Repeat code a certain number
of times
Repeat code until a certain
condition is met


IF GAME

Used to execute the code inside it if a certain condition related to the plot is met.

examples

Check if a container has all of
a certain set of items
Check if a sign's text contains
a certain text
Check if a block at a certain
location is a certain block