OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Mr.Peanut on 09 Sep 2008, 18:25:46
-
I am trying to make an enhanced publicvariable system in which each node has its own "channel", data may be sent from node to node, and a simple handshake verifies data delivery. As I plowed forward I suddenly realised "How the hell am I going to pack and unpack the data?"
Each node has a its own variable it monitors through a public event handler. Each "message" publicVariable'd through that variable has the form of an array:
[_tx, _datapack] where _tx is a header and
_datapack = []; {_datapack = _datapack + [[_x, call compile _x]]} forEach _data; where _data is an array of the variable names you want to PV.
How would I go about unpacking the data? Somehow I know:
{call compile (_x select 0) + " = " + str(_x select 1);} forEach _datapack;is garbage since the call compile _x used in data packing would, for objects, return local pointers not valid on the receiving machine. Help... :blink:
-
The user has to give you the variable names and not the variable itself.
-
He is, but I am wrapping them.
How about:
{_tmp = _x select 1; call compile (_x select 0) + " = _tmp;";} forEach _datapack;
-
That should work.