OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: myke13021 on 03 Apr 2008, 23:15:06
-
Well, i used the search function but the more i read there, the more i get confused. What i want is pretty simple: getting the position of a mapclick.
What i think i have understood:
The onmapsingleclick doesn't pause the script until a mapclick occurs. So i would need a variable set to false, onmapsingleclick setting this variable to true and after this a waituntil command to stop the script till the map is clicked.
I know (guess) that onmapsingleclick returns _pos as it's position but mostly this is used to call a script ([_pos] execVM "blabla.sqf"). So can i get this _pos into my script by using _mypos = _pos?
I guess i just need the correct onmapsingleclick line of code (maybe including the variable which will waituntil need to wait).
May anyone help me on this?
-
Nope,
my_global_pos = _pos, the code of the click runs independently of the script that set up the onMap function.
-
Hm....so i have to go the way through a global variable which i can read in my script afterwards.
_map_clicked = false;
onmapsingleclick " "my_global_pos = _pos"; _map_clicked = true;"
waituntil {_map_clicked};
_pos_i_need = my_global_pos;
Is there something correct in it?
-
map_clicked = false;
onMapSingleClick "my_global_pos = _pos; map_clicked = true; onMapSingleClick '';true;";
waituntil {map_clicked};
_pos_i_need = my_global_pos;
-
Ah, now i see clearer, thx mate. Just that i understand all of it, what does the true at the end stand for?
-
That your onMapSingleClick code will "disable" all default ArmA behaviour with map clicks until you receive your click. For example, that clicking the map will not command your driver to move to that position.
-
Ah, makes sense, indeed. Thanks mandoble. I'm learning a lot new stuff while writing this script. You and Spooner are noted to be in Credits, for sure.
Works perfectly, Thanks and...
*SOLVED*