Nice work CruzR, I've been meaning to doctor up LuaArguments so you can return a table (the cleaner syntax of your original plan is much nicer), but have not had a chance to get to it yet
Extra long week-end starting in 12 or so hours though, so I'll get that to you soon hopefully
I would imagine that a script ought to be able to filter message each message that is sent or received by a player: for each message in, it can let it through or replace it or suppress it. And at any point in can choose to send new messages, with a choice of whether they are echoed to the player's own console.
Good idea, should only need a suppressChatMessage() and an addChatText(), although addDialog() could probably be modified to accept player names to handle the second.
And there should be shared state in the script for these different event hooks, so it can consume all sent messages and then, a while later, send them. With this, it is not necessary for all messages that are understood by scripts to be one-liners.
You can imagine scripts that communicate with each other without their messages to each other being displayed to either player. This might make very interesting team-based collective scripts possible; AI meta-players, even.
There is only one LuaState when the game is running anyway, so the engine doesn't need to do anything special here, it can be done from Lua already (or will be with the above added function(s)).
I've added the following query functions,
getPlayerCount()
getHumanPlayerIndex()
getPlayerName()
getPlayerTeam()
getPlayerColour()
These are meant to be helpful for Omega's "give orders to semi-AI players via chat" scenarios, hopefully there are
There are also some undocumented AI helper functions I added some time ago, not going to reveal anything more than that at this point, because I'm not sure what state I left them in