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.402.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

minecraft_script-0.1.402-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minecraft_script-0.1.402.tar.gz
  • Upload date:
  • Size: 10.5 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.402.tar.gz
Algorithm Hash digest
SHA256 78bd6f8c90383770b7163428835c71418aa22f21b61ba526a2a6217e0fec9b39
MD5 04ec2622c6e26d535efac5cf629085fa
BLAKE2b-256 546c67dcc11b3618898d6cf792e6f5e835362f9ae4f55222d18b0e3a0c484dbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for minecraft_script-0.1.402-py3-none-any.whl
Algorithm Hash digest
SHA256 663bf012e75267ac53d9edfd7979b2f22d9c18f97571babc05cc77a77796f522
MD5 0a73b0b6fa2689bab3f0c6e3c6fdafa3
BLAKE2b-256 d37be62b7e7ebd2dc0e71d33d80428d2f003afc58083b7faad690a6b0162c16d

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