[ian-reeds-games] Re: A big response email

  • From: Ian Reed <support@xxxxxxxxxxxxxxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Sun, 13 Jan 2013 16:29:22 -0700

Hi Hadi,

Scripting is the same as programming. The key difference is that usually scripting refers to only small snippets of code that run in an engine that is built in an often more difficult or involved programming language.

Generally when programs expose a scripting language they are exposing only a small subset of functions and concepts to scripters so that it is easier to work in.

As an example I expose a function called say that speaks text in SAPI 5.

So in a script you might write:
say("Hello there");

Alternatively in the engine I am doing something more like the following steps at some point or other in code: I first have to include the namespace for the SAPI 5 speech synthesizer like so:
using System.Speech.Synthesis;
Then I need to create an instance of the SppeechSynthesizer object like so:
var synth = new SpeechSynthesizer();
Then I have a lot of code that reads the previous audio settings from a file so I can set this object to the correct SAPI 5 voice, volume and speech rate.
And finally I can call SpeakAsync:
synth.SpeakAsync("Hello there");
Then I also log the spoken text to the speech log.

Of course I have a global synth object I use and I make this whole process easier for me by defining my own methods that are simpler for me to call to get everything I want done.

Anyway, you only have to worry about the first line.

As one other note, scripting languages are usually dynamically typed languages which reduces the amount of syntax and makes it much easier to do small things in them.
The scripting language I'm using is javascript.

Ian Reed


Other related posts: