Is it possible to have a script delete an item once it's been used?

This is the addaction for your Enter infostand
if ( cursorTarget isKindOf "Infostand_2_EP1" && (player distance cursorTarget) < 2 )
This is the addaction for your Exit infostand
if ( cursorTarget isKindOf "Infostand_1_EP1" && (player distance cursorTarget) < 2 ) then {

One checks for infostand_1 and the other for infostand_2 ... so it should work.

SOLVED: (caution, learning moment ahead .. for both of us)
Learning to use the editor to debug things is a tremendous help. I loaded a script that contained two infostands and your selfactions code and tested the output with hints to immediately tell me info. The great thing is you simply can edit the script and just "restart" and it loads your script changes so you can have nearly immedate results.
I discovered the issue since it SHOULD have worked ... the problem was "iskindof" returns a KIND not a classname, so both infostands were of type _1_ since _2_ derived from _1_ .. like a Lada and Skoda are both a KIND of car.
So I changed the code to this which compared the actual classnames.
if ( typeof cursorTarget == "Infostand_1_EP1"

Here is the debug code I used if you are interested: I placed 2 garbage cans on the map then edited the mission.sqf file to change the garbage can spawn code to the infostands of each type .. saved the trouble of searching for the infostands in the unending list of objects
My init.sqf
Code:
 s_player_bunker = -1;
s_player_bunkero = -1;
execvm "selfactions.sqf";

my selfactions.sqf code
Code:
while {true} do{

if ( typeof cursorTarget == "Infostand_2_EP1" && (player distance cursorTarget) < 2  ) then {
    if (s_player_bunker < 0) then {
        s_player_bunker = player addaction[("<t color=""#0000ff"">" + ("Enter The Trader") +"</t>"),"scripts\trader\bunkerin.sqf","",5,false,true,"", ""];
        hintsilent typeof cursortarget;
    };
} else {
    player removeAction s_player_bunker;
    s_player_bunker = -1;
};

if ( typeof cursorTarget == "Infostand_1_EP1" && (player distance cursorTarget) < 2  ) then {
    if (s_player_bunkero < 0) then {
        s_player_bunkero = player addaction[("<t color=""#0000ff"">" + ("Leave the Trader") +"</t>"),"scripts\trader\bunkerout.sqf","",5,false,true,"", ""];
                hintsilent typeof cursortarget;

    };
} else {
    player removeAction s_player_bunkero;
    s_player_bunkero = -1;
};
      
sleep 2;
    };

Video shows the fails first, then I edit/restart and script works.
 
That's got it man!! Can't believe after all that, it came down to the difference between isKindOf and typeof. Where is a good place to read up on uses of these things and general ARMA awkwardness?

But, believe it or not, I have learnt a great deal in this last 5 pages ... lol

Thanks again mate. Beers for you.
 
bookmark these 2 pages
1900 commands https://community.bistudio.com/wiki/Category:Scripting_Commands
all the topics https://community.bistudio.com/wiki/Category:Scripting_Topics

I wasnt really aware of the difference between iskindof and typeof until the testing when it was obviously not working as expected.

I think one of the most useful sites that got me to have a firm grasp of arma scripting was killzone kids blog http://killzonekid.com/ Just reading the tutorials and trying to follow along. He explains everything well although sometimes its a bit confusing just because its Arma.
 
Back
Top