Harzach 2518 Posted January 26, 2013 Hi all - I've read through several discussions and tried many things, but I just can't seem to get a marker to show up. This script is called by an action: //check execution hint "TEST"; //delete the marker if it has previously been placed deleteMarkerLocal "marker1"; //create the marker, a big red blob that will be easy to see _marker= createMarkerLocal ["marker1","limbo"]; //"limbo" is a marker placed off the map _marker setMarkerColorLocal "ColorRed"; _marker setMarkerShapeLocal "ELLIPSE"; _marker setMarkerBrushLocal "Solid"; _marker setMarkerSizeLocal [1000, 1000]; //open the map showmap true; //move the marker to the click position onMapSingleClick {"marker1" SetPos _Pos}; //clear the click handle waitUntil {!VisableMap}; onMapSingleClick ""; //remove the action player removeaction _a1; At this point, the action appears in the action list, and the hint happens when I execute it, but that's it. Is there any reason why this would not be working? If not, then the problem must lie elsewhere in my process. Thanks for any insight! harz Share this post Link to post Share on other sites
jw custom 56 Posted January 26, 2013 (edited) Quote _marker= createMarkerLocal ["marker1","limbo"]; //"limbo" is a marker placed off the map That should be a position like [0,0,0] or position player or getPos player etc etc. If you need to create the new marker at the position of marker limbo then use -> getMarkerPos "limbo" also Quote "marker1" SetPos _Pos should be: "marker1" setMarkerPos _pos Edited January 26, 2013 by JW Custom 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 Thanks for the quick reply! Everything you've said makes perfect sense to me, yet I am still getting the same result - nothing more than the hint. The edited script: //check execution hint "TEST"; //delete the marker if it has previously been placed deleteMarkerLocal "marker1"; //create the marker, a big red blob that will be easy to see _marker= createMarkerLocal ["marker1",setMarkerPosLocal getMarkerPos "limbo"]; _marker setMarkerColorLocal "ColorRed"; _marker setMarkerShapeLocal "ELLIPSE"; _marker setMarkerBrushLocal "Solid"; _marker setMarkerSizeLocal [1000, 1000]; //open the map showmap true; //move the marker to the click position onMapSingleClick {"marker1" SetMarkerPosLocal _Pos}; //clear the click handle waitUntil {!VisableMap}; onMapSingleClick ""; //remove the action player removeaction _a1; Share this post Link to post Share on other sites
jw custom 56 Posted January 26, 2013 Try this: Quote deleteMarkerLocal "marker1"; _marker= createMarkerLocal ["marker1",[0,0,0]]; _marker setMarkerColorLocal "ColorRed"; _marker setMarkerShapeLocal "ELLIPSE"; _marker setMarkerBrushLocal "Solid"; _marker setMarkerSizeLocal [1000, 1000]; openMap true; mapclick = false; onMapSingleClick "'marker1' setMarkerPosLocal _pos; mapclick = true; true"; waitUntil{!visibleMap}; onMapSingleClick ""; 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 Ah, perfect! Now, the only problem is that the action is not being removed from the action list. Is "player removeAction _a1" not the correct syntax for this? Or is it because "_a1" is defined in another script? I have so much to learn, and I really appreciate the assistance! Share this post Link to post Share on other sites
freakjoe 3 Posted January 26, 2013 An underscore always makes a variable local meaning you can only access it from another script if you pass it when executing the script. 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 OK, that's what I figured. I have edited the script where the addAction is created to this: a1 = player addAction ["Mark","common\mark.sqf"]; So now "a1" is a global variable, correct? Then the relevant line in the creation script is changed to this: player removeAction a1; Yet it still does not work. Thanks again for the help - I am a total scripting newb, but I am learning quickly thanks to forum members such as yourselves. Share this post Link to post Share on other sites
jw custom 56 Posted January 26, 2013 try this: add action to player from init.sqf: Quote blueText = {"<t color='#0000FF'>" + _this + "</t>"}; _id = player addAction ["Create marker" call blueText, "createMarker.sqf", [], -1, false, true, ""]; createMarker.sqf Quote _player = _this select 0; _id = _this select 2; openMap true; mapclick = false; onMapSingleClick " deleteMarkerLocal 'marker1'; _marker= createMarkerLocal ['marker1',[0,0,0]]; _marker setMarkerColorLocal 'ColorRed'; _marker setMarkerShapeLocal 'ELLIPSE'; _marker setMarkerBrushLocal 'Solid'; _marker setMarkerSizeLocal [1000, 1000]; 'marker1' setMarkerPos _pos; mapclick = true; true"; waitUntil{!visibleMap}; _player removeAction _id; onMapSingleClick ""; 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 Arg. Still not removing the action. But now I know how to make my action list look nice! Share this post Link to post Share on other sites
jw custom 56 Posted January 26, 2013 Works fine my end. Here's a mission example. Edited it slightly so id only is removed if you actually click on map. http://www.filedropper.com/onmapsingleclickutes 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 Weird. I've triple-checked everything, yet still no love. I'll look through your mission to see if I am doing something stupid somewhere. ---------- Post added at 09:08 ---------- Previous post was at 08:35 ---------- OK. First, I noticed that instead of _player removeAction _id; you were using if (mapclick) then {_player removeAction _id}; I changed that, but it still didn't work. Then, as I was flipping back and forth between your script and mine, I noticed that there was a spelling error in my script: waitUntil{!visableMap}; A copy/paste remnant from wherever I originally got that line. Fixed that and PRESTO - everything works beautifully. Much thanks! Share this post Link to post Share on other sites
jw custom 56 Posted January 26, 2013 The only difference between this Quote _player removeAction _id; and this Quote if (mapclick) then {_player removeAction _id}; is that it only removes your action if you actually click on the map and not just closing it. 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 Ah, of course. That's actually ideal. Share this post Link to post Share on other sites
roguetrooper 2 Posted January 26, 2013 Without any further scripting you can place markers by DOUBLE clicking on the map... But atm I don't know whether they are local in MP. Share this post Link to post Share on other sites
Harzach 2518 Posted January 26, 2013 RogueTrooper said: Without any further scripting you can place markers by DOUBLE clicking on the map... I'm a scripting newb, not an Arma newb! The markers I am placing are not icons, but "brush" markers. Share this post Link to post Share on other sites