OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GeneralCoder on 17 Mar 2003, 14:33:15

Title: Detecting mapclicking
Post by: GeneralCoder on 17 Mar 2003, 14:33:15
How can I get the position where user clicked the map?

what I tryed was this:
OnMapSingleClick _pos

but the result is just 'anything'  ???
Title: Re:Detecting mapclicking
Post by: Spinor on 17 Mar 2003, 16:01:20
The argument of onMapSingleClick must be a code string. The code within the string is executed everytime the player clicks the map. Within the code string, the variables _pos, _alt, _shift, _units are reserved and represent the click position, the status of the ALT and SHIFT buttons (true or false), and an array of the selected units, respecively. E.g.:
Code: [Select]
onMapSingleClick {[_pos, _shift, _alt, _units] exec "detectClick.sqs"}This simply calls the script "detectClick.sqs" upon map click, and all the relevant paramters are passed as arguments into the script, e.g. _pos = _this select 0.
Title: Re:Detecting mapclicking
Post by: GeneralCoder on 17 Mar 2003, 22:06:41
The argument of onMapSingleClick must be a code string. The code within the string is executed everytime the player clicks the map. Within the code string, the variables _pos, _alt, _shift, _units are reserved and represent the click position, the status of the ALT and SHIFT buttons (true or false), and an array of the selected units, respecively. E.g.:
Code: [Select]
onMapSingleClick {[_pos, _shift, _alt, _units] exec "detectClick.sqs"}This simply calls the script "detectClick.sqs" upon map click, and all the relevant paramters are passed as arguments into the script, e.g. _pos = _this select 0.

allright thanks!