TwitchSpawn
Search…
πŸ“œ
TSL Actions
Which actions can TwitchSpawn perform?
TSL actions are the way TwitchSpawn handles inbound events. They are ALWAYS the first words of TSL rules. Some of the actions also support DISPLAYING part under various logic.

Action: DROP

Description: Drops item in the direction of where streamer is looking. NBT part supports placeholder expressions (See Event Related Special Expressions) Syntax: DROP <item_id[nbt_data]> [amount] [DISPLAYING <text_json_array>] Example(s):
# Default amount value is 1
DROP minecraft:apple ...
​
# Drops 10 sticks
DROP stick 10 ...
​
# Drops 1 diamond block
DROP diamond_block ...
​
# Drops 1 diamond sword with custom action message!
DROP diamond_sword
DISPLAYING %[
{text:"${actor}'s Sword", color:"gold"},
{text:" at your service!"}
]%
...
​
# Drops a diamond hoe with NBT data
DROP %diamond_hoe{display:{Name:"\"Hoe of Woe\""}}% ...
​
# NBT part supports placeholder expressions!
DROP %paper{display:{Name:"\"${actor}'s Paper of Truth\""}}% ...

Action: SUMMON

Description: Summons a mob on given coordinate and NBT data. NBT part supports placeholder expressions (See Event Related Special Expressions) Syntax: SUMMON <entity_id> [<x> <y> <z>] [nbt_data] [DISPLAYING <text_json_array>] Example(s):
# Summons a zombie where streamer is standing
SUMMON minecraft:zombie ...
​
# It also supports relative coordinates!
# Summons a skeleton 10 blocks above the streamer.
SUMMON skeleton ~ ~10 ~ ...
​
# Summons zombie with a custom action message!
SUMMON zombie
DISPLAYING %[
{text:"${actor}", color:"gold"},
{text:" cursed you with a zombie..", color:"white"},
]%
...
​
# Summons a donkey with NBT data on (X:123, Y:456, Z:789)
SUMMON donkey 123 456 789 {Tame:1} ...
​
# NBT part supports placeholder expressions!
SUMMON skeleton ~ ~ ~ %{CustomName:"\"${actor}'s Knight\""}% ...

Action: EXECUTE

Description: Executes given Minecraft commands assuming the streamer is the execution source (therefore @s selector refers to the streamer). Command word supports placeholder expressions (See Event Related Special Expressions) Syntax: EXECUTE {minecraft_command} [DISPLAYING <text_json_array>] Example(s):
# Executes "/kill" command, and kills streamer
EXECUTE /kill ...
​
# Executes one "/kill" command, and removes all items on the ground
EXECUTE %/kill @e[type=item]% ...
​
# Executes one command with custom action message!
EXECUTE %/xp add @s 1 levels%
DISPLAYING %[
{text:"Blessed by the XP Gods!", color:"blue"}
]%
...
​
# Executes two commands
EXECUTE %/weather thunder% %/effect give @s minecraft:blindness 30 255% ...
​
# Command supports placeholder expressions!
EXECUTE %/xp add @s ${amount_i} levels% ...

Action: THROW

Description: Throws an item from streamer's inventory. Syntax: THROW <slot_name>|<slot FROM inventory_name> [DISPLAYING <text_json_array>] Example(s):
# Throws the held item from hotbar
THROW main-hand ...
​
# You can express literal position of slots as well (See picture below)
THROW slot 21 FROM inventory ...
THROW slot 2 FROM armors ...
THROW slot 0 FROM hotbar # same as slot 0 FROM inventory
​
# Or you can use shortends for common slots
THROW helmet ... # same as slot 3 FROM armors
THROW chestplate ... # same as slot 2 FROM armors
THROW leggings ... # same as slot 1 FROM armors
THROW boots ... # same as slot 0 FROM armors
THROW hotbar
THROW off-hand
THROW main-hand
​
# Or some randomness!
THROW randomly ...
THROW randomly FROM armors ...
THROW randomly FROM inventory ...
THROW randomly FROM hotbar ...
​
# Ooor more evil!
THROW everything ...
THROW everything FROM armors ...
THROW everything FROM inventory ...
​
# Finally, it supports custom action message!
THROW off-hand
DISPLAYING %[
{text:"Witch: ", color:"dark_purple"},
{text:"Begone off-hand!", color:"white"}
]%
...
Slot numbers of the inventories

Action: CLEAR

Description: Destroys an item from streamer's inventory. Its syntax is the same as THROW action. Syntax: CLEAR <slot_name>|<slot FROM inventory_name> [DISPLAYING <text_json_array>] Example(s):
# Destroys the held item from hotbar
CLEAR main-hand ...
​
# You can express literal position of slots as well (See picture below)
CLEAR slot 21 FROM inventory ...
CLEAR slot 2 FROM armors ...
CLEAR slot 0 FROM hotbar # same as slot 0 FROM inventory
​
# Or you can use shortends for common slots
CLEAR helmet ... # same as slot 3 FROM armors
CLEAR chestplate ... # same as slot 2 FROM armors
CLEAR leggings ... # same as slot 1 FROM armors
CLEAR boots ... # same as slot 0 FROM armors
CLEAR hotbar
CLEAR off-hand
CLEAR main-hand
​
# Or some randomness!
CLEAR randomly ...
CLEAR randomly FROM armors ...
CLEAR randomly FROM inventory ...
CLEAR randomly FROM hotbar ...
​
# Ooor more evil!
CLEAR everything ...
CLEAR everything FROM armors ...
CLEAR everything FROM inventory ...
​
# Finally, it supports custom action message!
CLEAR everything
DISPLAYING %[
{text:"Blaze King: ", color:"red"},
{text:"Burn whole inventory, burn!", color:"white"}
]%
...
Slot numbers of the inventories

Action: SHUFFLE

Description: Shuffles given inventory space! Syntax: SHUFFLE <inventory_name>|(slot <min> <max>) [DISPLAYING <text_json_array>] Example(s):
# Shuffles inventory's slots in given range (See picture below for indices)
SHUFFLE slot 9 11 # First 3 slot of the inventory
...
​
# Shuffles whole inventory
SHUFFLE inventory # Same as -> slot 0 35
...
​
# Shuffles whole hotbar!
SHUFFLE hotbar # Same as -> slot 0 8
...
​
# Shuffles armors. YES ARMORS! (You can see a bug becoming feature here!)
SHUFFLE armors
...
# It supports custom action message!
SHUFFLE armors
DISPLAYING %[
{text:"${actor}: ", color:"dark_green"},
{text:"Pst, check your armors!", color:"white"}
]%
...
Slot numbers of the main inventory

Action: CHANGE

Description: Changes an item from streamer's inventory into another item! NBT part of the item supports placeholder expressions (See Event Related Special Expressions) Syntax: CHANGE <slot_name>|<slot FROM inventory_name> INTO <item_id[nbt_data]> [DISPLAYING <text_json_array>] Example(s):
# Changes main-hand slot into apple with NBT
CHANGE main-hand
INTO apple{display:Name:"\"${actor}'s Poisonous Apple\""}
...
​
# You can express literal position of slots as well (See picture below)
CHANGE slot 21 FROM inventory INTO stick ...
CHANGE slot 2 FROM armors INTO diamond_armor ...
CHANGE slot 0 FROM hotbar INTO stick ...
​
# Or you can use shortends fro common slots
CHANGE helmet INTO stick ... # same as slot 3 FROM armors
CHANGE chestplate INTO stick ... # same as slot 2 FROM armors
CHANGE leggings INTO stick ... # same as slot 1 FROM armors
CHANGE boots INTO stick ... # same as slot 0 FROM armors
CHANGE hotbar INTO stick
CHANGE off-hand INTO stick
CHANGE main-hand INTO stick
​
# Or some randomness!
CHANGE randomly INTO stick ...
CHANGE randomly FROM armors INTO stick ...
CHANGE randomly FROM inventory INTO stick ...
CHANGE randomly FROM hotbar INTO stick ...
​
# Ooor more evil!
CHANGE everything INTO stick ...
CHANGE everything FROM armors INTO stick ...
CHANGE everything FROM inventory INTO stick ...
​
# Finally, it supports custom action message!
CHANGE everything
INTO apple
DISPLAYING %[
{text:"${actor} ", color:"dark_purple"},
{text:"turned everything into apple..", color:"white"}
]%
...
CHANGE helmet
INTO bucket
DISPLAYING %[
{text:"${actor}: ", color:"dark_purple"},
{text:"Look, its on your head!", color:"white"}
]%
...
Slot numbers of the inventories

Meta-action: EITHER

Description: Randomly performs one of given actions. You can chain as many actions as you like. Syntax: EITHER [CHANCE <percent> PERCENT] <action> {OR [CHANCE <percent> PERCENT] <action>} [[ALL] DISPLAYING <text_json_array>] Example(s):
# Pretty straight forward, either drops apple or stick!
EITHER DROP apple OR DROP stick ...
​
# It is possible to chain more than 2 actions as well
EITHER
DROP apple
OR
SUMMON zombie
OR
EXECUTE %/kill%
OR
NOTHING
...
​
# You can declare your own probabilities as well!
# But make sure all the chained percentages add up to 100.00%
EITHER
CHANCE 89.90 PERCENT
DROP %stone{display:{Name:"\"89.90\% Stone\""}}%
OR
CHANCE 10 PERCENT
DROP %apple{display:{Name:"\"10.00\% Apple\""}}%
OR
CHANCE 0.10 PERCENT
DROP %diamond{display:{Name:"\"00.10\% Diamond\""}}%
...
​
# It also supports custom action messages
EITHER
DROP apple DISPLAYING %["Here comes apple!"]%
OR
DROP stick DISPLAYING %["Here comes stick!"]%
OR
NOTHING DISPLAYING %["What a pity! No reward for you."]%
...
​
# Or you can merge all DISPLAYING statements by using ALL DISPLAYING
EITHER
DROP apple OR DROP stick OR DROP diamond
ALL DISPLAYING %["Here comes ${itemName}"]%
...

Meta-action: BOTH

Description: Performs given actions consecutively. You can chain as many actions as you like. Syntax: BOTH [INSTANTLY] <action> {AND <action>} [[ALL] DISPLAYING <text_json_array>] Example(s):
# Pretty straight forward, both drops apple and stick consecutively!
BOTH DROP apple AND DROP stick ...
​
# It also supports custom action messages
BOTH
DROP apple DISPLAYING %["Here comes apple! Wait for the other.."]%
AND
DROP stick DISPLAYING %["Here comes stick! One more time.."]%
AND
DROP diamond DISPLAYING %["Here comes diamond! Finally!"]%
...
# Or you can merge all DISPLAYING statements by using ALL DISPLAYING
BOTH
DROP apple AND DROP stick AND DROP diamond
ALL DISPLAYING %["Here comes something one by one"]%
...
# Or even better, you can perform actions instantly displaying one message!
BOTH INSTANTLY
DROP apple AND DROP stick AND DROP diamond
# Can't have more than 1 DISPLAYING though
DISPLAYING %["Beware the apple, stick, diamond trio!"]%
...
Be careful while using BOTH INSTANTLY, since there are no default display message for combined action types, a DISPLAYING is encouraged.

Meta-action: NOTHING

Description: Does literally nothing, but still displays message upon event occurance. Might be meaningful when used with EITHER action. In addition to that, it now can be used to disable notification message. Syntax: NOTHING [DISPLAYING <text_json_array>] Example(s):
# Does nothing, but still displays message
NOTHING ...
​
# Supports displaying as well
NOTHING
DISPLAYING %["A goblin has stolen your reward.."]%
# Can also be used as a part of DISPLAYING to disable notification
DROP apple
DISPLAYING NOTHING # Do not display anything

Meta-action: FOR <N> TIMES

Description: Performs given action for given amount of times. Syntax: FOR <count> TIMES <action> [DISPLAYING <text_json_array>] Example(s):
# Summons 5 zombies
FOR 5 TIMES
SUMMON zombie ~ ~ ~
...
​
# Supports displaying as well
FOR 10 TIMES
SUMMON skeleton ~ ~ ~
DISPLAYING %["Skeleton hordeeee! (${loopCount} skeletons)"]%
...

Meta-action: WAIT

Description: Makes the mod sleep for given amount of time. Originally intended for usage with FOR and BOTH actions to delay stuff
😈
Syntax: WAIT <amount> (minutes|seconds|milliseconds) [DISPLAYING <text_json_array>] Example(s):
# Waits for 5 seconds
WAIT 5 seconds
...
​
# Supports displaying as well
WAIT 12 minutes
DISPLAYING %["Events are delayed for 12 minutes!"]%
...
​
# Examplar usage 1: Wait 10 seconds before summoning a random mob
BOTH INSTANTLY
WAIT 10 seconds
AND
EITHER
SUMMON creeper
OR
SUMMON enderman
DISPLAYING %["A random mob coming in..."]%
ON ...
​
# Examplar usage 2: Make yourself puke items!
FOR 64 TIMES
BOTH INSTANTLY
DROP potato
AND
WAIT 100 milliseconds
DISPLAYING %["Ew. You're vomitting potatoes!"]%
ON ...

Meta-action: REFLECT

Description: Performs given action both for the streamer and the given users or everyone in the server! (See reflection event to customize the message they see!) Syntax: REFLECT [ONLY] <username_list_as_one_word|integer|*> <action> [DISPLAYING <text_json_array>] Example(s):
# Drops apple for the streamer, TheDiaval and iGoodie!
REFLECT %TheDiaval, iGoodie%
DROP apple
...
​
# Or can do stuff for N random players too!
# Drops an apple for 5 random players online
REFLECT 5
DROP apple
...
​
# Works with a greedy selector as well!
# Gives apple to the streamer and everyone else that is online!
REFLECT *
EXECUTE %/give @s apple 1%
...
​
# Supports displaying as well
REFLECT %Pomapii%
FOR 10 TIMES # Summons 10 skeletons
SUMMON skeleton ~ ~ ~
DISPLAYING %["Skeleton hordeeee! (${loopCount} skeletons)"]%
...
# Only reflect the action, but do not perform it on the streamer
REFLECT ONLY %Pomapii%
DROP apple
...

Advanced-action: OS_RUN

Description: Runs given shell script/command either on local machine or streamer's machine. Script part supports placeholder expressions (See Event Related Special Expressions) Syntax: OS_RUN (LOCAL|REMOTE) <shell_name> <script>* [DISPLAYING <text_json_array>] Supported Shell Names: CMD, POWERSHELL, BASH Example(s):
# Runs a shell on local machine to print 123 on the command line. (Not the Minecraft chat)
OS_RUN LOCAL
POWERSHELL echo 123
...
# You can run a script on remote machine as well.
OS_RUN REMOTE
BASH %some/path\ to/sh_script.sh%
...
# TSL helps you with quoting.
# In order to run following shell command:
# echo "Hello World"
OS_RUN
CMD echo %Hello World% # No need for " characters. % will be translated into ".
...
​
# Supports displaying as well
OS_RUN LOCAL POWERSHELL %path/to/batch_script.bat%
DISPLAYING %["Here comes an OS magic!"]%
...
# Supports placeholder expressions
OS_RUN LOCAL
BASH my_amazing_program -actor ${actor}
...