Each AGS script is now tokenised, splitting everything up into functions, statements, if, brackets etc. The tokenised script is then converted into XAGE scripts. This two stage process is a lot cleaner and easier to extend. Using OpenQuest as my AGS source, here's a cherrypicked example of where the conversion is currently at. Consider the following AGS code:
function character2_a() {
// script for Character 2 (Lifeform): Interact character
if (sInteractionVerb == sTalkTo)
{
hideGUI();
// have we already met the cleaner? If so, use a different greeting
if (GetGlobalInt(8) == 1)
{
player.Say("Greetings Carol");
cCleaner.Say("You again?");
}
else
{
player.Say("Speak lifeform!");
Wait(40);
player.Say("Is this translation matrix working?");
cCleaner.Say("You're that guy from accounts right?");
}
dCleaner.Start();
}
else if (sInteractionVerb == sSmell)
{
player.Say("This creature has an overwhelming pungent smell");
}
else if (sInteractionVerb == sMove)
{
player.Say("The lifeform is surprisingly sturdy, I don't believe I can use force");
}
else
{
triggerUnhandledEvent();
}
}
The above function now converts automatically to an XAGE script as follows:
The two provide the equivalent 1-1 functionality save for two things:
- XAGE doesn't know what 'sInteractionVerb' is (#defined in OpenQuest as Game.GlobalStrings[11]. Whereas XAGE would link each event with its own script, AGS (or AGS developers?) tend to bunch certain events to the same function, which seems unnecessarily complicated - perhaps a throwback to earlier AGS versions).
- The conversion process doesn't yet handle AGS functions calling each other (requires an XAGE object running a new XAGE script).
In the future I see a juggling act; trying to keep XAGE's design as clean as possible and yet trying to map as much AGS functionality as possible, some of it outdated and deprecated. It's gratifying nonetheless to watch the OpenQuest opening cutscene running in XAGE, albeit in a slightly clunky, stunted way.