Jump to content
fortune144

Executing sqf from config

Recommended Posts

Hey there i tried a lot but nothing works. i would like to add a function to the mouse menu in my addon.

How can i do that. i would like to call the sqf from my config.hpp.

 

i tried

 

class DefaultEventhandlers;
     .
     .
     .

class CfgVehicles{
	class B_Soldier_base_F;	

	class Desert_DPM_BDU :B_Soldier_base_F {
		scope = protected;
		model = "\A3\characters_F\BLUFOR\b_soldier_03.p3d";
		hiddenSelections[] = {"camo","insignia"};
		hiddenSelectionsTextures[] = {"path\DPM_Desert.paa"};
	    class EventHandlers: EventHandlers{
                init = "call myTag_fnc_myFunction;";
        };
	};
};


class CfgFunctions{
        class myTag
        {
            class myCategory
            {
                class myFunction {file = "scripts\test.sqf";};
            };
        };
    };

I added the sqf to addon via tool and include sqf for compiling.

 

so what i'm doing wrong?

Share this post


Link to post
Share on other sites
On 5/17/2018 at 6:49 PM, fortune144 said:

"scripts\test.sqf"

Are you sure this is the right prefix? If you go in the editor with your addon loaded, bring up the debug console and type myTag_fnc_myFunction in one of the monitor lines does it return the contents of your script?

 

If not then you can either...

 

1) un-PBO the addon containing your script and you should get a file called NameOfAddon.txt which will contain your prefix, essentially the path to your addons base folder when the engine reads it out of the PBO. You then need to add to this where your script exists under your addons base folder.

So for instance, taking one of my Eden addons, if I had this in my config.cpp ...

class CfgPatches
{
	class EdenBuildingPos
	{
		units[] = {}; // No objects must belong to the addon. CfgVehicles should ideally not be present at all.
		weapons[] = {};
		requiredVersion = 1.0;
		requiredAddons[] = {"3DEN"}; // 3DEN must be among required addons!
	};
};

class CfgFunctions {
	class LARs_EdenBuildingPos {
		tag = "LARs";
		class 3den {
			file = "LARs\EdenBuildingPos\functions";
			class 3DENBuildingPos {};
		};
	};
};

And I packed my addon (EdenBuildingPos) with a project path from P:\ with a file structure of...

P:\LARs\EdenBuildingPos\config.cpp

P:\LARs\EdenBuildingPos\functions\fn_3DENBuildingPos.sqf

When I de-PBO it I will get a file called EdenBuildingPos.txt that contains the prefix...

prefix=Lars\EdenBuildingPos\

So the file attribute (used within the category) of my CfgFunctions definition is LARs\EdenBuildingPos\functions, prefix to addons base folder (LARs\EdenBuildingPos) + path to file from base folder (\functions)

 

Or

2) Select your PBO in Eliteness, right click and scan pbo, you should see something like...

Quote

Verifying sha
///<'EdenBuildingPos.pbo' properties via Mikero's dos tools, dll version 6.44>///
prefix=Lars\EdenBuildingPos
//Pbo Type is: Arma Addon
//Sha: '343246A21034141C1096D489E6CC0433BEB9965E'
//////</properties>//////
config.bin:Tue Jan 10 19:39:11 2017: size 872
config.cpp:Tue Jan 10 19:38:36 2017: size 313
EdenBuildingPos.hpp:Thu Apr 21 16:40:49 2016: size 804
functions\fn_3DENBuildingPos.sqf:Thu Apr 21 16:40:46 2016: size 5780
functions\info.txt:Thu Feb 25 17:08:02 2016: size 280
No Error(s)

Here I have a function in my addon called fn_3DENBuildingPos.sqf which exists in the folder functions. My addons prefix is Lars\EdenBuildingPos so my file attribute in my CfgFunctions definition would be Lars\EdenBuildingPos\functions (as per my addon above where I use the file attribute inside the category), or would be Lars\EdenBuildingPos\functions\fn_3DENBuildingPos.sqf  if I was to use the same as you where you use the file attribute inside the functions definition.


 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×