Scripting

Scripting’s done. And I use the term “Scripting” lightly.

All “scripts” are hard-coded into the game. For instance, a sample short script would look like the following:

    Add(new StopMusicPoint(m_audio));
    // Whistler fades in.
    Add(new CreateEntityPoint(this, m_audio, m_renderer, m_world, "Whistler", "Whistler", Vec2(14,1)));
    Add(new LerpEntityVarPoint(this, "Whistler", "alpha", 0, 0.5f, 50));

    Add(new DialogPoint(m_audio, m_renderer, 0xFF7FFF7F, 20, "Sound\\3-1.ogg",  "<WHISTLER> 'Nuther seal down, Jack?  Good for you!  Man, you're sweatin' like a pig...you look like you could use a towel."));
    Add(new DialogPoint(m_audio, m_renderer, 0xFF7F7FFF, 20, "Sound\\3-2.ogg",  "<JACK> Silly me for leaving home without it.  Arthur Dent would be so disappointed."));
    Add(new DialogPoint(m_audio, m_renderer, 0xFF7FFF7F, 20, "Sound\\3-3.ogg",  "<WHISTLER> Who?"));
    Add(new DialogPoint(m_audio, m_renderer, 0xFF7F7FFF, 20, "Sound\\3-4.ogg",  "<JACK> Just a...nevermind."));
    SkipTo();

Basically, that creates an entity named “Whistler” given the entity type “Whistler”, lerps its alpha value from 0 to 0.5, plays a bunch of dialog (the dialog point both plays the ogg dialog sound file and displays the text), then ends.

The SkipTo lets the script know that this is the point that it skips to when the user skips a cutscene. I’m not using it to make unskippable sections, it’s just a quick hack because I’m also using scripts to set up the background music at the beginning of each music zone, so I don’t want the player to be able to skip THAT.

Anyway, a couple of screenshots to tide you over. The first shows a script that’s running (along with the shopkeeper, Whistler P. Higgins), and the second shows the game running in wireframe (That’s right, I’m not using textures! For anything!)


Click to enlarge

Anyway, I hope to finish up the history details in an entry soon…I haven’t had much time to do so!

Leave a Reply

Your email address will not be published. Required fields are marked *