d3nn16 3 Posted December 18, 2007 In my MP map the server has to send 2 arrays of arrays of integers to all the clients. Each of the 2 arrays has a maximum of 12 arrays and each of the 12 arrays has a maximum of 14 integers. That makes a maximum of 168 integers (~ 2 x 4 x 168 ~ 1344 Bytes). In practice, there are less integers sent than the maximum. It is around 7. So this makes ~ 2 x 4 x 84 ~ 672 Bytes. Is there a way to make clients wait for the server to send the arrays in the Init.sqf or do I have to make a loop in a script (outside the init.sqf) that waits for the array variables to be "publicvariabled" by the server ? In the Init.sqf I tried waitUntil {not isNil "arrayVar1" and not isNil "arrayVar2"} and also a while-do loop with a sleep command but the game always seems to stop at these loops and don't continue with the instructions that follow them. I suppose it is because the loop reaches a max limit and then the game exits the Init.sqs script or maybe the sleep command is too big (1 second ?). Is there an efficient way to make clients wait for variables "publicVariabled" by servers at the initialization of a mission ? Or must it be done outside the init.sqf ? If I launch a script that loops from the Init.sqf is it executed during briefing ? Right now I have waitUntil loops in my Init.sqf that wait for some variables (of numbers) to be initialized (some are "publicVariabled" by server some are not like player variable). Anyone has a better suggestion to how to do the variable communication between server and client at mission start ? Share this post Link to post Share on other sites
dr_eyeball 16 Posted December 19, 2007 I presume you know that publicVariable cannot send arrays, so you need to use the work around of converting simple arrays to a string and upon receiving the variable, you can then convert it back to an array. i.e. server: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array = [1,2,[3,4],5]; PV_str = str(_array); publicVariable "PV_str"; client: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array = call compile PV_str; As far as the client waiting, try something like: client: init.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">PV_str = ""; [] execVM 'waitForServer.sqf'; // script is spawned, therefore init.sqf will continue processing. client: waitForServer.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waitUntil {PV_str != ""}; ... Too much to read, interpret and guess, show some code instead. Share this post Link to post Share on other sites
t_d 47 Posted December 19, 2007 or you wait for 1.09 Share this post Link to post Share on other sites
d3nn16 3 Posted December 19, 2007 Thanks! I didn't read carefully enough the PV description in the Biki. I'll post the scripts in another topic, it's about how to create a random labyrinth. Share this post Link to post Share on other sites
sickboy 13 Posted December 19, 2007 or you wait for 1.09 What publicArray or alike function do we get then at 1.09? Share this post Link to post Share on other sites
t_d 47 Posted December 19, 2007 publicVariable will be able to send every datatype then Share this post Link to post Share on other sites
loyalguard 15 Posted December 19, 2007 publicVariable will be able to send every datatype then  That will be fantastic for simplyfing a lot of MP scripting methods!!! Share this post Link to post Share on other sites
zaphod 0 Posted December 19, 2007 @T_D: when??? the year is almost over... Share this post Link to post Share on other sites
TheJay 0 Posted December 19, 2007 publicVariable will be able to send every datatype then I need to change my pants. Share this post Link to post Share on other sites
UNN 0 Posted December 20, 2007 Quote[/b] ]That will be fantastic for simplyfing a lot of MP scripting methods!!! Well at least one MP scripting method...Unless... Even nested arrays, and or object pointers? I guess they are keeping this quiet on the wiki. Share this post Link to post Share on other sites
sickboy 13 Posted December 20, 2007 publicVariable will be able to send every datatype then Thanks for sharing! I don't mind waiting for it until mid 2008, if more of these sudden feature additions pop up Share this post Link to post Share on other sites