advanced-scripting/Idioms and Common Scripts
Idioms and Common Scripts
This document outlines some nifty scripts and ways to do things effectively using the new advanced scripting! If you'd like to add something, feel free to comment here or on the main page! I'll include it!
Cutting Off a Player
With the advanced scripting update, the old "[cutoff]" replacement option is gone. But all is not lost! Here's how to do the same thing! In playerchat.txt:
/candlejack/ =={ @__repl__ = candleja--* @__endparse__ = true sudo kick $p Candlejack has taken you }
You can replace "candlejack" with any word, such as an inappropriate swear word. You can set anything as the @__repl__ value, such as a cut off version of that swear word. And after sudo kick $p, put any reason as to why you have kicked the player.
All Players
For situations when you want a command to affect all players, but the command only works on one player at a time:
[foreach @player in $(server.players)] { tell @player This is a secret to everyone... }
This also works for certain subgroups of players. While server.players gets all currently online players by default, you can narrow your search sometimes:
/mourn banned players/ =={ @list = [foreach @player in $(server.players.banned)] { [!if @list] #check if the list is empty @list = @player [else] @list = @list, @player #String concatenation! } broadcast We mourn the passing of these dickweeds: @list }
Comments