MiniScript: lightweight scripting language for your game

Yes. It’s a bit tricky if you haven’t done this sort of thing before. But here’s a decent starting point.

Hey all,

I’m (finally!) polishing this off and getting it ready to submit to the Asset Store. This is mainly a matter of writing documentation — I’ve had some alpha testers working with it for a while now, and what few issues they found have been fixed.

The existing MiniScript-QuickRef document will ship pretty much as-is; I’ve only tweaked the formatting a bit. In addition, I’m planning to add these much longer documents:

  • MiniScript Reference: a detailed reference for the MiniScript language and standard intrinsics, which you can deliver to your users. (You’ll want to also include a supplement documenting any new intrinsics or variables that hook into your game.)
  • Integration Guide: a document for you guys, the Unity developers who are integrating MiniScript into your games.

So, this is just an update to let everybody know it’s coming, and to say: if you have any last-minute comments, questions, or feature requests, now is a great time to speak up!

3 Likes

I’ve finished writing the MiniScript language manual. (Man, that sort of stuff is time-consuming!) Check it out here:

[MiniScript Manual

](http://luminaryapps.com/temp/MiniScript-Manual.pdf)

I just finished this, and confess that I haven’t even proof-read it yet… so if you spot any thing suspicious or unclear, please don’t hesitate to point it out!

2 Likes

Hi,

just looking for adding scripting support to one app, would miniscript allow
accessing unity components/gameobjects? (like moving objects, settings UI texts…)
either directly or by giving your own helper methods to do that?

currently testing moonsharp(lua) but its bit overly complicated, if just want to do simple things…

Directly, no; by adding your own helper methods, yes.

Each MiniScript instance runs entirely within a sandbox, there is no direct access to objects in the Unity space. But you can add your own functions and classes that bridge this gap in exactly the ways you define. This is how the MiniScript demo lets you write code that moves the little spaceship sprite around, or how in the Robo-Reindeer game, MiniScript code controls the movement of the reindeer (but only in ways permitted by the rules of the game).

So it sounds like what you want to do is exactly what MiniScript was designed for.

Sounds good, that spaceship demo looks pretty much suitable already…
(what kind of backend you have there on c# side? how self. passes the values to transform position)

Also, would this work on webgl and ios? (i guess you are not using any c# reflection stuff…)

And roughly when this one is going to asset store?

That one uses a very simple interface… the C# code can look up (and modify) values in the MiniScript global variable space. So we just define a global “ship” map containing x, y, and rot (rotation) values. The C# script, in Update, just looks this up and sets the position and rotation of the sprite accordingly.

Yep, works fine.

It won’t be long now! I just need to write that integration guide.

(But if you really can’t wait, PM me and I’ll sneak you a pre-release version.)

thanks! ill message in a week or 2 after get started on that…

Can you call a miniscript function from c#?
say i want to do this

  • miniscript: Create sphere gameobject (using helper class/method to create unity objects)
  • then in unity c#: I click that sphere and call miniscript function like, ObjectClicked(objectName)

Yes, that would be doable.

Thinking about this a bit, I guess I would instruct my script writers to write those various event handler functions (ObjectClicked, etc.), in a script with little or no global code. And then I would append to their script a bit of event-loop code, which calls custom intrinsic functions to check whether the object was clicked, collided with something, etc., and then call the appropriate methods.

So then you’d run this script, and it would sit in a loop, just checking for events each frame. And your C# MonoBehaviour would simply set the appropriate flags (clicked, collided with something, etc.) and report these to the script through those intrinsics.

I’ve just (finally!) submitted MiniScript to the Asset Store!

Hopefully Unity won’t take forever to get around to reviewing it… I’ll keep you posted!

2 Likes

Looking forward to it.

Well, nuts. There was a problem with my submission — the demo scene (the same one you see here) uses layers to keep a background canvas behind everything else, including the sprites. But when it’s imported via a package to a fresh project, that project doesn’t have the right sorting layers defined, and so the background ends up on top of everything.

So now I have to find another way to arrange this scene that doesn’t depend on project settings, and submit a fresh package to the store. I’ll keep you posted!

OK, new package is submitted!

I’m so excited about this… I think people are going to really like it. Fingers crossed for a speedy approval!

2 Likes

I am delighted to report that

MiniScript is now available in the Asset Store!

MiniScript is a high-performance, easy-to-learn scripting language for your game or simulation.

Written entirely in C#, and with Unity integration in mind, MiniScript is the best way to let your users (or your own development team!) script behaviors in your game. Applications include:

  • Add mod support, enabling users to add custom behaviors, AI, or other features, without breaking your game!
  • Create a programming game, where players write scripts to control tanks/robots/etc. in the heat of battle!
  • Give your designers the ability to easily script cut scenes, AI behaviors, and more, even in already-compiled builds of your game!

MiniScript is compatible with all platforms, and runs in a carefully constructed sandbox — MiniScript code has access to exactly those Unity values and functions you provide.

Includes a 1-page quick reference and MiniScript manual which you can deliver to your users, as well as a detailed guide to integrating Miniscript into your own game.

Handy links:

I am committed to making you successful with MiniScript. If you have any trouble, you’ll get quick and thorough support from me.

Download MiniScript now, and start making your game scriptable today!

2 Likes

Nice!

One question,
Would it be possible to implement sleep() command with this? (meaning, script execution would pause for x seconds)

*ok looks like there is wait() already, that probably works.

Yep, that’s exactly what wait does. “wait” by itself pauses 1 second, or specify how long to sleep, like “wait(2.5)”.

(As a matter of MiniScript style, when calling a function with no parameters, don’t use empty parentheses.)

That’s why I don’t like python. I think it’s probably best to stick with basic style. Didn’t hurt blitz all these years :slight_smile:

Miniscript seems interesting to me for all those things that require decision making by level designers or even dialogue trees etc… cool.

1 Like

Yeah, particularly if you deliver content (new levels, mini-games, etc.) as asset bundles… those can’t contain new C#/UnityScript code, but they could contain new MiniScript code.

In that sense, it allows you to blur the line between “data” and “code”… which could be pretty useful if you draw the line carefully.

Well, it does allow modding in a big way and should be marketed at modders as well… :slight_smile:

2 Likes

Possible to have webgl demo build? (that current one is on webplayer)