Home   Help Search Login Register  

Author Topic: Creating markers  (Read 2069 times)

0 Members and 1 Guest are viewing this topic.

Offline sardaukar17

  • Members
  • *
Creating markers
« on: 14 Jun 2009, 07:11:34 »
Hello folks,

According to EVERYTHING I have read in here thus far this marker should not be getting an error but it is... So I am here asking for help. I've only been at this for a week or 2 now and this forum has been so helpful so far. This is what I have. (And yes I know most of the stuff I am asking about I can DL scripts for. But I am trying to learn this stuff not copy others work)
Code: [Select]
hint "Select target position on map"
onmapSingleClick goto "Marker";

#marker
_marker = createmarkerlocal ["target", _this];
_marker setmarkertype "marker";
_marker setmarkershape "ellipse";
_marker setmarkersize [25, 25];
_marker setmarkercolor "colorred";



exit

I am getting an error that states "0 elements provided, 3 expected" I am assuming it is refering to name, position, and type? All of those are defined I believe along with size, color, and shape.

My only thought is the postion defined as "_this" All I want to do is create a marker on the map where the player selected on the map. It is a radio activated script if that helps

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Creating markers
« Reply #1 on: 14 Jun 2009, 09:15:12 »
Looks like you've read the wrong stuff... ;)

Code: (activation field of the trigger) [Select]
dummy = [] execVM "handleMapClick.sqf";
Code: ("handleMapClick.sqf") [Select]
hint "Select target position on map";

onMapSingleClick "
deleteMarkerLocal 'target'; // required if activation shall be possible multiple times
createMarkerLocal ['target', _pos];
'target' setMarkerBrushLocal 'Solid';
'target' setMarkerColorLocal 'ColorRed';
'target' setMarkerSizeLocal [25, 25];
'target' setMarkerShapeLocal 'Ellipse';
onMapSingleClick ''; // make it work only once per activation
true;
";
try { return true; } finally { return false; }

Offline sardaukar17

  • Members
  • *
Re: Creating markers
« Reply #2 on: 15 Jun 2009, 06:40:31 »
Thank you for the help. You guys are great.  Yes it would seem I have been reading the wrong stuff... Or atleast old stuff.

Ok to make sure I understand this fully

Quote
Code: [Select]
createMarkerLocal ['target', _pos];

In this line _pos can be defined as anything I want it to be correct? for example:
Code: [Select]
_pos = getpos player
Next part I'm not sure I understand:
Quote
Code: [Select]
deleteMarkerLocal 'target'; // required if activation shall be possible multiple times
createMarkerLocal ['target', _pos];

What I think is going on here is that you are putting in the delete line infront of the create line in order to remove any old markers this script would have made.. If there are none yet then it will delete nothing and move on to the create line correct?

Next (lol sorry I'm a noob) At the end you have the onmapsingleclick command again with the note "Make it work only once per activation" How would this do that? wouldn't it just continue on to the 'true' line and then exit to be activated again by the trigger? Maybe there is something rather fundamental I am missing here.
Quote
Code: [Select]
onMapSingleClick ''; // make it work only once per activation
true;



Last
True;  Is this part just a condition of presence? or does it have a greater purpose. Is it declaring the Mapclick as true? and if so why is that really important unless I have something else in the script requiring that condition?

lol If you just want to link a bunch of tutorials I'm ok with that. :P  Patience is a virtue that even I lack at times.

Offline schuler

  • Contributing Member
  • **
Re: Creating markers
« Reply #3 on: 15 Jun 2009, 07:04:52 »
sounds good,  :D
Semper Fi

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Creating markers
« Reply #4 on: 15 Jun 2009, 15:13:51 »
Code: [Select]
createMarkerLocal ['target', _pos];In this line _pos can be defined as anything I want it to be correct?

Theoretically, yes. But you don't want to do this. _pos is created by onMapSingleClick and contains the position of the "click".

Quote
Next part I'm not sure I understand:
Code: [Select]
deleteMarkerLocal 'target'; // required if activation shall be possible multiple times
createMarkerLocal ['target', _pos];
What I think is...

Correct.

Quote
At the end you have the onmapsingleclick command again with the note "Make it work only once per activation" How would this do that? wouldn't it just continue on to the 'true' line and then exit to be activated again by the trigger? Maybe there is something rather fundamental I am missing here.

onMapSingleClick is persistent. Without deactivating it after the first click (and this is what the line does) it would be "activate once, work forever". So the user would be able to reposition the marker half an hour later by opening the map and clicking somewhere. This is probably not what you want. This way it's up to you to "reactivate" it (by calling the script again).

Quote
True;  Is this part just a condition of presence? or does it have a greater purpose.
Follow the link posted above and read on.

Quote
lol If you just want to link a bunch of tutorials I'm ok with that. :P  Patience is a virtue that even I lack at times.

Damn! I should have read your whole post before answering... :P :D
try { return true; } finally { return false; }

Offline sardaukar17

  • Members
  • *
Re: Creating markers
« Reply #5 on: 15 Jun 2009, 20:25:38 »
Great Info. Amazing feedback! I just want to say again how helpful this site is and the folks that continue to help answer the endless flow of noob questions from folks like me!  :good: :clap: