Scripting tutorial #2: General Concepts and Syntax Rules

Remember the Goal

Understanding the intent behind a tool can help you get more out of it than you'd expect. The best programs out there are usually built around accomplishing a single, specific goal, and this determines everything from how they process data to how they interact with the user. Mike's Sprite Editor is, at heart, an image editor. Thus, the scripting language it uses is unique and entirely aimed at editing images.

This is not a common choice, as programs with scripting capabilities usually adopt an existing programming language like Scheme, Python, Lua, or Javascript rather than create their own from scratch. Now, these are all great languages, and the programs that use them are often excellent tools in their own right, but there's just one problem: these languages were created with specific purposes in mind, and those purposes may not translate directly into something the user needs. In fact, these languages are often used to create entire programs, so using them to supplement another program is often overkill.

Ultimately, scripting tools like those used in this editor are provided to make things easier - they're a shortcut, nothing more.

The Eight Syntax Rules

When we're talking about a language's "syntax", we're talking about the rules that govern how a language's sentences are formed. In English, this usually means we have a subject, object, and verb that are connected in a specific order. The sentence "Alice is going to the store" is easily understood, as it uses the Subject-Verb-Object pattern we normally see in English. We could say "To the store, Alice is going", but then we'd just sound like a Yoda impersonator.

Computers, for all their number crunching abilities, are actually really bad at understanding instructions that aren't written in just the right way. This is especially true for Mike's Sprite Editor, as it was designed to follow a very limited grammar.

In fact, the scripting language's grammar is so simple, it can be described with eight rules:

 

On to the next tutorial page -->

Project Hosted by
Download Mike\'s Sprite Editor