Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
thetrooper

Marker won't delete

Recommended Posts

Hi guys. My marker wont delete after 10 seconds after I created it :( any ideas why?

_marker = createMarker ["fpilotground", position fpilot];
"fpilotground" setMarkerText "Pilot last reported";
"fpilotground" setMarkerColor "ColorBlue";
"fpilotground" setMarkerShape "ICON";
"fpilotground" setMarkerType "waypoint";
"fpilotground" setMarkerSize [1, 1];

sleep 10;

deleteMarker "fpilotground";

Share this post


Link to post
Share on other sites

Works fine here as is, are you calling it multiple times so it keeps redrawing it?

Share this post


Link to post
Share on other sites

I was going to set up another marker under different name every so many seconds. Thing it it would run out over time. Ideally loop it if that's possible then kill it later?

Share this post


Link to post
Share on other sites

Give the below code a whirl my friend. Also, take note in the changes I made in lines that are also in the code you started with. For instance, once defining a variable to represent a marker, simply call the marker through that variable, not through the marker name. I'm surprised your marker actually showed up the way you wanted it to. No matter. Anyway, execute the below code.

_mkrnum = 0;
pilotsecure = false;
while {(!(pilotsecure)} do {
_mkrnum = _mkrnum + 1;
_pilotpos = getPos fpilot;
_marker = createMarker [format["fpilotground%1", _mkrnum], _pilotpos];
_marker setMarkerText "Pilot last reported";
_marker setMarkerColor "ColorBlue";
_marker setMarkerShape "ICON";
_marker setMarkerType "waypoint";
_marker setMarkerSize [1, 1];

sleep 10;

deleteMarker _marker;  
};

To end the while loop, you'll need to put this somewhere.

pilotsecure = true;

I haven't tested this as I am only on my laptop, but it should do you the trick. Let me know.

Edit: In the 6th line I included a formatted string, but I do not know 1. if this will even work, or 2. if this is even necessary. If it works, it works, doesn't matter if its necessary. If it doesn't work, just replace format["fpilotground%1", _mkrnum] with "markernamehere". Be sure to keep the furthest left bracket in though.

Share this post


Link to post
Share on other sites

Thanks for that Grimes, I'll give it a go when I get home, let you know how I get on :wink_o:

Share this post


Link to post
Share on other sites

No cigar I'm afraid. Tried the original and the following below:

_mkrnum = 0;
pilotsecure = false;
while {(!(pilotsecure)} do {
   _mkrnum = _mkrnum + 1;
   _pilotpos = getPos fpilot;
   _marker = createMarker ["markername", _pilotpos];
   _marker setMarkerText "Pilot last reported";
   _marker setMarkerColor "ColorBlue";
   _marker setMarkerShape "ICON";
   _marker setMarkerType "waypoint";
   _marker setMarkerSize [1, 1];

   sleep 10;

   deleteMarker _marker;  
};  

Share this post


Link to post
Share on other sites
;2613271']What is happening exactly? I can test it tomorrow if need be.

Nothing happens lol. Doesn't like it for some reason

Share this post


Link to post
Share on other sites

There is an extra ( it should be

while {!(pilotsecure)} do {

make sure you have -showscripterrors added to the launch options in steam

Share this post


Link to post
Share on other sites
Sign in to follow this  

×