But Trepan added a set of 6 or 7 functions to the AI interface.
They were removed in a later commit.
Why dont you just send the AI a command?
AIs dont recieve commands.
But you can send commands to lua right?
Yes but that isnt good enough
Why?
Commands dont have string parameters, they're just lists of floating point nubmers.
Whats wrong with floating point numbers?
Nothing meaningful can eb represented using them that wouldnt require AIs recieving data from lua or a very longwinded and horrible method of encoding strings as floatingf point numbers
But commands have string parameters!!
No they dont, this is just a lua thing.
But look here at "shift": GiveOrderToUnit(unitID, CMD_ANYTHING, { "1" }, { "shift" })
Thats just something trepan used in hsi API, the spring lua API will translate that into an unsigned char value which goes into a command structure to signify a key modifier, you cant just store arbitrary string values that way:
Code: Select all
struct Command {
CR_DECLARE_STRUCT(Command);
Command()
: timeOut(INT_MAX), options(0), tag(0) {};
int id;
vector<float> params;
unsigned char options;
unsigned int tag;
int timeOut; // remove this command after this frame
// can only be set locally, not sent over net
// (used for temporary orders)
};
Without lua -> AI communication, AIs that play mods that use lua is virtually impossible. Theyd have to be dumbed down greatly in order to play the game and they wouldnt play well at all, it just wouldnt be worth even attempting.