DirectScript - A new scripting system

DirectScript

DirectScript is a new scripting system for sponge. It aims to combine simplicity with customization to allow server owners to make their server their own.

Development

DirectScript is currently in development, and can be tracked here: Github
You can find development releases as I progress Releases
I have also begun a wiki page to aid in your script creation Wiki

I’m very open to changes and am flexible at this point in development. There is an example script in the git that demonstrates some parts of the syntax. I welcome all feedback as to changes regarding this.

3 Likes

The language looks like a weird mix between coffeescript and javascript. Other than that, It’s pretty cool. Good luck!

Yea, I wasn’t sure where I was taking the syntax when I began. Java heavily influenced me since I mostly program in it. Hopefully the syntax will be smoothed it soon.

Why not base it on Rhino?

Correct me if I’m wrong, but Rhino just looks like an simplified adaptation of JavaScript. From the examples I saw, my language shares a lot of the same syntax as it. I’m trying to make this language simple and user-friendly, and am therefore straying away from OOP and functions, and looking more into a script-based system where you can call scripts as functions.

I must say: I don’t find DS to be considerably simpler than JS. Skript’s language, for example, is more natural language and I find that to be a little easier to pick up.

1 Like

I understand that, but I feel that it’s important to give the language’s syntax some power. In my opinion, Skript’s syntax killed its ability to do anything robust. However, I am looking for the right balance so pretty much anyone can pick this up.
Looking at the examples, the syntax looks a lot easier than what it would take in java to do the same thing, but that might just be because I’m versed in Java. Thanks for the feedback nonetheless.

I can’t stand Skript’s syntax. “Natural” is highly subjective. Of the few times I’ve written a Skript it was a chore. The documentation was difficult to navigate and find what you needed at times, and the exact syntax was sometimes a trial and error process. Just because it’s easy to read, doesn’t make it easy to write.

DS syntax looks far better. Not that I don’t have some specific complaints, like the for() loop. I’m not sure I care for a stripped down version of JS when I could just do JS. Maybe some people would like to use OOP in some scripts. What are the advantages over JS besides simplification?

I’m pretty invested in CommandHelper, but this looks interesting.

2 Likes

There are some areas of improvement definitely, and the for loop is one of them. I’m currently modifying the way the syntax is defined and implemented so that changing the syntax is extremely easy.
If people need OOP, I wouldn’t recommend this language. That being said, there aren’t many instances where objects are an absolute necessity. Some techniques, such as recursion, are still alive and well in DS.

Simplicity is a major factor in this, but it isn’t the only one:
It helps with organization of the server, having the working section of the server all in one place.
Like Sponge API does with Minecraft, it attempts to standardize certain processes in Sponge, such that statements won’t change no matter how much the API or implementation of sponge does.
It also eliminates what would eventually become a horde of sponge plugins that would be required to provide the same functionality without DS.
It creates statements for snippets of code that are often reused so that they are not required to be rewritten and/or imported into every project.

Hopefully that gives you a better idea of what DS is about. I’m also planning on updating the examples soon to provide a brief glossary of some DS syntax and functionality.

Comparing to the current state of skript for bukkit how far along is this plugin to being able to do similar things if it isn’t already progressed that far? My assumption would be there isn’t enough completed in the sponge API as I spoke to a developer who is in the process of rewriting skript for sponge and has stated that this is in fact a major issue.

A secondary question would be how large of a learning curve would there be going from using skript to using this instead as the language is very different?

This plugin is nowhere near done, and its triggers and functionality within Minecraft and Sponge is certainly lacking. Indeed, much of the Sponge API is unimplemented and thus cannot be tested, but that does not mean code cannot be written for it. In that way, I have begun to create statements and triggers for unimplemented items, such as @sethunger and the item pickup trigger. I am confident that, when fully implemented, these will work as required.

As for the second question, no doubt this language will have a higher learning curve and may be a bit more difficult to pick up. However, it is my hope that the language is easy to understand and will be well documented. This language more accurately reflects how most high-level languages are written than Skript, and that may benefit server owner in and of itself.

Looking at the examples.ds file in the source (which is constantly changing), you can see the gist of how some simple scripts are made.

Comparing this to Skript, an exemplar on Skript’s Bukkit page is:

on mine of stone:
    send "You just mined stone!" to player

Which is written as this in DS:

script("MineStone") {
	trigger("blockbreak")
	if (@block("id") == "minecraft:stone") {
		@send("You just mined stone!")
	}
}

Note: This won’t work yet because BlockBreak isn’t properly implemented by Sponge

1 Like

Noticed your gitlab was currently down, is this going to be maintained?

I am currently working with the developer to test and bugfix. I am sure when a stable/functional release is ready he will update the gitlab and download information.

Based on the progress and what is currently possible this plugin will be extremely useful for server developers who want to customize even the most fundamental or abstract aspects of their server.

The gitlab instance is back up anyway, I’m guessing it was temporarily down. :smiley:

@pqqqqq
Got to love that @ symbol syntax-y stuff. The language looks interesting, and much more functional than Skript (granted I didn’t do a huge amount with Skript).

Thanks @meguy26, it’s very ubiquitous in these “Scripting” languages, so I thought I’d keep the trend alive.

I’ve been having some issues with the Gitlab I’d been using, so I switched over to github for the time being. I don’t have access to a deploy system, so the builds won’t be up to date for now. If needed, I’ll have a latest build link available

Hey this is a very nice plugin.
BUT I just found a Bug :slightly_smiling:

In the PlayerStatement.java at line 100 you have
return Result builder().success().result(player.hasPermission(ctx.getLiteral(“Permissiom”).getString())).build();

You wrote Permissiom instead of Permission so it doesnt work on my Server. Please fix it fast so I can finish my script :slightly_smiling:

Hi, we’d like to incorporate this into our server but is there any way to get some better documentation for this?

Please have better documentation :smiley:

Would love to use this but I’m not sure all that it can do. I see the triggers, but what about events, effects, expressions, conditions and so on?

I see you have the @send but thats all I see.

This looks great! Just please make some documentation.

I don’t. i know more java than javascript ;P. How’s your documentation?