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] [metadata] [DISPLAYING <text_json_array>]Example(s):
# Default amount value is 1DROP minecraft:apple ...# Drops 10 sticksDROP stick 10...# Drops 1 diamond blockDROP diamond_block ...# Drops 2 dye with metadata 5 (Which is purple dye)DROP minecraft:dye 2 5...# 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 dataDROP %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 standingSUMMON 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 streamerEXECUTE /kill ...# Executes one "/kill" command, and removes all items on the groundEXECUTE %/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 commandsEXECUTE %/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 hotbarTHROW 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 slotsTHROW helmet ...# same as slot 3 FROM armorsTHROW chestplate ...# same as slot 2 FROM armorsTHROW leggings ...# same as slot 1 FROM armorsTHROW boots ...# same as slot 0 FROM armorsTHROW hotbarTHROW off-handTHROW 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"} ]%...
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 hotbarCLEAR 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 slotsCLEAR helmet ...# same as slot 3 FROM armorsCLEAR chestplate ...# same as slot 2 FROM armorsCLEAR leggings ...# same as slot 1 FROM armorsCLEAR boots ...# same as slot 0 FROM armorsCLEAR hotbarCLEAR off-handCLEAR 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"} ]%...
# Shuffles inventory's slots in given range (See picture below for indices)SHUFFLE slot 9 11# First 3 slot of the inventory...# Shuffles whole inventorySHUFFLE 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"} ]%...
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]> [amount] [metadata] [DISPLAYING <text_json_array>]Example(s):
# Changes main-hand slot into apple with NBTCHANGE main-handINTO apple{display:Name:"\"${actor}'s Poisonous Apple\""}...# Changes main-hand slot into dye with metadataCHANGE main-handINTO minecraft:dye 2 5...# 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 ...# Or you can use shortends fro common slotsCHANGE helmet INTO stick ...# same as slot 3 FROM armorsCHANGE chestplate INTO stick ...# same as slot 2 FROM armorsCHANGE leggings INTO stick ...# same as slot 1 FROM armorsCHANGE boots INTO stick ...# same as slot 0 FROM armorsCHANGE hotbar INTO stickCHANGE off-hand INTO stickCHANGE 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 everythingINTO apple DISPLAYING %[ {text:"${actor} ", color:"dark_purple"}, {text:"turned everything into apple..", color:"white"} ]%...CHANGE helmetINTO bucket DISPLAYING %[ {text:"${actor}: ", color:"dark_purple"}, {text:"Look, its on your head!", color:"white"} ]%...
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 wellEITHERDROP apple ORSUMMON 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%EITHERCHANCE 89.90 PERCENT DROP %stone{display:{Name:"\"89.90\% Stone\""}}% ORCHANCE 10 PERCENT DROP %apple{display:{Name:"\"10.00\% Apple\""}}% ORCHANCE 0.10 PERCENT DROP %diamond{display:{Name:"\"00.10\% Diamond\""}}%...# It also supports custom action messagesEITHERDROP apple DISPLAYING %["Here comes apple!"]% ORDROP stick DISPLAYING %["Here comes stick!"]% ORNOTHING DISPLAYING %["What a pity! No reward for you."]%...# Or you can merge all DISPLAYING statements by using ALL DISPLAYINGEITHERDROP apple OR DROP stick OR DROP diamondALL 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 messagesBOTHDROP apple DISPLAYING %["Here comes apple! Wait for the other.."]% ANDDROP stick DISPLAYING %["Here comes stick! One more time.."]% ANDDROP diamond DISPLAYING %["Here comes diamond! Finally!"]%...# Or you can merge all DISPLAYING statements by using ALL DISPLAYINGBOTHDROP apple AND DROP stick AND DROP diamondALL DISPLAYING %["Here comes something one by one"]%...# Or even better, you can perform actions instantly displaying one message!BOTH INSTANTLYDROP 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.
Syntax:NOTHING [DISPLAYING <text_json_array>]Example(s):
# Does nothing, but still displays messageNOTHING ...# Supports displaying as wellNOTHING DISPLAYING %["A goblin has stolen your reward.."]%
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):
# Waits for 5 secondsWAIT 5 seconds...# Supports displaying as wellWAIT 12 minutes DISPLAYING %["Events are delayed for 12 minutes!"]%...# Examplar usage 1: Wait 10 seconds before summoning a random mobBOTH INSTANTLYWAIT 10 seconds AND EITHERSUMMON creeper ORSUMMON enderman DISPLAYING %["A random mob coming in..."]% ON ...# Examplar usage 2: Make yourself puke items!FOR 64 TIMESBOTH INSTANTLYDROP potato ANDWAIT 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 onlineREFLECT 5DROP 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 wellREFLECT %Pomapii%FOR 10 TIMES# Summons 10 skeletonsSUMMON skeleton ~~~ DISPLAYING %["Skeleton hordeeee! (${loopCount} skeletons)"]%...# Only reflect the action, but do not perform it on the streamerREFLECT 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, BASHExample(s):
# Runs a shell on local machine to print 123 on the command line. (Not the Minecraft chat)OS_RUN LOCALPOWERSHELL 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_RUNCMD echo %Hello World%# No need for " characters. % will be translated into "....# Supports displaying as wellOS_RUN LOCAL POWERSHELL %path/to/batch_script.bat% DISPLAYING %["Here comes an OS magic!"]%...# Supports placeholder expressionsOS_RUN LOCALBASH my_amazing_program -actor ${actor}...
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):