cdn_biggdogg 29 Posted August 5, 2016 I'm using code similar to this: [_Obj, ["title", {Executed code},nil,1,false,true,"","true" ,6]] remoteExec ["addAction", 0, true]; As you can see I'm putting an addaction on an object in a MP environment and it's executed on every machine but I want to track the unique id for that addaction so I can later delete it. I can't use removeAllActions as I have other addactions I want to keep. I can't figure out how to pass that unique id into a variable I can track. If I use: _var = [_Obj, ["title", {Executed code},nil,1,false,true,"","true" ,6]] remoteExec ["addAction", 0, true]; all I get back is the JIP id. Is there a way when I create this addaction to pass the addactions id to a variable? I couldn't figure it out! Share this post Link to post Share on other sites
bad benson 1733 Posted August 5, 2016 the id will be returned by the addaction function and it is also passed into the code that is executed by the action. the question would be where you need the variable. only where the action is or on the server too? Share this post Link to post Share on other sites
haleks 8212 Posted August 5, 2016 Sadly, remoteExec only returns the JIP ID. I'm guessing that, as a result, actions added this way end up with an unknown ID. Iterating through unknown actions could be a lead, although I'm not sure how to proceed from there... Share this post Link to post Share on other sites
jshock 513 Posted August 5, 2016 You may want to create your own function that adds the action, but then use get/set variable on the client with a unique key so that you may then access the action ID inherently on each client whenever you need to. Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 6, 2016 You may want to create your own function that adds the action, but then use get/set variable on the client with a unique key so that you may then access the action ID inherently on each client whenever you need to. Thanks for your replies guys! So instead of using remoteExec to push the command addAction I should use it to push the command call to every machine to run the function on every computer? Maybe I should explain my intentions more....I need to be able track the addAction that I placed on an object so if it's been removed by other means (eg. another script or addon uses removeAllActions) so that if it's removed then I can re-add it to the object until it's been activated. (keep in mind I'm a novice scripter and have no C++ experience outside of Arma) All this boils down to saving the objects to a database. It adds an action to make them saveable then once they are saveable I add an action to remove them from saveable. A constant loop. So if the actions are removed by other means then I'd like to be able to re add them. Share this post Link to post Share on other sites
davidoss 552 Posted August 6, 2016 fnc_blahblah = { params ["_object"]; if ((typeOf _object) isEqualTo "Land_Laptop_unfolded_F" ) then { _object addAction ["Close the laptop", { params["_obj", "_caller", "_actionID", "_pos"]; _pos = getPos _obj; _obj removeAction _actionID; deleteVehicle _obj; _obj = createVehicle ["Land_Laptop_F", _pos, [], 0, "CAN_COLLIDE"]; hint format ["0-%1: 1-%2: 2-%3: 3-%4",typeOf _obj,str _caller,str _actionID,str (_this select 3)]; _obj call fnc_blahblah; },nil,6,true,true,"","0 isEqualTo 0",5,false]; } else { _object addAction ["Open the laptop", { params["_obj", "_caller", "_actionID", "_pos"]; _pos = getPos _obj; _obj removeAction _actionID; deleteVehicle _obj; _obj = createVehicle ["Land_Laptop_unfolded_F", _pos, [], 0, "CAN_COLLIDE"]; hint format ["0-%1: 1-%2: 2-%3: 3-%4",typeOf _obj,str _caller,str _actionID,str (_this select 3)]; _obj call fnc_blahblah; },nil,6,true,true,"","0 isEqualTo 0",5,false]; }; }; if (isServer) then { lopen remoteExec ["fnc_blahblah", 0,lopen]; lclosed remoteExec ["fnc_blahblah", 0,lclosed]; }; https://drive.google.com/file/d/0ByRTbY28pkpiSFZNbDRORUEyWDA/view?usp=sharing Share this post Link to post Share on other sites
haleks 8212 Posted August 6, 2016 Maybe I should explain my intentions more....I need to be able track the addAction that I placed on an object so if it's been removed by other means (eg. another script or addon uses removeAllActions) so that if it's removed then I can re-add it to the object until it's been activated. (keep in mind I'm a novice scripter and have no C++ experience outside of Arma) Just a quick note : if the mod you're referring to is Ravage, know that this (annoying) behaviour should be fixed with the next update. Only actions created by the mod will be removed. Until then, have you considered doing it the other way around : adding the action to the player, instead of the object/vehicle? Share this post Link to post Share on other sites
bad benson 1733 Posted August 6, 2016 you would be able to save the ID on the vehicle that has the save action using setvariable like this: [_obj, { _id = _this addaction ["title", {hint "test"},nil,1,false,true,"","true" ,6]; _this setVariable ["action_Id", _id, true]; }] remoteExec ["call", 0, true]; i think the problem is how to find out if the action has been removed. even the ID doesn't help there as far as i know. it only helps you to remove it. so what you could do is just remove and replace the action ina certain interval using the id. since you seem to need the loop behaviour. although it would be better to know that no actions will be removed to keep things cleaner. 1 Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 6, 2016 Just a quick note : if the mod you're referring to is Ravage, know that this (annoying) behaviour should be fixed with the next update. Only actions created by the mod will be removed. Until then, have you considered doing it the other way around : adding the action to the player, instead of the object/vehicle? Well yes. That is where this thread originated from was your Ravage mod, and thank you very much for making those changes, however the purpose of the thread was for me to advance (with all your help) my scripting abilities. I fully understand that your mod (which is awesome by the way) evolved from SP to MP so such things are bound to happen. (I discovered the issue and reported it to you and you are making changes...None of that is what I'd call annoying. Just part of modding. People will always do things that you'd never think of) No disrespect was meant to you or your mod. And no. I never thought of adding it to the player rather than the object\vehicle. Yet again some sound advice that I wouldn't have thought of myself. Thanks. 1 Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 7, 2016 you would be able to save the ID on the vehicle that has the save action using setvariable like this: [_obj, { _id = _this addaction ["title", {hint "test"},nil,1,false,true,"","true" ,6]; _this setVariable ["action_Id", _id, true]; }] remoteExec ["call", 0, true]; i think the problem is how to find out if the action has been removed. even the ID doesn't help there as far as i know. it only helps you to remove it. so what you could do is just remove and replace the action ina certain interval using the id. since you seem to need the loop behaviour. although it would be better to know that no actions will be removed to keep things cleaner. So if you save the id to a variable and the id is removed, does the variable not become nil? Share this post Link to post Share on other sites
bad benson 1733 Posted August 7, 2016 yea so then you do removeAction using the id which should either remove it or do nothing, if the action has already been removed, and then you readd the action. all that in a loop, which is what you want, no? Share this post Link to post Share on other sites
killzone_kid 1331 Posted August 7, 2016 id of added action could be different on different clients. For example some script adds a special action to squad leader so if you add another action to all players, it will have different id on squad leader's pc and therefore will not be removed, but some other action will be removed instead. Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 7, 2016 id of added action could be different on different clients. For example some script adds a special action to squad leader so if you add another action to all players, it will have different id on squad leader's pc and therefore will not be removed, but some other action will be removed instead. That's true but if it's wrote as a function and called on every computer then the actual id number becomes irrelevant because it's all saved to the same variable name on every computer. So I assume that when you call the remove and replace function on every computer to remove that variable it will remove the correct one for each computer. Would that not be the case? Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 7, 2016 yea so then you do removeAction using the id which should either remove it or do nothing, if the action has already been removed, and then you readd the action. all that in a loop, which is what you want, no? I was just actually trying to "test" to see if it was removed and then replace it if it was on a loop, but if the only way to do that is to remove and replace it then the end result would be the same. Share this post Link to post Share on other sites
bad benson 1733 Posted August 7, 2016 yea but that is what i meant earlier. i don't think you can actually test that. afaik the id is just a number. like literally. like just a reference to be used with the remove action command. doesn't seem like there is a way to test it like for example ui controls to see if they are null. would be much better to be able to be sure to not have all actions removed. and seems like haleks will remove that from Ravage. so i guess it solved itself? you could try some other stuff like hacking the inventory dialog of the vehicle and add a button to save it using the "inventoryOpened" event handler. not sure if that one is stackable but if so, you at least would be a little safer from destructive measures Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 8, 2016 yea but that is what i meant earlier. i don't think you can actually test that. afaik the id is just a number. like literally. like just a reference to be used with the remove action command. doesn't seem like there is a way to test it like for example ui controls to see if they are null. would be much better to be able to be sure to not have all actions removed. and seems like haleks will remove that from Ravage. so i guess it solved itself? you could try some other stuff like hacking the inventory dialog of the vehicle and add a button to save it using the "inventoryOpened" event handler. not sure if that one is stackable but if so, you at least would be a little safer from destructive measures OK guys. Thanks very much for all of your help! This pretty much answers my questions that I had. Just as a side note. I know most of you guys here because I use scripts and mods created by you guys. You guys are awesome. Keep up the great work! Share this post Link to post Share on other sites
killzone_kid 1331 Posted August 8, 2016 I was just actually trying to "test" to see if it was removed and then replace it if it was on a loop, but if the only way to do that is to remove and replace it then the end result would be the same. There are a couple of useful commands for actions on the way, some are on dev already, like actionsIDs https://community.bistudio.com/wiki/actionIDs 2 Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 8, 2016 There are a couple of useful commands for actions on the way, some are on dev already, like actionsIDs https://community.bistudio.com/wiki/actionIDs Now that would give me a way to track the addActions by testing if a value is in the array returned from that command. Thanks KK for the heads up! Share this post Link to post Share on other sites
bad benson 1733 Posted August 8, 2016 be aware that killzonekid's earlier note about actions having been removed and another action having been created that then uses the same ID like the old one, should still apply. but ofc it all depends on how much control you have over the overall creation of actions. Share this post Link to post Share on other sites
killzone_kid 1331 Posted August 8, 2016 Now that would give me a way to track the addActions by testing if a value is in the array returned from that command. Thanks KK for the heads up! Here you go https://community.bistudio.com/wiki/actionParams It should work correctly from tommorow's dev 1 Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted August 9, 2016 be aware that killzonekid's earlier note about actions having been removed and another action having been created that then uses the same ID like the old one, should still apply. but ofc it all depends on how much control you have over the overall creation of actions. Thanks BB for clarifying. BTW on a side note.....I can't play arma with out your enhanced movement mod!! Thanks for that! Here you go https://community.bistudio.com/wiki/actionParams It should work correctly from tommorow's dev Even better.....can control and track addActions even better!! Share this post Link to post Share on other sites