Jump to content
Sign in to follow this  
1para{god-father}

Random Marker name

Recommended Posts

I am generating a random marker name but then I need to use this for other stuff an example UPSMON so I need to find the name of the marker so i can then use it later.

Anyone suggest the best way , or a diffrent way of doing it ?

_marker1 = createMarker format["marker_%1", floor(random 100)],getPos _vehicname ];
_marker1 setmarkershape "ELLIPSE";
_marker1setmarkersize [200,200];

_upsgrp1 = [1,_positionToSpawnIn,1,["markername ??????? how would i find this out ????","spawned","showmarker","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Share this post


Link to post
Share on other sites

_marker1 contains the name of the marker.

If you mean from a different script then you need to store it somewhere. Exactly how to do it in your particular situation depends on what your situation looks like.

Share this post


Link to post
Share on other sites

I did the following but it did not work, am i missing something ?

_upsgrp1 = [1,_positionToSpawnIn,1,[_marker1,"spawned","showmarker","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Share this post


Link to post
Share on other sites
I did the following but it did not work, am i missing something ?

_upsgrp1 = [1,_positionToSpawnIn,1,[_marker1,"spawned","showmarker","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Hmm you might be using a different UPSMON that the one I am used to:

[_grpA,_mrk,"nofollow","showmarker"] execVM "scripts\upsmon.sqf";

However, regardless, if the 'structure' is right then it should work. _marker1 will be the name of the marker. Is the code posted here an exact match? because you have a syntax error (missing space):

_marker1setmarkersize [200,200];

Share this post


Link to post
Share on other sites

Think you'll find _marker1 is the object, UPSMON wants the marker name which in the example is "marker_%1", obviously substitued.

Try

_marker1Nam = format["marker_%1",floor(random 100)];
_marker1 = createMarker format["%1", _marker1Nam],getPos _vehicname ];
_marker1 setmarkershape "ELLIPSE";
_marker1 setmarkersize [200,200];

and pass _marker1Nam to UPSMON.

Share this post


Link to post
Share on other sites

createMarker returns the name of the marker, not some object. So _marker1Nam and _marker1 will have the same string value each.

psvialli - since you create marker, try with that part only first. Then see if the marker is on your map, then you know that part works. Then it must be something else that is the issue. Checked the docs for UPSMON - you have created the template first right?

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

one thing that is wrong i found but not fixed it as i am working on it is _marker1 = createMarker format["%1", _marker1Nam],getPos _vehicname ]; its missing a [ but i put it like this and still nothing _marker1 = createMarker format[["%1", _marker1Nam],getPos _vehicname ];

Share this post


Link to post
Share on other sites

Don't name your markers with a random pre- or suffix. Instead you keep a marker-counter somewhere you'll use as your suffix and increment afterwards. This ensures unique names for them. Otherwise, and even if chances are small, you're just asking for trouble.

floor(random 100)? That aren't that many markers and really only a few before you're guaranteed to run into trouble. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×