Skip to main content

Minecraft Script Programming language

Project description

Minecraft Script

Minecraft script is primarily a tool to make Minecraft Datapack creation easier.

Minecraft Script is an interpreted programming language which goes through the Python interpreter for output.

However, interpretation is not its main feature, and is rather more of a debugging tool, as its sole

purpose is to allow you to validate your code before building it into a full datapack.

Commands

python -m minecraft_script help

python -m minecraft_script run [files: optional, multiple allowed]

python -m minecraft_script build [file]

Objects

Variables

The var keyword can be used to initialize new variables.

It can either be simply followed by a variable name, in which case it will default to 0,

or you can directly assign a value to it.

var hello1;  // initalized variable "hello1" with value 0 (default)

var hello2 = 500;  // initialized variable "hello2" with value 500



hello2 = 300;  // assigned new value 300 to variable hello2

hello2 = hello2 + 500;  // adds 500 to hello2



logtype hello2; // logs "var" in the console

log hello2;  // logs "800" in the console

Constants

The const keyword can be used to initialize and define new constants.

Unlike vars, these cannot be reassigned new values. Trying to initialize

a new constant without a value brings raises a Syntax Error.

const hello1;  // raises 'Syntax Error: Missing value in const declaration'

const hello1 = 500;

hello1 = 300;  // raises 'Type Error: Tried to assign new value to const "hello1"'



logtype hello1;  // logs "const" in the console

log hello1;  // logs "500" in the console

Functions

Functions are defined with the "function" keyword. They can be anonymous,

or be attributed a name. Parentheses around the arguments are required (currently, subject to change).

function = (a) => a * 3  // anonymous function



function add = (a, b) => a + b  // define a simple add function

add(2, 7)  // call the function; returns 9

Console logging

Console logging values with log

Logging values in MCS is as simple as typing "log", followed by an expression.

Example:

var hello1 = 500;

const hello2 = 600;



log 200 + 200;  // logs 400 in console

log hello1;  // logs 500 in console

log hello2;  // logs 600 in console

Console logging types with logtype

Logging types in MCS is equally as simple. To log an object's type, simply type "logtype" followed by the object.

Example:

var hello1 = 500;

const hello2 = 600;



logtype 400;  // logs "number" in console

logtype hello1;  // logs "var" in console

logtype hello2;  // logs "const" in console

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minecraft_script-0.1.403.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

minecraft_script-0.1.403-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file minecraft_script-0.1.403.tar.gz.

File metadata

  • Download URL: minecraft_script-0.1.403.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for minecraft_script-0.1.403.tar.gz
Algorithm Hash digest
SHA256 3e84af8a3dcb4184db66bf189a5072c518b7a172805f41d4b945071965a5c5f3
MD5 1f68b19c63e32a42ba2d65841a14e4dd
BLAKE2b-256 0b030530fd5aaf9a4fa7cfa4d52bd717c19a4ba85716eb94a3ad2d4fe0e51387

See more details on using hashes here.

File details

Details for the file minecraft_script-0.1.403-py3-none-any.whl.

File metadata

File hashes

Hashes for minecraft_script-0.1.403-py3-none-any.whl
Algorithm Hash digest
SHA256 a400deeb6c1d28ba4ac04299162a218f27f41f6f03eb1e8346fff5e48077c668
MD5 eb8e1478efb68c8ecb3a0f2ea8410a90
BLAKE2b-256 9264191eda450d517082aebbe574ee78f85a4076b0d1247dbb8add826c6a4e10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page