Total Miner Forums

Total Miner => Creative Features => Topic started by: Craig on May 12, 2015, 09:00:18 AM

Title: Considering a new script syntax
Post by: Craig on May 12, 2015, 09:00:18 AM
The current script syntax is problematic, so I've been considering a new one.

There are 4 main problems with the current syntax:

1. Everything has to be surrounded by square brackets so the script interpreter can distinguish separate parameters.

2. Parameters have to be in a fixed order and in a lot of cases can't be omitted/defaulted.

3. To accommodate #2, I have to make several versions of the same command to help script writers not have to worry about parameters they're not interested in.

4. Parameters are mostly unnamed so it's harder for script writers to remember what each parameter is, and it makes the script interpreter code more complex.

I've considered various other syntax formats, and I think the most suitable one for our scripts is the standard command line syntax most operating system command shells use.

e.g.
> command [name] [/a[=attributes]] [/b] [/c]..

where /a, /b, /c are named parameters, usually followed by some value, but not always

e.g.

rain /point=x,y,z /radius=value /duration=value /intensity=value /color=r,g,b

parameter names can be shorted to the least significant characters, e.g:

rain /p=x,y,z /r=value /d=value /i=value /c=r,g,b

any non mandatory parameters can be easily omitted, e.g:

rain /p=x,y,z /r=value
or
rain /p=x,y,z /i=value

an example of params that don't need values:

sound brook /p=x,y,z /delete
sound brook /p=x,y,z /d
or
sound brook /p=x,y,z /loop
sound brook /p=x,y,z /l

the /delete and /loop params don't need values

Parameters can be entered for the command in any order, you won't have to remember the fixed order again. e.g.

rain /p=x,y,z /r=value /d=value /i=value /c=r,g,b
and
rain /d=value /c=r,g,b /p=x,y,z /i=value /r=value

are both (the same) valid commands.

The syntax might seem a little cryptic at first, but I think once you get used to it, you'll find it much easier to write and understand scripts, and you won't have to refer to the documentation so much.

Naturally if I was to do something like this, I'd convert existing scripts to the new syntax, so you wouldn't have to worry it'll break your scripts and you wouldn't have to write them again.

In general, because you won't need square brackets anymore and you'll be able to omit unused parameters, the number of characters you'll need to type to write scripts should be reduced, speeding up the process.

Thoughts?



Title: Re: Considering a new script syntax
Post by: Zone on May 12, 2015, 09:13:06 AM
I never really had a problem with this, Would be nice to see a change in it for the new players.
Title: Re: Considering a new script syntax
Post by: Dryym on May 12, 2015, 08:13:02 PM
Would this allow for the parameters to be in any order aswell?

What would you do in the event that 2 parameter names share the same first letter, Or is the chance that the two would end up in the same script so minute that you wouldn't need to worry?
Title: Re: Considering a new script syntax
Post by: Craig on May 12, 2015, 08:17:37 PM
Would this allow for the parameters to be in any order aswell?

Parameters can be entered for the command in any order, you won't have to remember the fixed order again. e.g.

rain /p=x,y,z /r=value /d=value /i=value /c=r,g,b
and
rain /d=value /c=r,g,b /p=x,y,z /i=value /r=value

are both (the same) valid commands.

What would you do in the event that 2 parameter names share the same first letter, Or is the chance that the two would end up in the same script so minute that you wouldn't need to worry?

parameter names can be shorted to the least significant characters, e.g:
My example wasn't great because each parameter had a different first letter, but what least significant characters mean is if there are two or more parameters that start with the same letters, you just need to use enough to differentiate them

e.g.

command /point=x,y,z /player /power=5

least significant would be

command /poi=x,y,z /pl /pow=5
Title: Re: Considering a new script syntax
Post by: Dryym on May 12, 2015, 08:23:27 PM
My example wasn't great because each parameter had a different first letter, but what least significant characters mean is if there are two or more parameters that start with the same letters, you just need to use enough to differentiate them

e.g.

command /point=x,y,z /player /power=5

least significant would be

command /poi=x,y,z /pl /pow=5

This makes a lot more sense, Thanks for clearing this up.
Title: Re: Considering a new script syntax
Post by: muD on May 14, 2015, 10:49:44 AM
This appears to be a better method all round..
that'd be neat coding it to convert old format too
i see only benefits.. Are there any technical negatives?
Title: Re: Considering a new script syntax
Post by: dreadcrisont on June 07, 2015, 05:55:30 PM
wh a new santax?
Title: Re: Considering a new script syntax
Post by: PWRBTTN on July 02, 2015, 11:20:40 PM
This is my first time actually bothering to look at this topic. I don't know why, being it's sort of important to me given that this is implemented. I don't have a problem with this at all. If anything, it'll make it much simpler. My only complaint is that there seems to be a distinct lack of square brackets. I read those square brackets like gypsies read tea leaves... or something. Otherwise, it's great. This would make it much easier to come up with new scripts, too. As I wouldn't need to figure out how to arrange the parameters to avoid syntax issues. Would using square brackets in the same syntax be an issue? I mean, if not... I suppose I could deal with it.
Title: Re: Considering a new script syntax
Post by: Nefty on July 02, 2015, 11:30:36 PM
My example wasn't great because each parameter had a different first letter, but what least significant characters mean is if there are two or more parameters that start with the same letters, you just need to use enough to differentiate them

e.g.

command /point=x,y,z /player /power=5

least significant would be

command /poi=x,y,z /pl /pow=5

Could you use a capital letter for it instead? Like /Point=x,y,z /Player /Power = 5 is more significant than

command /point=x,y,z /player /power=5?
Title: Re: Considering a new script syntax
Post by: Coolo9000 on October 15, 2015, 11:57:13 PM
The current one is very simple and useful, what would the new one be like is the question...
Title: Re: Considering a new script syntax
Post by: Faint of Clubs on October 23, 2015, 01:49:29 AM
I'm a bit frightened by this honestly, as i have one main question:
What of the maps that we scripted for months, to be masterpieces?.. Would they be useless? Or would the old scripts still read exactly as before?

If the old scripts read exactly as before i love the plan.
If this would make the dedicated scripters maps obsolete i would be done with the game... (Not in a dramatic sense, just my current map is meant to be my masterpiece scriptwise, i would have no interest in starting fresh)

I just hope you arent overlooking the dedicated longtime players to make things easier for new players (who often come and go).
Could you clarify?

(Sorry, i suppose it's normal to be skeptic about that which you do not understand)
Title: Re: Considering a new script syntax
Post by: Craig on October 23, 2015, 02:47:35 AM
Naturally if I was to do something like this, I'd convert existing scripts to the new syntax, so you wouldn't have to worry it'll break your scripts and you wouldn't have to write them again.
Title: Re: Considering a new script syntax
Post by: Dark Hydrak on October 23, 2015, 02:49:39 AM
Hmm, it would take some time to get used to it but it may work out pretty well. What you should do is have a option to use either the classic scripts or the new one.
Title: Re: Considering a new script syntax
Post by: Craig on October 23, 2015, 02:51:20 AM
Hmm, it would take some time to get used to it but it may work out pretty well. What you should do is have a option to use either the classic scripts or the new one.
No, it's one or the other. One of the main drivers for the change is to make the script compiler easier to program. So there's no way I'll be supporting both.
Title: Re: Considering a new script syntax
Post by: Dark Hydrak on October 23, 2015, 02:53:11 AM
No, it's one or the other. One of the main drivers for the change is to make the script compiler easier to program. So there's no way I'll be supporting both.
Alright, I can live with that. Just as long as it actually does successfully transform our current scripts as you said it would.
Title: Re: Considering a new script syntax
Post by: Craig on October 23, 2015, 02:58:04 AM
Alright, I can live with that. Just as long as it actually does successfully transform our current scripts as you said it would.
The conversion would be done with the utmost care. I can't guarantee there will be no bugs on initial release, but we will do our best. One option may be to support both syntaxes on the initial release, and then phase out the old, but that also has it's complications.
Title: Re: Considering a new script syntax
Post by: Dark Hydrak on October 23, 2015, 03:00:48 AM
The conversion would be done with the utmost care. I can't guarantee there will be no bugs on initial release, but we will do our best. One option may be to support both syntaxes on the initial release, and then phase out the old, but that also has it's complications.
Well of course there's going to be bugs, I just hope that a major one doesn't slip past your eye and mess up 200 scripts in one world, but I have confidence that things will work smoothly.
Title: Re: Considering a new script syntax
Post by: Faint of Clubs on October 23, 2015, 03:22:40 AM


Ah i'm sorry i didnt read all the replies. Thanks alot craig! I support any decision you make, as you clearly know what's best for the game :)
Title: Re: Considering a new script syntax
Post by: Dark Hydrak on October 23, 2015, 03:32:11 AM
Quick question, is this the "simplier" version of scripts compared to the classic scripts?
Title: Re: Considering a new script syntax
Post by: Craig on October 23, 2015, 06:03:09 AM
Quick question, is this the "simplier" version of scripts compared to the classic scripts?
?
Title: Re: Considering a new script syntax
Post by: Dryym on November 07, 2015, 07:46:54 AM
Is this still being considered? Because it would make things a lot easier to do a lot quicker.
Title: Re: Considering a new script syntax
Post by: PWRBTTN on November 07, 2015, 08:40:18 AM
Is this still being considered? Because it would make things a lot easier to do a lot quicker.
Agreed. It's so dreadfully slow as it is, even with a keyboard and plenty of scripting experience. This would be so nice. Also, that good ol' in-game keypad idea that was thrown about before.
Title: Re: Considering a new script syntax
Post by: Faint of Clubs on December 27, 2015, 11:24:52 PM
Agreed. It's so dreadfully slow as it is, even with a keyboard and plenty of scripting experience. This would be so nice. Also, that good ol' in-game keypad idea that was thrown about before.

Craig, the in game keypad would be compatible with the Xbox controller chatpad accessory right?


Also I bumped this to ask if you scrapped this idea craig?
Title: Re: Considering a new script syntax
Post by: crusadorzach777 on January 05, 2016, 07:53:59 PM
Personally I love this idea.

I don't see what negatives would come of this, besides the afore mentioned old scripts possibly getting broken. Though, I dont have many maps on that I have spent months scripting in so I may be taking this lighter than others because of a slight bias.

The main reason I don't do much scripting though is because of the way the system is set up though to be honest. It's all very organized and it isn't very confusing, but it's hard and tedious. I oft find myself repeatedly looking back at the script guide to know where which parameters go where. With a system that could support any parameter anywhere I would be much happier for sure.

This idea has my stamp of aproval (If it is still being considered )
Title: Re: Considering a new script syntax
Post by: Hayden on January 05, 2016, 08:53:12 PM
I personally prefer the current state of Syntex, but possibly make it so we can do both?

Edit:I don't know what I was thinking when I wrote this... I would love the change, it would make everything a lot better!
Title: Re: Considering a new script syntax
Post by: Roz on February 24, 2016, 01:29:45 AM
Sounds like a good idea with positive outcomes if the script conversion works smoothly. With the idea of simplicity for users in mind might I make a suggestion, add a color system to the new syntax that will distinguish the command functions from variables like x,y,z and an active syntax error check that can highlight incorrect lines red while your scripting.
Example: rain /p=x,y,z /r=value /d=value /i=value /c=r,g,b/
Like was stated earlier "I read those square brackets like gypsies read tea leaves..", this could help once we get used to it.
Title: Re: Considering a new script syntax
Post by: Spark on February 24, 2016, 10:23:45 AM
Sounds like a good idea with positive outcomes if the script conversion works smoothly. With the idea of simplicity for users in mind might I make a suggestion, add a color system to the new syntax that will distinguish the command functions from variables like x,y,z and an active syntax error check that can highlight incorrect lines red while your scripting.
Example: rain /p=x,y,z /r=value /d=value /i=value /c=r,g,b/
Like was stated earlier "I read those square brackets like gypsies read tea leaves..", this could help once we get used to it.
Don't use blue. It's difficult to Read it
Title: Re: Considering a new script syntax
Post by: TM Charles on February 24, 2016, 10:40:37 AM
So i have taken another look at it and studied it.

Heres what i think, the current syntax is "easy" but not flexible.

This new way if I read it right we don't have to put them in an order nor make them follow a format. This will great for scriptures who want to make here own format in a way in the means of how were order the parameters.


Ex.

say we have the rain command "Rain [x,z] [radius] [duration] [intensity] [r,g,b]" we could make it ordered any way we want and make it to our liking.

Rain /r,g,b /duration /intensity /radius /x,z

This will also be helpful not so much for xbox but PC were instead of finding the script in the game then pasting it in and changing the parameters you would eventually learn how to write out the command in your own format or however so. I feel this will boost the productivity and the amount of people who script.

I hope this is still being considered and hope this will take over the old version.

Also the syntax we talk about on stream a few times, how if scripting was like the mob AI trees i hope can be an options too.   
Title: Re: Considering a new script syntax
Post by: OniX Lokii on December 19, 2017, 11:06:43 PM
This seems like a good idea, but the more I read into this the more I realize that I really like the current syntax the way it is. Sure it has its fair share of bugs, but if you know how to work  the scripting language to  the point of having a basic understanding (1-2 months at most) you  can find your way around them and the more you get used to doing the scrips naturally, the less errors you will encounter. I am not completely disregarding this as it is a very good concept, I just prefer the current syntax.