Zum Inhalt springen

Getting Started

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Installation

To get started with ShulkerScript, you need to install the ShulkerScript CLI. You can either download the latest release from the GitHub releases page or build it from source.

Download from GitHub

  1. Go to the GitHub releases page and download the latest release for your platform.
  2. Extract the downloaded archive.
  3. Move the extracted binary to a directory in your PATH.
  4. Test the installation by running
    Terminal window
    shulkerscript --version
    You should see the version of the CLI printed to the console.

Building from source

  1. Make sure you have Rust and Cargo installed.
  2. Install the CLI by running
    Terminal window
    cargo install --git https://github.com/moritz-hoelting/shulkerscript-cli.git
  3. Test the installation by running
    Terminal window
    shulkerscript --version

Creating a new project

  1. Create a new directory for your project.
  2. Navigate into the directory.
  3. Run
    Terminal window
    shulkerscript init
    This will create a new ShulkerScript project in the current directory.
  4. Open the pack.toml file in your favorite text editor and configure the project to your liking.

The project structure should look like this:

  • Directorysrc/
    • main.shu
  • .gitignore
  • pack.toml
  • pack.png

Writing your first script

After opening the file src/main.shu in your favorite text editor, you should see the following content:

src/main.shu
namespace "your-name";
#[tick]
fn main() {
/say Hello, world!
}

The annotation #[tick] tells the compiler that this function should be executed every tick. Every line that starts with a / is a command that will included in the output. You can add as many commands as you like. To begin with, you can change the message in the /say command to something else.

Building the project

  1. Navigate into the project directory.
  2. Run
    Terminal window
    shulkerscript build
    This will compile the project and output the result to the dist directory.
  3. Alternatively you can run
    Terminal window
    shulkerscript watch
    to automatically rebuild the project when a file changes.

Distributing the project

  1. Navigate into the project directory.
  2. Run
    Terminal window
    shulkerscript package
    This will create a ZIP archive containing the compiled project.
  3. You can now distribute the archive to your users.