Alias tutorial
The alias file is plugins/Sve/svealias.yml
.
An alis file is in YAML format, so if a line contains characters like :
it must be surrounded by " and ". All aliases are in group aliases
.
Alias syntax
An alias looks like this:
aliases: - alias_name param1 param2 param3: - command1 args - command2 args
An example ~ a warn command that warns a player and sends it a message:
aliases: - warn player/p msg...: - tell @player You have been warned! @msg
Note that variables are prefixed with @ when they are used. /p
tells to the alias system to except a player name, and ...
after msg
tells that message can be multiple words long or empty.
Aliases can be overloaded as long as they have a different number of parameters. The above example, however, could not be as it has a *variable length argument* msg
.
aliases: - givestone: - give @m 1 64 - givestone p - give @p 1 64
@m
contains the name of the player who ran the command.
Built-in commands
reply
reply message...
Sends a message to the player who ran the command.
- reply Command executed successfully!
set
set variable string...
Assigns a value to a variable.
- set player johh - tell @player Hi!
set!
set variable svecode...
Executes sve code and assigns returned value to a variable.
- set a 1 - set b 1 - set! sum @a+@b
system
system command...
or
system:
Executes following code block or argument as the console.
- system say doing things... - system: - whitelist on - say turned whitelist on
wait
wait time command...
or
wait time:
Waits given ticks and then executes the following command or code block.
- say turning server off in 10 seconds - wait 200 stop - say saving everything and closing server in 10 seconds - wait 200: - save-all - stop
wait!
wait! svecode...:
Same as wait
, but executes argument as sve code:
- wait! 20*10: - say 10 seconds - wait! 20*10: - say 20 seconds
if!
if! svecode...:
Executes following block if argument sve code evaluates to true.
- if! @m.y > 65: - say higher than 65
while!
while! svecode...:
Executes following block again and again as long as a condition is true (sve code). Use with care!
- while! @m.y > 65 - tp @m ~ ~-5 ~
foreach ... in
foreach variable in list...:
List may be either a selector(@a[x,y,z]
) or a predefined list (@worlds
is the only one right now). Multiple selectors and lists may be iterated in one loop, they must be separeted using plus sign +
.
- reply warning players in the spawn area - foreach player in @a[0,65,0,10,w=spawn]: - tell @player Please leave the spawn area!
foreach ... in!
foreach variable in! svecode...:
Similar to foreach..in but iterates a sve list instead of a selector list.
- foreach num in! range(0,100): - say @num
sve!
sve! svecode
Executes sve code, but replaces alias system variables with their values.
- coordinates player/p: - sve! tell( @m, @player.x + "," + @player.y + "," + @player.z )
Comments