Jump to content

Recommended Posts

Hi.

I am having trouble adding ACE interaction to a particular set of objects.

 

The addActionToClass requires the following:

 

0: TypeOf of the class <STRING>

1: Type of action, 0 for actions, 1 for self-actions <NUMBER>

2: Parent path of the new action <ARRAY>

3: Action <ARRAY>

 

My object`s classname is Land_Camping_Light_F and I want all objects of this class to have an interaction menu.

TypeOf only allows me to do so for particular named objects and not all of them.

 

Is there a way to substitute typeOf with IsKindOf ? Or Is there a different solution to this problem ?

Share this post


Link to post
Share on other sites

afaik you can add the config parent class to this as well

 * 4: Use Inheritance (Default: False) <BOOL><OPTIONAL>

Share this post


Link to post
Share on other sites
4 hours ago, Midnighters said:

afaik you can add the config parent class to this as well


 * 4: Use Inheritance (Default: False) <BOOL><OPTIONAL>

But what will I input into the first parameter 0: TypeOf of the class <STRING>

  • Like 1

Share this post


Link to post
Share on other sites

 

9 hours ago, Ivanoff.N said:

0: TypeOf of the class <STRING>

 

TypeOf an Object gives you the class

 

TypeOf a class gives you an error.

 

This error:

23:57:55 Error in expression <typeOf "someCLass">
23:57:55   Error position: <typeOf "someCLass">
23:57:55   Error typeof: Type String, expected Object

 

 

You already have the class so put that in.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, das attorney said:

 

 

TypeOf an Object gives you the class

 

TypeOf a class gives you an error.

 

This error:


23:57:55 Error in expression <typeOf "someCLass">
23:57:55   Error position: <typeOf "someCLass">
23:57:55   Error typeof: Type String, expected Object

 

 

You already have the class so put that in.

So my line would be like this: 

 

[Land_Camping_Light_F , 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToClass; 

 

??

 

For me it just gives undefined variable in expression. What is the correct syntax for it then ?

  • Like 1

Share this post


Link to post
Share on other sites

It expects a string, so you need to wrap it in quote marks.

 

So not:  Land_Camping_Light_F  

 

But this: "Land_Camping_Light_F"

 

 

["Land_Camping_Light_F" , 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToClass; 

 

  • Like 1

Share this post


Link to post
Share on other sites

I just read up here and you can do it for all the inherited classes if you have lots of classnames of lamp to add:

 

https://ace3mod.com/wiki/framework/interactionMenu-framework.html

 

// Adds action to check fuel levels for all land vehicles
_action = ["CheckFuel", "Check Fuel", "", {hint format ["Fuel: %1", fuel _target]}, {true}] call ace_interact_menu_fnc_createAction;
["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

// Adds action to check external fuel levels on tanks.  Will be a sub action of the previous action.
_action = ["CheckExtTank","Check External Tank","",{hint format ["Ext Tank: %1", 5]},{true}] call ace_interact_menu_fnc_createAction;
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass;

 

Maybe it's that last parameter <true> that you are missing.  I'm not sure as I don't really use ACE.

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, das attorney said:

I just read up here and you can do it for all the inherited classes if you have lots of classnames of lamp to add:

 

https://ace3mod.com/wiki/framework/interactionMenu-framework.html

 


// Adds action to check fuel levels for all land vehicles
_action = ["CheckFuel", "Check Fuel", "", {hint format ["Fuel: %1", fuel _target]}, {true}] call ace_interact_menu_fnc_createAction;
["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

// Adds action to check external fuel levels on tanks.  Will be a sub action of the previous action.
_action = ["CheckExtTank","Check External Tank","",{hint format ["Ext Tank: %1", 5]},{true}] call ace_interact_menu_fnc_createAction;
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass;

 

Maybe it's that last parameter <true> that you are missing.  I'm not sure as I don't really use ACE.

No, I just needed this particular one. 

Problem solved with the quote marks. thanks a lot.

["Land_Camping_Light_F" , 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToClass;   <== this is the correct line if you are visiting this thread to find the same answer.

  • Like 1

Share this post


Link to post
Share on other sites

No problem, their documentation is a bit confusing on that one.

 

I would have thought it would say something like:

 

0: either (typeOf object) or ("class")  <string required>

 

Oh well, sorted in the end :thumbsup:

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, das attorney said:

No problem, their documentation is a bit confusing on that one.

 

I would have thought it would say something like:

 


0: either (typeOf object) or ("class")  <string required>

 

Oh well, sorted in the end :thumbsup:

Ye that is why I got confused too. I do not often script in Arma, but I needed to make a quick addon and got confused by ACE framework, sorted now though, thanks again.

  • Like 1

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

×