This is an old revision of the document!
int PackShorts(int short1, int short2)
Packs two short integers (-32768 to 32767) into one integer and returns the result. The short integers must be in the [-32768, 32767] range.
The packed values can be retrieved using UnpackShorts.
You can also pack individual bytes (0 to 256) using PackBytes.
If you need more extreme packing, you should code it yourself.
// Pack rounded 2D actor positioninto a single integer. int packed = PackShorts(12345, -15000); UnpackShort1(packed) -> 12345 UnpackShort2(packed) -> -15000
Passing a 2D actor position to a script:
function void SomeFunction(void) { // Pack rounded 2D actor position into a single integer. int pos = PackShorts(GetActorX(0)>>16, GetActorY(0)>>16); ACS_ExecuteAlways(somescript, 0, stuff, stuff, pos); } script somescript (int stuff, int stuff, int pos) { // Extract actor position int x = UnpackShort1(pos); int y = UnpackShort2(pos); }