Jump to content

R3ality

Member
  • Content Count

    10
  • Joined

  • Last visited

  • Medals

Posts posted by R3ality


  1. Hi,

    Here's a small script I originally posted on armaholic. It may be useful when debugging the gear player is holding/has equipped..

    File source: debugGear.sqf

    /*
    @file Version: v0.1
    @file name: debugGear.sqf
    @file Author: R3
    @file edit: 3/6/2013
    @file Description: Print debug info of player gear through action menu item
    @usage: Put in init field of some object: this addAction ["DEBUG GEAR INFO", "debugGear.sqf"];
    */
    
    _obj = _this select 0; //the object that had the action
    _caller = _this select 1; //unit that called the action
    _id = _this select 2; //id of the action
    
    _outp = "HEADGEAR  =  " + (headgear _caller)
    + "\n\nGOGGLES  =  " + (goggles _caller)
    + "\n\nPRIM. WEAPON  =  " + (primaryWeapon _caller) + "  =  " + (str primaryWeaponItems _caller)
    + "\n\nSEC. WEAPON  =  " + (secondaryWeapon _caller) + "  =  " + (str secondaryWeaponItems _caller)
    + "\n\nHANDGUN  =  " + (handgunWeapon _caller) + "  =  " + (str handgunItems _caller)
    + "\n\nASSIGNED ITEMS  =  " + (str assignedItems _caller)
    + "\n\nUNIFORM  =  " + (uniform _caller) + "  =  " + (str uniformItems _caller)
    + "\n\nVEST  =  " + (vest _caller) + "  =  " + (str vestItems _caller)
    + "\n\nBACKPACK  =  " + (backpack _caller) + "  =  " + (str backpackItems _caller);
    //+ "\n\nALL WEAPONS  =  " + (str weapons _caller)
    //+ "\n\nALL MAGAZINES  =  " + (str magazines _caller);
    
    titleText [_outp, "BLACK IN", 30]; //print our info

    Usage: Add the following into the "initialization" field of any object

    this addAction ["DEBUG GEAR INFO", "debugGear.sqf"];

    ..then player just needs to use the action menu on that object by selecting "DEBUG GEAR INFO" - I added it to a ammo container but it should work on any object..

    It should look something like this:

    8V7vkgMl.png

    It is also available for download by the armaholic guys :thumbsup: and listed on their forums


  2. Hi,

    I briefly skimmed through this thread but didn't notice a way of doing this..

    Is there a way to check if a variable is an array? Or a way to get the type of the variable?

    I see isArray but this seems to be for config entries. Basically I'm looking for a way to differentiate between a variable being of the String type versus the Array type..

    EDIT: Ok I think I found a way for this in another discussion thread. Is this considered a good approach or is there a better/easier way?

    if (isNil {_this select 1}) then { //not an array
       } else { }; //array

×