commands
Runs the commands of the server, as its console or as a player.
Source: src/Moongate.Server.Ultima/Modules/CommandsModule.cs
Functions
Section titled “Functions”execute
Section titled “execute”commands.execute(command, ...) -> booleanRuns a command as the server console does: with every power and with no player behind it, so a command that needs one, such as a target cursor, answers that it works in game only. The arguments follow the name, one each: strings, numbers and booleans, joined by spaces into one line (an argument with a space in it is read as two). True when the command was started, false for an empty name, a line end in it or in an argument, or an argument that is a table or a function. The command runs on its own: what it answers is written in the server log, and a failure of it is logged, never raised in the script.
A script that keeps the world saved before it changes the season, as the console would:
commands.execute("save")commands.execute("season", "winter")A timer that tells everyone the server is about to save:
timer.every(3600, function() commands.execute("broadcast", "The", "world", "is", "being", "saved.") commands.execute("save")end)| Parameter | Type | Default |
|---|---|---|
command | string | |
... | any |
Returns boolean.
execute_as
Section titled “execute_as”commands.execute_as(player, command, ...) -> booleanRuns a command as the player wrote it in game: with the level of its account, so a command above it is refused as it would be, and with its session, so a target cursor opens for it. The player reads what the command answers. True when the command was started; false as commands.execute, and for a player that is not in the world. The command runs on its own.
A stone that sends who double clicks it to Britain with the staff’s own go; a player whose account may not
use that command reads the refusal it would read typing it:
function travel_stone.on_use(serial, user) commands.execute_as(user, "go", "britain") return trueend| Parameter | Type | Default |
|---|---|---|
player | integer | |
command | string | |
... | any |
Returns boolean.
Made with ❤️ by Tom
