Alef/JIP – User
General
The server is already running a mission. At least has the mission.sqm processed. Instanced of object/vehicles are in the server address space.
Now, the JIP needs to download from the server the status and keep it updated.
mission.sqm can't be processed like the server does, because of the randomness of units/vehicles. What if server creates and object and the client not, or if the position is different? This should be an easy remember thing.
Client get data from server. Sickboy's page explains that.
OFPEC says mission.sqm/init fields are executed too.
JIP test
source
// JIP test only. Put "p" as variable name in mission.sqm for JIP player. #define TEST( xx ) _s=_s + if (xx) then {"true == "+ #xx +" ;"} else {"false == "+ #xx +" ;"}; #define PRINT( xx ) _s=_s+ #xx + " = " + (xx) +" ;"; _s="init.sqf\n"; for [{ _x=0 },{ _x<2 },{ _x=_x+1 }] do { // _u=player; // not needed // isNull // this happens in JIP if no sleep are performed before. TEST( isNull p ) TEST( isNull player ) _s=_s+"\n"; // locality TEST( local p ) TEST( local player ) _s=_s+"\n"; // isPlayer TEST( isPlayer p ) TEST( isPlayer player ) _s=_s+"\n"; // name PRINT( name p ) PRINT( name player ) // 20090415 name: "No vehicle", add an additional check for vehicle PRINT( vehicle p ) PRINT( vehicle player ) // alive PRINT( alive p ) PRINT( alive player ) _s=_s+"\nsleep 0.001;\n"; sleep 0.001; }; hint _s; localize _s; // NEW VERSION waitUntil { _s=_s+format["\n%1", time]; TEST( isNull p ) TEST( isNull player ) TEST( local p ) TEST( local player ) TEST( isPlayer p ) TEST( isPlayer player ) PRINT( name p ) PRINT( name player ) PRINT( vehicle p ) PRINT( vehicle player ) PRINT( alive p ) PRINT( alive player ) name player != "Error: No vehicle"; }
output (edited)
hosting game (p != player) | ||||||||||||
time | ||||||||||||
p | player | p | player | p | player | p | player | p | player | p | player | |
any | false | false | true | true | false | true | Roberto Duarte | alef | TODO | TODO | TODO | TODO |
JIP | ||||||||||||
time | ||||||||||||
p | player | p | player | p | player | p | player | p | player | p | player | |
0 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | TODO | TODO | TODO | TODO |
0.001 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | TODO | TODO | TODO | TODO |
JIP, changed to sleep 1 second | ||||||||||||
time | ||||||||||||
p | player | p | player | p | player | p | player | p | player | p | player | |
0 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | TODO | TODO | TODO | TODO |
1 | false | false | true | true | true | true | alef (2) | alef (2) | TODO | TODO | TODO | TODO |
JIP, monitored with SPON Core, loop until name player != "no veh" | ||||||||||||
time | ||||||||||||
p | player | p | player | p | player | p | player | p | player | p | player | |
0 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=1 | false | true | false | false | false | false | Doberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=2 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=3 | false | false | true | true | true | true | alef (2) | alef (2) | p | p | true | true |
comments
So what's happened?
ok, as we enter, player is null. so just waitUntil{!(isNull player)}, like XEH does.
- name p = Roberto Duarte ; name player = Error: No vehicle ;
name of unit p is the random created.
No setIdentity in the mission: it would work looking in description.ext/CfgIdentities.
"name player" says there is no vehicle for it, because player is still null.
Maybe arma waits assigning a vehicle until Description.ext has been parsed.
- local p ; local player ;
- isPlayer p ; isPlayer player ;
- name p = alef (2) ; name player = alef (2) ;
Now the name of unit p has been assigned to the player's name. XEH does a waitUntil{local player} after checking for null. It could be possible that under heavy load (ACE bug #778), name is not assigned while player being local.
Call stack in ace tracking for #778
XEH: PostInit.sqf, time == 0 XEH: isNull player XEH: waited for !(isNull player) XEH: waited for local player time > 0 XEH: waited for !isNull (group player) XEH: ... { [] call _x } forEach _PostInits; -> XEH_PostInit_Once.sqf: register fUpdateUnits XEH: { _x call SLX_XEH_init } forEach SLX_XEH_OBJECTS; // Run InitPosts SLX_XEH_init=XEH\Init.sqf config.cpp:h\Eventhandlers.hpp: Extended_InitPost_EventHandlers::CAManBase::ace_sys_tracking:: init = "(_this select 0) call ace_sys_tracking_initMan"; onRespawn = 1; s/initMan.sqf: spawn s/loopGroup.sqf s/loopGroup.sqf: first time and every 10 or more seconds (very roughly) s/loopGroup.sqf:35: call { call ace_sys_tracking_fUpdateUnits } s/fUpdateUnits.sqf: [_units] s/fUpdateUnits.sqf: alive _x && "<null>" == _x getVariable "ace_sys_tracking_player" s/fUpdateUnits.sqf: _x setVariable ["ace_sys_tracking_name", name _x]