Scripted plugins (v0.1)
Charlie Brej
plymouth at brej.org
Tue May 19 05:39:50 PDT 2009
This is a repost as the other mail got lost in moderation.
I have managed to get the language to a state where I can write my first
scripted plugin. There are hacks all over the place but at this point I can at
least see things that the language is causing which makes debugging at least
possible.
The code is atrocious as it is still all up in the air as to what the groupings
should be but it is settling down (all the file, struct and function names are
wrong).
The linked code[1] and patch[2] are against the plugin-rework branch. If anyone
feels like giving it a go then ping me in IRC for any help.
If it works then it should give something like this[3]:
Using this script:
index = 0;
while (index<10){
sprites[index] = SpriteNewWithImage("fedora.png");
sprites[index].xd = 10 - index;
sprites[index].yd = 1 + index;
index = index + 1;
}
random = 1;
fun update_logo_sprite (sprite){
image_width = ImageGetWidth (sprite.image);
image_height = ImageGetHeight(sprite.image);
if (sprite.x < 0)
sprite.xd = global.random % 5 + 1;
if (sprite.y < 0)
sprite.yd = global.random % 5 + 1;
if ((sprite.x + image_width) > 800)
sprite.xd = 0 - (global.random % 5 + 1);
if ((sprite.y + image_height) > 600)
sprite.yd = 0 - (global.random % 5 + 1);
global.random = (1 + global.random * 7) % 101;
sprite.x = sprite.x + sprite.xd;
sprite.y = sprite.y + sprite.yd;
SpriteUpdate(sprite);
}
fun refresh (){
index = 0;
while (index<10){
update_logo_sprite (sprites[index]);
index = index + 1;
}
return;
}
return refresh;
[1] http://www.cs.man.ac.uk/~brejc8/temp/script.tar.gz
[2] http://www.cs.man.ac.uk/~brejc8/temp/script.patch
[3] http://www.cs.man.ac.uk/~brejc8/temp/script.swf
More information about the plymouth
mailing list