Jump to content
Sign in to follow this  
saetheer

Delete for markers using ctrlMapMouseOver

Recommended Posts

Hello,

So I'm creating markers using script

_stime = str time; // Creates uniqe markername. Elapsed mission time
_mrk = createMarker [_stime, _pos];
_mrk setMarkerType _Marker;
_mrk setMarkerColor _Color;

This works fine, however keepin track of the elapsed time is impossible. So I wanted to use ctrlMapMouseOver but I can't figure it how it works. I want to use it to delete the marker I click.

Anyone got tips?

Share this post


Link to post
Share on other sites

This is a very poor bit of code I managed to get working.

sleep 1;

null = (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "player sidechat str (_this select 1);if ( ((_this select 1) == 1)   and (ctrlMapMouseOver (uiNamespace getVariable '_map') select 0) == 'marker') then {deletemarker (ctrlMapMouseOver (uiNamespace getVariable '_map') select 1);} "];

while {true} do {uiNamespace setVariable ["_map",(findDisplay 12) displayCtrl 51];
 (uiNamespace getVariable "_map") ;
  sleep 0.3;
 //hint str ctrlMapMouseOver (uiNamespace getVariable "_map");

 };

It should delete any marker by pressing right mouse, it does need improving but I'm way to tired.

Share this post


Link to post
Share on other sites

Thanks.

init.sqf

onMapSingleClick "if (_alt) then {[_pos,true] execVM 'SMS\open.sqf';} else {[_pos,false] execVM 'SMS\open.sqf';};true;";

"inside" this open.sqf either creates a dialog or calls the delete function, depending on alt was held in while click. I basically want to left click for delete and Alt leftclick works as it should be.

delete.sqf

if ( (ctrlMapMouseOver (uiNamespace getVariable '_map') select 0) == 'marker') then { deletemarker (ctrlMapMouseOver (uiNamespace getVariable '_map') select 1); };

Share this post


Link to post
Share on other sites

Glad it works and thanks for cleaning it up to some thing more useful.

I've always wanted to do this as well but until last night I couldn't figure it out.

For anyone else you do still need the find display part. At least mine didn't work without it.

uiNamespace setVariable ["_map",(findDisplay 12) displayCtrl 51]; 
if ( (ctrlMapMouseOver (uiNamespace getVariable '_map') select 0) == 'marker') then { deletemarker (ctrlMapMouseOver (uiNamespace getVariable '_map') select 1); };

It also works in A2/OA

Share this post


Link to post
Share on other sites

Something cool I found the other day: if you want to print the current server time rather than the elapsed time, use:

[daytime] call BIS_fnc_timeToString

This will return the current time in 00:00:00 format, rather than the daytime command alone that returns time in 00.0000 format. Or the time command the returns the elapsed time since mission start. This way, you don't have to mark or remember the start time, you can just look at your watch and see how long it has been since the marker was created.

Just some useful information I decided to share.

Share this post


Link to post
Share on other sites

Thanks, however I'm creating a DOT markers on maps. There will be perhaps 50 of them during a coop session and therefor I can't refeer to names when I want to delete those. But hey, thanks for the info, could be usfull some other time.

Share this post


Link to post
Share on other sites

Anyone got an idea of why this removes the ability to Shit-click for the rendevous point? or know how I can get it back? I've looked through the config file but can't find it.. (its so damn loong....)

Share this post


Link to post
Share on other sites

Well it seems it's a bug that's been around for ever.

I did get it sort of working, it's to do with the true variable at the end of the onmapsingleclick but I also found this reference

http://forums.bistudio.com/showthread.php?167822-Stacked-event-handlers-OnEachFrame-OnPlayerConnected-etc/page3

private ["_click"];

fn_click = {
if (_alt) then {[_pos,true] execVM 'delete.sqf'};
};

["_click", "onMapSingleClick", "fn_click"] call BIS_fnc_addStackedEventHandler;

While it does work

(alt+left Mouse click) delete marker

( left shift+left Mouse click) place rendevous point

I find using it in the editor very hit and miss.

it keeps moving the player to the marker and markers hard to delete.

I find pressing right mouse and then left alt and left mouse works better.

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  

×