Thorium Scripting Language

So, I’ve been playing around with the Thorium scripting language lately. It’s a great project and I’m in the process of integrating Thorium into the Elysion frameworks.
The best feature is that I can use my Pascal classes directly in my script (if my class is derived from TThoriumPersistent and RegisterRTTIType is called with the correct parameters). I can declare the properties in my class and call these properties from my Thorium script without worrying about anything else.

This is a quick’n'dirty script I put together:

loadlibrary "core.std.io"
loadlibrary "elysion.kronos"

private elSprite sprite;
private elSprite sprite2;
private float angle;
private int al;

public void initialize()
{
	angle = 0;
	al = 0;

	sprite = elSprite.create();
	sprite.loadfromfile("test.png");
	sprite.x = 128;
	sprite.y = 128;

	sprite2 = elSprite.create();
	sprite2.loadfromfile("test.png");
	sprite2.x = 256;
	sprite2.y = 256;
	printf("Initialize\n");
}

public void render()
{
	sprite.draw();
	sprite2.draw();
	printf("Render\n");
}

public void update()
{
	printf("Update\n");
	angle++;
	if (angle == 360) angle = 0;
	sprite2.rotation = angle;

	al++;
	sprite.alpha = (al mod 255);

	if (sprite2.onmouseover) sprite2.visible = false;
		else sprite2.visible = true;
}

And here is the obligatory screenshot:

Graphics are loaned from Ari Feldman’s Spritelib GPL.

Read More