Alef/JIP – User

From Bohemia Interactive Community
< User:Alef
Revision as of 19:43, 14 April 2009 by Alef (talk | contribs) (→‎testing JIP)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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