Is there a way to do something like this?
function CallMe()
{
// something useful;
}
// later in script say,
execute("CallMe");
and execute the method by name instead of calling it. I'm sure you're wondering why. I was thinking about a module, and I wanted to be able to write AI code someplace else, but let the module call it without really knowing about. So, the client of the module could say,
function MyAI()
{
// smart ai coding
}
// call a method to register the ai function.
RegisterMyAIFunction("MyAI");
Then, the module could call it when neccessary.
So, basically, does anyone know of a function that lets you call another function by name?
That is not currently supported by AGS, because it would require some sort of run-time linking that it not supported by the script engine at the current time.
I can see the uses of this in allowing a module or the global script to call room scripts, so I'm not ruling it out, but it certainly won't happen soon, I'm afraid.