GnaspGames / Smelt

A CLI tool for Minecraft map makers
http://smelt.gnasp.com
MIT License
19 stars 4 forks source link

Constants #36

Closed JBartelsson closed 8 years ago

JBartelsson commented 8 years ago

Hi, I thought about constants in the .mcc file that smelt uses to compile the command.

#Constant
{"type":"repeat","auto":true}
const CONSTANT VALUE
/say *CONSTANT

Defining a constant via const then follows the name of the constant Value and then the value of the constant something like 20 or Hello

(Note: I dont know how smelt compiles data types but if necessary you need to give the constant a different data type. Example: /say XXX needs a string {NoAI:1b} needs a byte {Damage:25s} needs a short and so on)

So maybe add data type abbreviation after const CONSTANT VALUE

Thanks for reading, Skaran

GnaspGames commented 8 years ago

I do like this; I would call it "variables" though, not "constants", and I think I would use a new line prefix to define vars, any line starting with $ would be expected to be a variable definition. Then anytime that variable is found in any other line it would be replaced.

$message=This is a message

{"type":"repeat","auto":true}
/say $message

I won't worry about data types. I'll treat everything as a string. It will be up to the user to specify it correctly.

I won't try to get this in to version 1.0.0 - maybe 1.1.0 or later.

GnaspGames commented 8 years ago

This has been completed with #42