twakkie 57 Posted October 25, 2015 Hi all. How would you determine from a object name the object/trigger/module type? Ex. I have placed 3 objects in the editor - A trigger, an empty vehicle and an enemy unit with the names Obj_1, Obj_2 and Obj_3 respectively. I have tried using BIS_fnc_objectType to determine the object type, and have had some success in determining empty objects such as man and plane but it returns ["Object", "UnknownObject"] for a trigger. Any advice? Regards Twak Share this post Link to post Share on other sites
rakowozz 14 Posted October 25, 2015 typeOf Obj_1; //returns string: "EmptyDetector" Share this post Link to post Share on other sites
twakkie 57 Posted October 25, 2015 typeOf Obj_1; //returns string: "EmptyDetector" Hi Rokowa Thanks for the reply but it is the same as using the BIS_fnc_objectType. Its a dirty solution and was hoping there is something more elegant. Some function or command which will return: Type-Trigger or something other than ["Object", "UnknownObject"] in the case of fnc_objectType or "EmptyDetector" in the case of typeOf. Twak Share this post Link to post Share on other sites
Tankbuster 1747 Posted October 25, 2015 https://community.bistudio.com/wiki/typeName Share this post Link to post Share on other sites
Larrow 2828 Posted October 25, 2015 Its a dirty solution and was hoping there is something more elegant.I dont understand why you say its a dirty solution, it is exactly what it is a (configFile >> "CfgNonAIVehicles" >> "EmptyDetector") a trigger.You can then use its typeOf to get its displayName for "Trigger" or "Rifleman" etc If you want to know a general data type then as tankbuster says use typename. _info = ""; { _var = missionNamespace getVariable _x; _type = typeOf _var; _description = { if ( isClass( configFile >> _x >> _type ) ) exitWith { getText( configFile >> _x >> _type >> "displayName" ) }; }forEach [ "CfgVehicles", "CfgNonAIVehicles" ]; _info = _info + format[ "%1\nis a\n%2\nDataType : %3\nClassType : %4\n\n", _x, _description, typeName _var, _type ]; }forEach [ "Obj_1", "Obj_2", "Obj_3" ]; hint _info; 2 Share this post Link to post Share on other sites
Tankbuster 1747 Posted October 25, 2015 Its a dirty solution and was hoping there is something more elegant. Welcome to our world. :) 2 Share this post Link to post Share on other sites
twakkie 57 Posted October 26, 2015 https://community.bistudio.com/wiki/typeName I dont understand why you say its a dirty solution, it is exactly what it is a (configFile >> "CfgNonAIVehicles" >> "EmptyDetector") a trigger.You can then use its typeOf to get its displayName for "Trigger" or "Rifleman" etcIf you want to know a general data type then as tankbuster says use typename. _info = ""; { _var = missionNamespace getVariable _x; _type = typeOf _var; _description = { if ( isClass( configFile >> _x >> _type ) ) exitWith { getText( configFile >> _x >> _type >> "displayName" ) }; }forEach [ "CfgVehicles", "CfgNonAIVehicles" ]; _info = _info + format[ "%1\nis a\n%2\nDataType : %3\nClassType : %4\n\n", _x, _description, typeName _var, _type ]; }forEach [ "Obj_1", "Obj_2", "Obj_3" ]; hint _info; Hi Larrow & Tankbuster I thought it would be called something else than a emptyDetector. Actually I read "emptyDetected" when he posted it . @rakowozz I apologise for outright dismissing you. Will look into what you and tankbuster suggested. Thanks for the little script, as always going far beyond what is expected :), will test it out tonight. Thanks and Cheers Twak. Share this post Link to post Share on other sites
Tankbuster 1747 Posted October 26, 2015 Triggers are odd in this respect. In the sqm they're called sensors - typename returns emptydetector but we know them by the same name we use when we create them in script or in the mission editor - triggers. Bohemia Interactive. Consistently Inconsistent since 2001. 1 Share this post Link to post Share on other sites
twakkie 57 Posted October 29, 2015 _info = ""; { _var = missionNamespace getVariable _x; _type = typeOf _var; _description = { if ( isClass( configFile >> _x >> _type ) ) exitWith { getText( configFile >> _x >> _type >> "displayName" ) }; }forEach [ "CfgVehicles", "CfgNonAIVehicles" ]; _info = _info + format[ "%1\nis a\n%2\nDataType : %3\nClassType : %4\n\n", _x, _description, typeName _var, _type ]; }forEach [ "Obj_1", "Obj_2", "Obj_3" ]; hint _info; Hi Larrow. Sorry for the long delay. When ARMA time has decreased from 2 or 3 evenings a week to 2 or 3 hours a week you know you are getting old. This works beautifully Larrow. Thank you. I know your a busy man but if you would like to review my completed game mode code one day I would be eternally grateful. But until then expect stupid questions like this one popping up in the forum often. Triggers are odd in this respect. In the sqm they're called sensors - typename returns emptydetector but we know them by the same name we use when we create them in script or in the mission editor - triggers. Bohemia Interactive. Consistently Inconsistent since 2001. Hahaha loving "Bohemia Interactive. Consistently Inconsistent since 2001." But I think you addressed what confused me. Thanks Tank. Cheers Twak 1 Share this post Link to post Share on other sites