Someone knows how to use the .xs functionality? Is there any documentation?

Hi everyone,

Does someone know how to use the feature announced regarding the “.xs” new functionality?
What’s that for?


Apparently it is similar to the XS script used for AI modding in aoe3 and aom, but restricted to fewer functions (only the xs).

This site explains the semantics and few commands for XS:

It is actually pretty cool, I have tested it. To begin with, for example, we now have infinite global variables to define and play with.
We also have arrays of int, float, string, and vector types.
One can also create rules which can fire at desired frequency.

The most interesting thing are the new functions they added for aoe2DE, which are however undocumented!!
It would be really cool for example to modify the unit values/units attributes of the dataset from the script…

I really hope they will release a little documentation, at least to know the functions signatures etc…

1 Like

Thanks for your link!
Sounds pretty cool.
I am learning from that article.

I think so as well.

1 Like

Taken from the aoe discord. From user “andi”, answering Sogomn, who had the same question as you

i asked a dev about em
he gave me this short description. but no definitive guide right now

// Returns the value of Trigger Variable 0.

int getTriggerVariable()
return (xsTriggerVariable(0));

// Set Trigger Variable 0 to 100.

void setTriggerVariable()
xsSetTriggerVariable(0, 100);

// Get the food amount of player 1.

int getPlayerOneFood()
return (xsPlayerAttribute(1, 0));

// Set player 1 food to 100.

void setPlayerOneFood()
xsSetPlayerAttribute(1, 0, 100);

// Chat player 1’s food.

void chatFood()
int food = xsPlayerAttribute(1,0);
xsChatData(“Player one food: %d” , food);

1 Like

I wrote a short intro of it on aokh:,44731,,30

1 Like

In the link I have posted above a lot of xs functionalities are explained!!

1 Like

I have contacted the developers and they said that they don’t have a documentation as of now, but they noted the feedback and will see what they will be able to release.

1 Like

Thanks for your answer!
I’ll read that, as this feature was something intriguing regarding the recent changes.

Days passed. Is there any news about the xs script document? :smiley:

Where your tutorial?lazy tone of babalossa!
you wanna ride warship with that only little voice?

The developers posted this page with the documentation about the functions they released.

However, the set of new functions is limited to the ones we already knew.
Luckily xs has already other built-in functions for Vectors, Arrays, rules and get current time. These functions can be found on the link I have posted previously, and on

I did not find other people mentioning it but, for strings, it is much more powerful to directly put them together with the addition operator:
string str = "a"+"c";
so you can pass multiple arguments to xsChatData for example, not only one:
int player = 1;
int resource_ID = xsTriggerVariable(0);
int value = xsTriggerVariable(1);
xsSetPlayerAttribute(player, resource, value);
xsChatData("I have just set Player " + player + " resource ID " + resource_ID + " to " + value);

Here I generate a very Detailed guide for XS script (writen in Chinese).
Title Translated:

XS脚本指南 + 4则实用函数
XS Script Guide + 4 Practical Functions

1 Like

For anyone still wondering, there are extensive resources about XS to be found here:

This is a community made resource, but even the official xs pages refer to this site.

(Disclaimer: I’ve helped set this site up)