Dive Scripting!

I have recently implemented a simple scripting system into Dive, which is similar to existing console command systems found in engines like UDK and Source, but has a few slightly more advanced features in it.

Take this for example:

set foo "Hello World!"

Here I’m using Dive’s scripting system to set a variable “foo” to “Hello World!”. Simple enough, but what if I want to use the value of foo in another command? This isn’t possible with other console command systems, but here I can do this:

echo "I want to say: " $foo

Excuse the php lookalike variables, but this allows you to embed the value of variables for more dynamic console command scripts.

One of the first uses of the new console command system involves the semi-deprecation of the StartupGameState attribute. I say semi, as the attribute won’t be removed, but it is now preferred (especially for development purposes) to edit scripts/init.ds and add the following line:

# Dive init script
changestate Dive.Game.States.Tutorials.Tutorial3.MyFirstGameState

You can change the state of the game without recompiling code! How about that? There will be plenty more features to come, such as the ability use timers from the console, an actual visual console in the game window, and more!

Leave a Reply