Jump to content
Sign in to follow this  
Somerville

onMapSingleClick

Recommended Posts

Hi,

I need a variable (_pos) to get the position of onMapSingleClick.

Kinda like _pos = getpos (onMapSingleClick) basically. I'm editing Mr-Murray's artillery script (I started a while ago, and abandoned it due to lack of time), and i'm just wondering if somebody could help?

Thanks,

Share this post


Link to post
Share on other sites

I'm not sure if I understand you correctly, but _pos is actually the variable that would contain the coordinates of your map click.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick "hint format[""%1"", _pos]; onMapSingleClick """"";

This would display the position you clicked, which shows that onMapSingleClick passes the players map single click coordinates into _pos. If you want to keep that value, and wait for another map single click, just store it in another variable; _firstclick = _pos;

Hope this helps..

ZNorQ.

Share this post


Link to post
Share on other sites

If it *has* to be _pos in your script, try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

GlobalPos = "JUNK";

onMapSingleClick "GlobalPos = _pos; onMapSingleClick '';";

waitUntil{GlobalPos != "JUNK"};

_pos = GlobalPos;

Share this post


Link to post
Share on other sites

onMapSingleClick {"eart" setMarkerPos _pos; ewayposx = (_pos select 0); ewayposy=(_pos select 1)}

_pos is the whole package x,y,z variables....

ewayposx = (_pos select 0) is the x variable. etc.....

hope this helps

stonewall

Share this post


Link to post
Share on other sites
onMapSingleClick {"eart" setMarkerPos _pos; ewayposx = (_pos select 0); ewayposy=(_pos select 1)}

_pos is the whole package x,y,z variables....

ewayposx = (_pos select 0) is the x variable. etc.....

hope this helps

stonewall

huh.gif

Nah mate. Not a good explanation at all. And i copied it into a new sqs file, and it gives a an error saying

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Type code, expected string".

I'm having the same issue here.

It just wont work.

i want to click on the map where i want team 'alpha' to go, and marker to show up on the map also.

can some one please help, and explain clearly what it does plese?

Share this post


Link to post
Share on other sites

I think that example was OFP code.

For SQS, try:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick ' "eart" setMarkerPos _pos; ewayposx = (_pos select 0); ewayposy=(_pos select 1) '

Note the single quotes allow embedding double quotes inside, or you could have used paired double quotes.

Share this post


Link to post
Share on other sites
I think that example was OFP code.

For SQS, try:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick ' "eart" setMarkerPos _pos; ewayposx = (_pos select 0); ewayposy=(_pos select 1) '

Note the single quotes allow embedding double quotes inside, or you could have used paired double quotes.

I'll try it right now...

EDIT:  it worked!  I can move a marker around the map.

I have one more question, whats the code to make a goup move to that marker?  is it;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> alpha moveto markername

becose this wont work

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  

×