Planning a script plugin - Thoughts?

Hello, I am currently planning a script plugin for Sponge, to allow non-programmers to create a “mini plugin”. I would like to get the community’s feedback on syntax and features, to make sure that this plugin gets made right. Here is what I am currently thinking of:

  • Based around events
  • Events are listened to using on <eventname>:
  • Indentation is matters, and code statements must be a single-line

I’m sure that I am missing things from the above list, so here is an example of what the code would look like:

on rightclick:
    if player has permission "test.permission":
        cancel event
    send "You clicked a block!" to player

Please reply with your thoughts and suggestions!

Call a script from another script.

script1:
    on rightclick:
        if player has permission "test.permission":
            cancel event
        else
            call script2
script2:
    send "You clicked a block!" to player

Make sure they can use Text objects

Do you mean being able to format the text?

Sort of. They should be able to send JSON messages, at least.

@pie_flavor

Thanks for the suggestion, I will include that.

@djxy

Thanks, I’ll see about including that. I don’t want to complicate my language too much, I want it to be simple enough that anyone can pick it up within a few minutes.

Plugins should be able to inject methods and objects into scripts so your plugin is a possibility to extend my plugin via user written scripts. It’s like the javascript plugin that already exists.
Edit: [Discontinued] ✏ Create a plugin in JavaScript [v2.0.2] https://github.com/djxy/SpongeJavaScript/wiki/How-to-interact-with-the-scripts

Make it a full-fledged programming language. I’m being a bit sarcastic, but I’d like to see something unbelievably complex that has a simple syntax, and can quickly accomplish small tasks. Also, use the @ symbol, I really like that symbol. :slight_smile:

Edit:
Out of curiosity, how do you plan to handle syntax parsing? I’ve actually “written” 4 different general purpose scripting languages, although only two ran, and one of those looked like an badly written batch file. The last one is still in development, and has a much more powerful parser, albeit a very slow one. I just can’t seem to get parsing right, and I’d be interested to see a language progress.

@RandomByte

Ok, I will think about including that.

@Socratic_Phoenix

That sound like a very interesting idea. I will probably start small, but continue to add more and more features. As for parsing, this is my plan:

  • Split the file into individual lines
  • Check the “indent level” of the line (i.e. 4 spaces makes one indent level)
  • Split the line into tokens
  • Read each individual token, and decide what the line should do. The indent level will be used in determining what the line does.

You should go by scope like this.

Global scope

script/function
    script/function scope

    if (condition)
        if scope

    end
end(script/function)

Each scope inherit of his parent

Don’t mind about the syntax, it was just to ease the example.

If you’re planning on making a mini programming language, you could use Antlr, which helps with the parsing and lexing.

Or you can use javacc.

@DotDash @DDoS

Thank you for informing me about these. I will take a look at them.