Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Creating Commands

Mykolas Peteraitis edited this page Jul 17, 2019 · 1 revision

Creating commands in Emberhunt is really easy.

Just follow these steps, and you will have your own command in no time.

1. Add a file to server/commands/

The file name should be <command name>.gd.

2. Define the descriptions of the command

This is optional. The descriptions are displayed by the help command, so if you're not the only one who's going to use that command, adding descriptions is a good idea.

Just add this to your file, and change the text however you want:

var _short_description = "this is displayed next to the command name when you simple type help"

var _description = """this is displayed when you type help <this command>.
This should be an extended version, with usage examples, etc."""

3. Define the behaviour of your function

This is the main ingredient.

You will need to define a function, with a name identical to the command name.

func <command name>(args = [], server = null):

As you can see, the function takes 2 arguments: args, which is an array of the arguments used when executing this command, and server which is the server object, if you want to read/write something.

Inside the function, you can do whatever you want, and what you return will be printed to the logs.

Note: do not use print() as it will only print to the logs, without sending the output back to the commands executioner.

This is the technical documentation of the game Emberhunt.

All contributions are very appreciated.

The game's content wiki is being worked on.

Clone this wiki locally