Alef/JIP – User

From Bohemia Interactive Community
Jump to navigation Jump to search
Line 17: Line 17:
_s="init.sqf\n";
_s="init.sqf\n";
for [{ _x=0 },{ _x<2 },{ _x=_x+1 }] do {
for [{ _x=0 },{ _x<2 },{ _x=_x+1 }] do {
     _u=player;
     // _u=player; // not needed
     // isNull
     // isNull
     // this happens in JIP if no sleep are performed before.
     // this happens in JIP if no sleep are performed before.
     TEST( isNull p )
     TEST( isNull p )
    TEST( isNull _u )
     TEST( isNull player )
     TEST( isNull player )
     _s=_s+"\n";
     _s=_s+"\n";
Line 27: Line 26:
     // get player dereferenced? is only the pointer tested?
     // get player dereferenced? is only the pointer tested?
     TEST( local p )
     TEST( local p )
    TEST( local _u )
     TEST( local player )
     TEST( local player )
     _s=_s+"\n";
     _s=_s+"\n";
Line 33: Line 31:
     // should this check if a unit is pointed by player?
     // should this check if a unit is pointed by player?
     TEST( isPlayer p )
     TEST( isPlayer p )
    TEST( isPlayer _u )
     TEST( isPlayer player )
     TEST( isPlayer player )
     _s=_s+"\n";
     _s=_s+"\n";
Line 39: Line 36:
     // the root of all this, see ace/xeh bug
     // the root of all this, see ace/xeh bug
     PRINT( name p )
     PRINT( name p )
    PRINT( name _u )
     PRINT( name player )
     PRINT( name player )
     // 20090415 "No vehicle", add an additional check for vehicle
     // 20090415 "No vehicle", add an additional check for vehicle
     PRINT( vehicle p )
     PRINT( vehicle p )
    PRINT( vehicle _u )
     PRINT( vehicle player )
     PRINT( vehicle player )
    // alive
    PRINT( alive p )
    PRINT( alive player )
     _s=_s+"\nsleep 0.001;\n";
     _s=_s+"\nsleep 0.001;\n";
     sleep 0.001;
     sleep 0.001;

Revision as of 11:18, 15 April 2009

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.

JIP test

source

// 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; // not needed
    // isNull
    // this happens in JIP if no sleep are performed before.
    TEST( isNull p )
    TEST( isNull player )
    _s=_s+"\n";
    // locality
    // get player dereferenced? is only the pointer tested?
    TEST( local p )
    TEST( local player )
    _s=_s+"\n";
    // isPlayer 
    // should this check if a unit is pointed by player?
    TEST( isPlayer p )
    TEST( isPlayer player )
    _s=_s+"\n";
    // name
    // the root of all this, see ace/xeh bug
    PRINT( name p )
    PRINT( name player )
    // 20090415 "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;

output (edited)

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 ;

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 ;

JIP, changed to sleep 1 second

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) ;

comments

_u and player are the same thing.

  • remove _u

So what's happened?

  • isNull _u ; isNull player ;

ok, as we enter, player is null. so just waitUntil{!(isNull player)}, like XEH does.

  • name p = Roberto Duarte ; name _u = Error: No vehicle ; name player = Error: No vehicle ;

name of unit p is the random created one (no setIdentity in the mission).
setIdentity 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 _u ; local player ;
  • isPlayer p ; isPlayer _u ; isPlayer ;
  • name p = alef (2) ; name _u = 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.