OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Ding on 24 Aug 2008, 13:04:10

Title: OnMapSingleClick SetMarkerPos help
Post by: Ding on 24 Aug 2008, 13:04:10
Im trying to make a marker change location when there is a single click on the map yet it does not seem to work atall

Code: [Select]
OnMapSingleClick {"Pos1" setMarkerPos GetMarkerPos "Pos2"}
is the first one I tried to use with no luck atall, I then tried switching the quotations and brackets in a number of combinations but nothing seems to work I keep getting an error saying

Code: [Select]
Error GetMarkerPos: type code expected string
Its also activated on Radio Alpha if that is of any significance.
Title: Re: OnMapSingleClick SetMarkerPos help
Post by: Wolfrug on 24 Aug 2008, 13:10:46
That is because onMapSingleClick is one of those archaic hacks that BIS gave us sometime back in OFP 1.46, and hasn't seen fit to fix since (like addAction :D) -> in other words, it doesn't use the {} code brackets, but "" quotes.

Code: [Select]
onMapSingleClick """markername"" setmarkerpos getmarkerpos ""markername2"""
In other words, for every string inside the quotes "", you need to add double quotes "" (which is why there are double quotes around the marker names). Something with no strings makes a lot more sense: onMapSingleClick "unit1 domove getpos unit2".

However, why activate this strange code with onMapSingleClick? usually you want to move markers TO the position you clicked, no? In that case you can use the local variable _pos, which funnily enough is called just that within the quotes ->

Code: [Select]
onMapSingleClick """markername"" setmarkerpos _pos"
Good luck!

Wolfrug out.
Title: Re: OnMapSingleClick SetMarkerPos help
Post by: Ding on 24 Aug 2008, 20:19:38
ah thanks for the speedy reply that explains alot :D