Closed GnaspGames closed 8 years ago
I've been thinking about this more. Maybe I should change the way Smelt is handling multiple lines all together. I used the \ backslash because I've built it to ignore any line that doesn't start with the trigger characters #
, {
, /
or !
- but maybe I should move away from that.
By making an explicit commenting syntax (I used --
to mark a comment in my code) then Smelt could be changed to believe every line is a continuation of the last line until if finds a new trigger character at the start of a line.
I need to consider this further.
Saying that... I'm not sure how Smelt would know whether a line that starts with {
is a JSON line or NBT that is continuing from a previous command. :disappointed:
Could use regex to detect open and close brackets, or perhaps a "at least one tabbed indent AND not a commandblockdefinition/command/bang/etc and this is part of the last line" test?
I'm currently using indents to denote "conditional blocks", but having the ability to actually split out large NBT tags/JSON tags is far more important.
I really wouldn't want to introduce meaning to tabs. I use tabs extensively as a formatting tool. I don't feel like they should have syntactical value that would change the behaviour of Smelt.
My main concern is this:
{
"type":"impulse",
"auto":true
}
/title @p title
{
"text":"GRAVITATE",
"color":"green",
"bold":"true"
}
How can I tell Smelt that the first set of {}
brackets is JSON to be processed by itself, and that the second set of brackets is a continuation of the /title command?
I'd suggest a solution here:
Come to think of it, why isn't creating a new function a bang command?
@SkaranYT Yes, I think you see the issue I was referring to in my comment above.
I can only see that I have to either introduce a new trigger character for JSON blocks. Say an @
symbol. For example
@{
"type":"impulse",
"auto":true
}
/title @p title
{
"text":"GRAVITATE",
"color":"green",
"bold":"true"
}
Or we're going to have to insist on using the backslash \
when we want to force the next line to be considered part of the current line. Meaning that the second {
would be in ignored in this example:
{
"type":"impulse",
"auto":true
}
/title @p title \
{
"text":"GRAVITATE",
"color":"green",
"bold":"true"
}
Seeing as; (1) we're already using \
in the current version, (2) the second example only requires a backslash to join a command with NBT data following on the next line, and (3) that this won't require folks to add a trigger character in-front of all their existing JSON blocks; I think the second idea is the best.
Thoughts?
@Moesh "Come to think of it, why isn't creating a new function a bang command?"
^^ I'm not sure what you mean here? Is this a new idea, not related to what we're talking about in this thread :wink: :wink: ?
@GnaspGames: I can only see that I have to either introduce a new trigger character for JSON blocks. Say an @ symbol
I think the new trigger is the best way to go. This also helps to differentiate clearly between a row/command-block property and a JSON/NBT Tag of a Command.
I updated the FileParser and did a Pull request. This should work now.
Thanks @SkaranYT! I have seen the request, but I haven't had time to review it yet.
Since it's going to be a breaking change for folks who are already using Smelt, I want to make sure it's good, and that folks are happy with it before pushing it out.
This has been completed with #42
Moesh raised this as an issue and I agree (http://moesh.ca/journal/time-to-release-minecraftcommandcode/#liveblog-entry-311).
I think it should be possible to determine if a line has a starting
{
bracket and then match that to a closing}
one. Maybe using a regular expression of something similar.