MrSplendid 4 Posted April 11, 2019 Hey guys, i adjusted the colour in the IFF script from BIS and now i want do define and use the function with my new colour. I searched the BIKI and several tutorials, but still without a clue why my method isnt working. description.ext class CfgFunctions { class myTag { class myCategory { class fnc_IFF_HUD {file = "myfunctions\fnc_IFF_HUD.sqf";}; }; }; }; and of course i have the lightly adjusted script fnc_IFF_HUD.sqf in my mission. When i try to call it, nothing happens. [[soldier1]] call fnc_IFF_HUD; just changed the colour in the original BIS_fnc_EXP_camp_IFF function and want to define and use the function new. params [["_units", [], [[]]]]; if (!(isNil "BIS_fakeTexture")) exitWith {"IFF cannot be initialized more than once." call BIS_fnc_error; false}; // Global icon variables BIS_fakeTexture = [1,1,1,0] call BIS_fnc_colorRGBAtoTexture; BIS_iconColor = [255, 153, 0]; BIS_iconUnits = +_units; // Icon eventhandler addMissionEventHandler [ "Draw3D", { { private _unit = _x; private _showAlways = _unit getVariable ["BIS_iconAlways", false]; private _showIcon = _unit getVariable ["BIS_iconShow", false]; private _showName = _unit getVariable ["BIS_iconName", false]; // Determine if icon should be shown if (_showAlways || { _showIcon }) then { if (_showAlways || { vehicle player distance _unit < 300 }) then { // Calculate position private _pos = _unit selectionPosition "Spine3"; _pos = _unit modelToWorldVisual _pos; // Draw hex icon drawIcon3D [ "a3\ui_f\data\igui\cfg\cursors\select_ca.paa", BIS_iconColor + [0.15], _pos, 1, 1, 0 ]; if (_showAlways) then { // Draw arrow if icon goes out of the screen drawIcon3D [ BIS_fakeTexture, BIS_iconColor + [0.5], _pos, 1, 1, 0, "", 0, 0.03, "PuristaLight", "center", // Redundant font params, required to make the arrow work true ]; }; if ( // Icon is forced _showAlways || { // Name is allowed _showName && // Unit is highlighted { cursorTarget == vehicle _unit } } ) then { // Determine name private _name = switch (typeOf _unit) do { default {name _unit}; case "B_CTRG_soldier_M_medic_F" : {localize "STR_A3_B_CTRG_soldier_M_medic_F0"}; case "B_Soldier_TL_F" : {localize "STR_A3_ApexProtocol_identity_Riker"}; case "B_soldier_M_F" : {localize "STR_A3_ApexProtocol_identity_Grimm"}; case "B_soldier_AR_F" : {localize "STR_A3_ApexProtocol_identity_Salvo"}; case "B_soldier_LAT_F" : {localize "STR_A3_ApexProtocol_identity_Truck"}; case "B_Story_SF_Captain_F" : {localize "STR_A3_ApexProtocol_identity_Miller"}; }; // Draw name drawIcon3D [ BIS_fakeTexture, BIS_iconColor + [0.5], _pos, 1, -1.8, 0, _name, 0, 0.025 ]; }; }; }; } forEach BIS_iconUnits; } ]; // Display units { private _unit = _x; {if (isNil {_unit getVariable _x}) then {_unit setVariable [_x, true]}} forEach ["BIS_iconShow", "BIS_iconName"]; } forEach BIS_iconUnits; true Thanks for help in advance! Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 Just now, MrSplendid said: I searched the BIKI and several tutorials Did you read the biki though? https://community.bistudio.com/wiki/Arma_3_Functions_Library#Adding_a_Function Quote This will try to compile function myTag_fnc_myFunction from the following file: Your function is called myTag_fnc_IFF_HUD Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 Oh okay. I called the function via [[sf1, sf2, sf3,sf4,sf5,sf6]] call myTag_fnc_IFF_HUD ; n now. But nothing. Did i still miss something? Share this post Link to post Share on other sites
POLPOX 779 Posted April 11, 2019 Not fnc but fn. Also you can find your function via the Functions Viewer. Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 yea i got it from the functions viewer, but i changed the colour in it, so i have to define it new. Still no success with [[sf1, sf2, sf3,sf4,sf5,sf6]] call myTag_fn_IFF_HUD compiled the function in the init.sqf too. compile "myfunctions\myTag_fn_IFF_HUD.sqf"; Share this post Link to post Share on other sites
POLPOX 779 Posted April 11, 2019 Ah I am terribly sorry. I mean the file name. You should have fn_ prefix but not fnc_ for the sqf file. Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 No problem. Did that. Nothing happens. Share this post Link to post Share on other sites
POLPOX 779 Posted April 11, 2019 Make sure these things: Reload the Description.ext by save mission or load mission. You'll need to do this for applying every single modifing. Check your configs are added to the missionConfigFile properly. Go check through Config Viewer. Check your function is added to the functions library properly. Go check through Functions Viewer. Check the file path and/or file name. Either the file itself and path in the Description.ext. Read the article again. Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 i think i missed the missionConfig File part. might you give a example how it looks? Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 30 minutes ago, POLPOX said: Not fnc but fn. Also you can find your function via the Functions Viewer. Nope fnc is correct. 11 minutes ago, POLPOX said: Ah I am terribly sorry. I mean the file name. You should have fn_ prefix but not fnc_ for the sqf file. Nope. Not if the full filepath is provided in the function's class. If you specify a foldername in the category then all files in that folder need to start with fn_. @MrSplendid Check in debug console if your function is even defined, if it isn't maybe check RPT log for errors. Just put the name of your function into the watch field at the bottom of the debug console. Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 nope. not defined i think background is red. rpt says Warning Message: Script myfunctions\fn_IFF_HUD.sqf not found Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 1 hour ago, MrSplendid said: class fnc_IFF_HUD {file = "myfunctions\fnc_IFF_HUD.sqf";}; Is that still your config or did you change it? Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 class CfgFunctions { class myTag { class fnc_IFF_HUD { class fnc_IFF_HUD {file} = "myfunctions\fnc_IFF_HUD.sqf"; }; }; }; I tried many ways. No success. A sample with a path to the sqf and calling the funcion would be very much appreciated! Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 4 minutes ago, MrSplendid said: I tried many ways. No success. What you had originally looked correct to me. Last thing you sent is a syntax error ^^ OHH crap.. Sorry.. Didn't see that. Function name in config should NOT include the fnc_ part. CfgFunctions adds that by itself. 1 hour ago, MrSplendid said: class CfgFunctions { class myTag { class myCategory { class IFF_HUD {file = "myfunctions\fnc_IFF_HUD.sqf";}; }; }; }; Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 Ok...^^ So i got the description.ext where i defined the class like that now. class CfgFunctions { class myTag { class myCategory { class IFF_HUD {file = "myfunctions\fnc_IFF_HUD.sqf";}; }; }; }; Then i got the fnc_IFF_HUD.sqf file in my\functions\fnc_IFF_HUD.sqf This should be enought?`because i cant call the function via: [[soldier1]] call fnc_IFF_HUD; Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 Just now, MrSplendid said: This should be enought?`because i cant call the function via: [[soldier1]] call fnc_IFF_HUD; Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 calling it like that: [[soldier1]] call myTag_fnc_IFF_HUD; also does not show me the function in the watch field and does nothing Share this post Link to post Share on other sites
Dedmen 2716 Posted April 11, 2019 Did you check RPT again for new errors? now that the path has been fixed? Share this post Link to post Share on other sites
MrSplendid 4 Posted April 11, 2019 working now...Thanks very much. Seems like it was an error in the ext config. Share this post Link to post Share on other sites
major woody 12 Posted March 2, 2020 #MrSplendid - care to share a working copy of this...? 🙂 2 Share this post Link to post Share on other sites
ANZACSAS Steven 396 Posted March 14, 2020 I would like to see a working example too dude,please. 1 Share this post Link to post Share on other sites
Melody_Mike 131 Posted March 17, 2020 + 1 ! Spent hours on this. Still don't understand how each layer of classname in CfgFunctions works, and the naming convention with fnc_ versus fn_ as per the wiki:https://community.bistudio.com/wiki/Arma_3_Functions_Library#Adding_a_Function A simple working example in a mission file would be greatly appreciated! 2 Share this post Link to post Share on other sites