Jump to content
Sign in to follow this  
PlacidPaul

removing markers after map closes

Recommended Posts

My goal in game, is to "download" map markers only in certain safehouses by use of laptop, when your done and close map, the markers are gone again. I'm using the T8 download data script which is great http://forums.bistudio.com/showthread.php?166770-script-snippet-downlad-data-from-a-laptop

I've adjusted the T8_fnc_ActionLaptop to

"site1" setMarkerAlphaLocal 1; openMap true; mapIsOpen = true; call fnc_removeMarkers;

So after download, map is opened automatically and markers are seen. So I'm not sure how execute or call, or if it should be in a function or out?

fnc_removeMarkers =
{
while {mapIsOpen} do { if !(visibleMap) then {"site1" setMarkerAlphaLocal 0; mapIsOpen = false;};};

};

This all seems to be working, but am I doing this right? Is calling that function alright, scheduled environment question I guess.

https://community.bistudio.com/wiki/call

I've read this, but don't get it for my instance

Edited by PlacidPaul

Share this post


Link to post
Share on other sites

Why the loop? Can't you just set the marker's alpha as the map is open and closed? Idk exactly what you're doing as a whole anyhow, but that's my 2c.

You could just use visibleMap command instead of setting the variable back and forth? Bleh.. tired lol

Share this post


Link to post
Share on other sites

No need to cross out what you would like to say, I really wouldn't mind being belittled, I'm not really into scripting as much as playing arma. But, as I would like to just get it right...... I guess I'm missing something, I thought visibleMap just returns true or false, so..... I need to wait till the map is closed, after a certain instance. I really don't want a loop I never use them much, not sure how though.

Share this post


Link to post
Share on other sites

You could just try a while loop with waitUntil's for each condition your checking:

while (true) do {

waitUntil {visibleMap};

//Do your marker stuff here

waitUntil {!visibleMap};

//Do your other marker stuff here

if (certain ending condition) then exitWith {};

};

I'm honestly surprised they don't have a "Map Opened/Close" EH for this particular scenario, unless I missed it somewhere.

Edited by JShock

Share this post


Link to post
Share on other sites

Maybe I'm misunderstood, I want to be able to read all my markers only after using the download, which opens map automatically. So only the very next map close needs to erase the makers.

What I have works, but as usual I fear im using the stupid way. Thanks for the reply

Share this post


Link to post
Share on other sites
Maybe I'm misunderstood, I want to be able to read all my markers only after using the download, which opens map automatically. So only the very next map close needs to erase the makers.

What I have works, but as usual I fear im using the stupid way. Thanks for the reply

If it works don't mess with it :), always a good rule of thumb. But you could still just use a waitUntil as well to make it look neater(ish), below is the same exact concept, just with waitUntil instead of while:

waitUntil {!visibleMap};

"site1" setMarkerAlphaLocal 0;
mapIsOpen = false;

Only difference between mine and yours is that yours is continuously checking for the condition, and mine suspends the script until a condition is met, then goes into the rest of the script.

Share this post


Link to post
Share on other sites

If it works for me don't mean much. Yeah, that does make more sense. I think I tried a variation of that without success, thanks I try again.

Share this post


Link to post
Share on other sites
Only difference between mine and yours is that yours is continuously checking for the condition, and mine suspends the script until a condition is met

Technically waitUntil is continuously checking the condition also, I think the check is about every 3ms (don't quote that). But if I had seen this earlier I would have posted something with waitUntil also, so good job, but I just wanted to point out a little mis-information.

Share this post


Link to post
Share on other sites
Technically waitUntil is continuously checking the condition also, I think the check is about every 3ms (don't quote that). But if I had seen this earlier I would have posted something with waitUntil also, so good job, but I just wanted to point out a little mis-information.

Always appreciated :p. So would the difference just be the interval of the looping conditional check? (i.e. while every blah ms, and waitUntil ~3ms)

Edited by JShock

Share this post


Link to post
Share on other sites

Just do a sleep, then delete the Markers. Typing fast here, so I may have misread. Just set a sleep timer of x time, then delete or set alpha for the markers. No need for loops or extra code.

Open laptop, download data, markers seen, markers delete after 1 minute automatically.

Share this post


Link to post
Share on other sites
Bleh.. tired lol

Okay I'm awake lol. No loops, no variables... no headaches.

waitUntil { !( isNull ( findDisplay 46 ) ) };

_xIDx = (findDisplay 46) displayAddEventHandler ["KeyDown", {
if ( ( _this select 1 ) == 0x32 ) then { 
	if ( !( visibleMap ) ) then { 
		"site1" setMarkerAlphaLocal 1;		
	} else {
		"site1" setMarkerAlphaLocal 0;	
	};
	hint format ["Marker Alpha = %1", markerAlpha "site1"];
};
}];

---------- Post added at 12:04 ---------- Previous post was at 11:23 ----------

Updated a bit. Cheers.

Note: I'm wondering.. your using the local variant of setMarkerAlpha. Why the need to hide the marker locally for the unit if he's not on the map screen :confused:

Edited by Iceman77

Share this post


Link to post
Share on other sites

I'd do it this way:

[color="#FF8040"][color="#191970"][b]openMap[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color]
[color="#7A7A7A"]"site1"[/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#000000"]_this[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#000000"]_this[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

Share this post


Link to post
Share on other sites

Note: I'm wondering.. your using the local variant of setMarkerAlpha. Why the need to hide the marker locally for the unit if he's not on the map screen :confused:

Hmm.... I want only the player using the laptop in multiplayer to get markers, so I want this to local command right?
I'd do it this way:

[color="#FF8040"][color="#191970"][b]openMap[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color]
[color="#7A7A7A"]"site1"[/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#000000"]_this[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#000000"]_this[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

This is great, thanks for help everyone. Now I have over 100 markers and will have more, so I guess I use the ["site1", "site2"] spawn array, but what do i put for _this? Also, isn't there some use of "_i" to allow me to be lazy here? LOL, thanks for dealing with my dumbass guys

Share this post


Link to post
Share on other sites
Hmm.... I want only the player using the laptop in multiplayer to get markers, so I want this to local command right?

This is great, thanks for help everyone. Now I have over 100 markers and will have more, so I guess I use the ["site1", "site2"] spawn array, but what do i put for _this? Also, isn't there some use of "_i" to allow me to be lazy here? LOL, thanks for dealing with my dumbass guys

Untested, might have to tweak the values. Using KKs example, just adding support for an array of markers.

This should allow you to be lazy. :)

openMap true;
[] spawn {
private ["_n","_marker","_markerArray","_nMarkers"];

_nMarkers = 100;        // set this value = the # of markers.
_markerArray = [];
_n = 0;
for "_x" from 0 to _nMarkers do {
	_n = _n + 1;
	_marker = format ["site%1",_n];
	_markerArray pushBack _marker;
};

waitUntil {visibleMap};
{_x setMarkerAlphaLocal 1;} count _markerArray;
waitUntil {!visibleMap};
{_x setMarkerAlphaLocal 0;} count _markerArray;
};

Edited by MDCCLXXVI

Share this post


Link to post
Share on other sites

This is great, thanks for help everyone. Now I have over 100 markers and will have more, so I guess I use the ["site1", "site2"] spawn array, but what do i put for _this? Also, isn't there some use of "_i" to allow me to be lazy here? LOL, thanks for dealing with my dumbass guys

[color="#FF8040"][color="#191970"][b]openMap[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"site1"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"site2"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"site3"[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#8B3E2F"][b]{[/b][/color][color="#000000"]_x[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#000000"]_this[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]visibleMap[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]{[/b][/color][color="#000000"]_x[/color] [color="#191970"][b]setMarkerAlphaLocal[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#000000"]_this[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

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
Sign in to follow this  

×