Quote from: miguel on Wed 26/12/2012 11:42:44
- does the AGS-Lua plugin allow me to completely code a game in Lua? I understand that all the character, hotspots, objects, etc, can be "called" normally?
Yes
Quote from: miguel on Wed 26/12/2012 11:42:44
- If so, why is this debate happening? If the plugin has no "side-effects" then it should be optional. No?
It's entirely optional bu my contention is that its better in almost every way and i wsh to evangelise that to the people.
Quote from: miguel on Wed 26/12/2012 11:42:44
- where can I find some common "workarounds" to stuff like non-blocking functions? The search engine is a pain.
I would argue that there are no common work arounds because non-blocking stuff in AGS is difficult to easily modularise. Monkey may disagree.
The closest example i can think of is the Character Controller module that allows you to queue up actions for NPCs from a list of predefined actions.
This is a good example actually of a common problem in AGS that lua solves.
People often want to do something like this:
Make a character walk to a specific location and then do something when it's arrived while not blocking the interface.
In AGS one would do something like this:
bool sentGuy = false;
function MakeWalk()
{
cGuy.Walk(300,300,eNoBlock);
sentGuy = true;
}
function FinishedWalk()
{
cGuy.Say("I have arrived at 300,300");
}
function repeatedly_execute()
{
if (sentGuy && !cGuy.Walking)
{
sentGuy = false;
FinishedWalk();
}
}
I'm sure we can all agree that that is perfectly serviceable and works fine.. but can we also agree that it's a little unintuitive?
In Lua you could simply have a background coroutine for the room. Let's say I wanted a guy to do several repetative tasks in a room over and over again:
function backgroundThread()
while (true) do
cGuy:NonBlockingWalk(300,300)
cGuy:NonBlockingSay("I have arrived! I will now walk back again!")
cGuy:NonBlockingWalk(100,300)
end
end
(The NonBlocking functions are just self-yielding, reuseable, wrapper functions which are easily modularisable)
Now see how much more intuative that is? Semantically, one can say that this guy will do this things over and over again in a loop, without interrupting program flow. We've essentially self-contained his behaviour into one function without having repex involved at all. Tell me that aint cool?