PDA

View Full Version : SQUIDScript demo (simple xml-based scripting language)


Fall_X
07-30-2006, 10:42 AM
I needed a way to script events (cutscenes, dialogs, etc) in an AS3 game I'm making, so I came up with a basic scripting language using xml. One of the cooler features is that the language is extendable by passing it an api-object, and also that script execution can be paused (for instance, when a dialogbox is opened) and continued again (for instance, when the ok-button is pressed in the dialog box). It also supports conditions (if), loops (while), and variables. I'm working on implementing functions.

Anyway, I attached a simple example. It has a script written in xml in the first frame of the fla, but off course this could be an external file (which is actually how I intend to use it).

I do know it can still be improved (a destroy-method needs to be added etc), but it's working and pretty stable.

Please tell me what you think.

Fall_X
07-31-2006, 12:24 AM
Update!

I reworked a large part of the code :

- I now have variable scope (meaning a <then>, <else>, <loop> or <code> block always has it's own scope, with variabkle inheritance from the containing scope)
- It is now possible to pause the script from anywhere - so even a function called in an <if>-statement can pause the script, which is pretty cool
- Functions! That's right, you can now write your own functions in the scripting language, complete with parameters and a return-value - check the example in the zip.

Now, variables and scripted functions will be removed after the script has been executed, so next up is a way to specify global variables and functions.

The zip in the first post has been updated.


Come on people, gimme some feedback! :)

astgtciv
07-31-2006, 12:50 AM
Had to unset my compiler's strict mode setting to get it to compile, but it works! :) Nice... pretty soon you'll write your own Flex (oh yeah... I get it: "Faaaall_x", like saying "flex" with a japanese accent :)).

Can't wait for Fuse to be ported to AS3... (but then, 1.1 is still not officially released for AS2, is it :D)

Fall_X
07-31-2006, 01:05 AM
Yeah, it's made in non-strict mode as that's F9's default mode, I'll see if I can get it to work in strict mode but I'm not sure if it's worth it.
Not sure what Fuse is, could you explain?

Fall_X
07-31-2006, 01:40 AM
Okay, strict mode is now supported.

astgtciv
07-31-2006, 02:01 AM
Fuse (http://www.mosessupposes.com/Fuse/) is a very cool AS tween sequencing kit based on the ZigoEngine. In a way similar to what you did with SQUID, check it out. Unfortunately, its release seems to be delayed... (it's waiting for the docs to be finished, I think :))

icktoofay
10-07-2006, 06:48 PM
i like fuse