Author Topic: [Scripts] Considering a new script syntax  (Read 4976 times)

0 Members and 1 Guest are viewing this topic.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6497
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
[Scripts] Considering a new script syntax
« 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?



« Last Edit: May 12, 2015, 09:11:40 AM by Craig »

Zone

  • Elite Member
  • *****
  • Posts: 508
  • Total Miner Youtuber
  • Awards 2 years on site+300 posts 1 year on site+100 posts
    • View Profile
    • Youtube Channel
    • Awards
  • Xbox: IGs x Zone
Re: Considering a new script syntax
« Reply #1 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.
Spoiler for Hidden Content:
Your getting close
Spoiler for Hidden Content:
So close
Spoiler for Hidden Content:
Come on you can do it!
Spoiler for Hidden Content:
Can you feel the burn??
Spoiler for Hidden Content:
Your on fire!
Spoiler for Hidden Content:
Cold
Spoiler for Hidden Content:
Hot
Spoiler for Hidden Content:
HOT!!
Spoiler for Hidden Content:
Hi :D

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4204
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Considering a new script syntax
« Reply #2 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?

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6497
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
Re: Considering a new script syntax
« Reply #3 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

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4204
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Considering a new script syntax
« Reply #4 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.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

muD

  • Legendary Member
  • *****
  • Posts: 1177
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members Day 1 w/25+ posts (4/12/13) 2 years on site+300 posts Former MotM winners 1 year on site+100 posts
    • View Profile
    • Awards
Re: Considering a new script syntax
« Reply #5 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?

dreadcrisont

  • Fresh Meat
  • *
  • Posts: 4
    • View Profile
    • Awards
  • Xbox: dreadcrisont
Re: Considering a new script syntax
« Reply #6 on: June 07, 2015, 05:55:30 PM »
wh a new santax?
_|..____________________, ,
/ `___________-_____|]= = = = = D
../_==o;;;;;;;;_______.:/
..), .(_(__) /
.// (..) ), -
//___//
..//___

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1150
  • Professional Expert, Comrade
  • Awards Awarded to exemplary forum members 2 years on site+300 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: Considering a new script syntax
« Reply #7 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.
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail         

Nefty

  • Supreme Member
  • *****
  • Posts: 2329
  • YT: Nefty
  • Awards Site art contributions/TPs in-game/Contest winners 3 years on site+600 posts 2 years on site+300 posts 1 year on site+100 posts Former MotM winners
    • View Profile
    • Youtube
    • Awards
  • Xbox: GoatOnTheMoon
  • PSN: N/A
  • Steam: GoatOnTheMoon
Re: Considering a new script syntax
« Reply #8 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?
Visit My Youtube: LINK

Coolo9000

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
    • Awards
  • Xbox: TBR Gho5t33z
  • Steam: ThEPWN3r311
Re: Considering a new script syntax
« Reply #9 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...
« Last Edit: February 12, 2016, 05:56:43 PM by Coolo9000 »

Faint of Clubs

  • Sr. Member
  • ****
  • Posts: 364
    • View Profile
    • Awards
  • Xbox: Faintcub7332217
Re: Considering a new script syntax
« Reply #10 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)
That guy with dem scripts.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6497
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
Re: Considering a new script syntax
« Reply #11 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.
« Last Edit: October 23, 2015, 02:50:09 AM by Craig »

Dark Hydrak

  • Elite Member
  • *****
  • Posts: 508
    • View Profile
    • Awards
Re: Considering a new script syntax
« Reply #12 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.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6497
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
Re: Considering a new script syntax
« Reply #13 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.

Dark Hydrak

  • Elite Member
  • *****
  • Posts: 508
    • View Profile
    • Awards
Re: Considering a new script syntax
« Reply #14 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.