This is an old revision of the document!
int PackBytes(int byte1, int byte2, int byte3, int byte4)
Packs four bytes into one integer and returns the result. The bytes' values must be in [0, 255] range.
The packed values can be retrieved using UnpackByte.
This functions can be used to pass more than 3 or 4 arguments to a script in a readable way.
int packed = PackBytes(10, 11, 12, 13); UnpackByte1(packed) -> 10 UnpackByte2(packed) -> 11 UnpackByte3(packed) -> 12 UnpackByte4(packed) -> 13
Passing a color to a script:
function void SomeFunction(void) { // red, green, blue, alpha int color = PackBytes(255, 128, 0, 128); ACS_ExecuteAlways(somescript, 0, x, y, color); } script somescript (int x, int y, int color) { int r = UnpackByte1(color); int g = UnpackByte2(color); int b = UnpackByte3(color); int a = UnpackByte4(color); }