Home   Help Search Login Register  

Author Topic: clickable marker  (Read 655 times)

0 Members and 1 Guest are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
clickable marker
« on: 13 Jun 2003, 20:04:21 »
Yea Im back again with a new Q. ItÂ's gonna be a whole lot of Qs these months cause I got this mission which is way over my OFP mind... but whatever. ;D :P

Any1 know how to make a clickable marker or sumthin like that? I wanna make this cause IÂ'm working on some kinda half-command-engine-dunno-watcha-really-gonna-call-it-thing. Like u click on a marker on the map itÂ'll return some sidechat message or sum script or sumthin. Any1 know how I can do this? And itÂ's a moving marker. I appriciate any help. Thx. :-*

deaddog

  • Guest
Re:clickable marker
« Reply #1 on: 13 Jun 2003, 20:19:38 »
One way is to have an array of your marker names:

_markers=["one","two","three"] or whatever....

and then determine if the map click position is within a certain distance (20 meters??) of a marker or find which marker is closest.

Using SnyPir's distancepos function:

_mappos=map click position

_dis=999999
_closest=""
{_d=[_mappos,getmarkerpos _x] call distancepos;if (_d<_dis) then {_dis=_d;_closest=_x}} foreach _markers

_closest will contain the name of the closest marker to the map click position.  _dis will be its distance.  If _dis is less than , say 20 meters, then that is the marker you clicked on.  That prevents clicking 1km away from the nearest marker and having it select that marker.

Syntax may not be perfect but that should work.  Could be a better way also.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:clickable marker
« Reply #2 on: 13 Jun 2003, 20:29:43 »
dead dog is right ;D

but da syntax is... ;)  ;D

u have 2 use onmapsingleclick command here

so

it starts like dat

onmapsingleclick "_pos exec {NEarest.sqs}"

now da script (nearest.sqs)

Code: [Select]
_pos = _this select 0

_dis=20
_closest=""
{_d=[_mappos,getmarkerpos _x] call distancepos;if (_d<_dis) then {_dis=_d;_closest=_x}} foreach _markers
? _dis > 20 : exit
.... rest ofscript : _closest is da chosen marker

:cheers:

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:clickable marker
« Reply #3 on: 13 Jun 2003, 20:39:05 »
OK. Didnt understand much of that but u are the scripter master so what can go wrong? ;D I have to study my scritpin skills. :P

Cheers!

:cheers:

*adds to creds list* ;)