Alef/JIP – User

From Bohemia Interactive Community
< User:Alef
Revision as of 09:25, 15 April 2009 by Alef (talk | contribs)
Jump to navigation Jump to search

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 as by the server because of the randomness. What if server creates and object and the client not, or if the position is different? This should be an easy remember thing.


JIP test

// JIP test only. Put "p" as variable name in mission.sqm for JIP player.
#define TEST( xx ) if ( xx ) then { _s=_s+ #xx +" ;" };
#define PRINT( xx ) _s=_s+ #xx + " = " + xx +" ;" ;
_s="init.sqf\n";
for [{ _x=0 },{ _x<2 },{ _x=_x+1 }] do {
    _u=player;
    // isNull
    // this happens in JIP if no sleep are performed before.
    TEST( isNull p )
    TEST( isNull _u )
    TEST( isNull player )
    _s=_s+"\n";
    // locality
    // get player dereferenced? is only the pointer tested?
    TEST( local p )
    TEST( local _u )
    TEST( local player )
    _s=_s+"\n";
    // isPlayer 
    // should this check if a unit is pointed by player?
    TEST( isPlayer p )
    TEST( isPlayer _u )
    TEST( isPlayer player )
    _s=_s+"\n";
    // name
    // the root of all this, see ace/xeh bug
    PRINT( name p )
    PRINT( name _u )
    PRINT( name player )
    // 20090415 "No vehicle", add an additional check for vehicle
    PRINT( vehicle p )
    PRINT( vehicle _u )
    PRINT( vehicle player )
    _s=_s+"\nsleep 0.001;\n";
    sleep 0.001;
};
hint _s;
localize _s;


Output (edited) on hosting game:

local p ; local _u ; local player ;
isPlayer _u ; isPlayer player ; 
name p = Roberto Duarte ; name _u = alef ; name player = alef ;
sleep 0.001;
local p ; local _u ; local player ;
isPlayer _u ; isPlayer player ;
name p = Roberto Duarte ; name _u = alef ; name player = alef ;

Output (edited) on JIP:

isNull _u ; isNull player ;
name p = Roberto Duarte ; name _u = Error: No vehicle ; name player = Error: No vehicle ;
sleep 0.001;
isNull _u ; isNull player ;
name p = Roberto Duarte ; name _u = Error: No vehicle ; name player = Error: No vehicle ;

Output (edited) on JIP, using sleep 1:

isNull _u ; isNull player ;
name p = Roberto Duarte ; name _u = Error: No vehicle ; name player = Error: No vehicle ;
sleep 1;
local p ; local _u ; local player ;
isPlayer p ; isPlayer _u ; isPlayer ;
name p = alef (2) ; name _u = alef (2) ; name player = alef (2) ;