Jump to content
Sign in to follow this  
spitfire007

onMapSingleclick does not wait for the click before proceeding with the script.

Recommended Posts

I have this code attached to an addaction.

If you click the action it executes the whole script without waiting for the map click.

I used the code from this thread.

http://forums.bistudio.com/showthread.php?145400-Creating-local-markers-using-onMapSingleClick

deleteMarkerLocal "marker1";

_marker= createMarkerLocal ["marker1",[0,0,0]];
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerBrushLocal "Solid";
_marker setMarkerSizeLocal [300, 300];

openMap true;
hint "Click on the map.";
mapclick = false;
onMapSingleClick "'marker1' setMarkerPosLocal _pos; mapclick = true; true";

hint "Mapclicked";
sleep 1;

waitUntil{!visibleMap}; //wait until the map is closed.
hint "Map Closed.";
sleep 1;

onMapSingleClick ""; //disable any further clicks.

deleteMarkerLocal "marker1";
hint "Marker deleted.";
sleep 1;

Share this post


Link to post
Share on other sites

I have no idea what I am doing wrong.

But it's not bringing up the MapClicked hint.

_pos = nil;

deleteMarkerLocal "marker1";

_marker= createMarkerLocal ["marker1",[0,0,0]];
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerBrushLocal "Solid";
_marker setMarkerSizeLocal [300, 300];

openMap true;
hint "Click on the map.";


mapClicked = false;
onMapSingleClick "'marker1' setMarkerPosLocal _pos; mapClick = true; true";
waitUntil {mapClicked};

hint "Mapclicked";
sleep 1;

waitUntil{!visibleMap}; //wait until the map is closed.
hint "Map Closed.";
sleep 1;

Edited by spitfire007
revised

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  

×