ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


This is an old revision of the document!

Table of Contents


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:

int color = PackBytes(255, 128, 0, 128); // red, green, blue, alpha
ACS_ExecuteAlways(somescript, 0, x, y, color);
functions/packbytes.1489937815.txt.gz · Last modified: 2017/03/19 17:36 by korshun