Jump to content
Sign in to follow this  
Chaos

onmapsingleclick problem

Recommended Posts

I have a problem with my script. It doesn´t works

onMapSingleClick "if (!_alt && _shift)then{onMapSingleClick ''; true; goTo "nxt";};";

For complete script - see bottom

The troop is moving immediately without waiting for shift+click command.

Edited by Chaos

Share this post


Link to post
Share on other sites

Thats probably no problem here - "if / then" works with both.

Share this post


Link to post
Share on other sites

You have "goTo" and "exit", two things that do nothing in SQF, yet you end every line with ; as SQF needs (in SQS it's a comment marker, so if you are in SQS your entire 'if/then' statement ends at onMapSingleClick '' You're also using ~ which is SQS, you'd want to use sleep #; in SQF.

Write it in one or the other format, see if it works. :)

Share this post


Link to post
Share on other sites

Oh, i removed the "goto ´nxt´" but it doesn´t works too.

I changed it to:

hint "click to set target for infantry";

_troop1 = razor1;

_mk = createMarker ["mark1",position player]; 
_mk setMarkerColor "colorRed";
_mk setMarkerShape "icon";
_mk setMarkerSize [1,1];
_mk setMarkerDir random -10 +random 20;
_mk setMarkerType "destroy";

onMapSingleClick "_mk setMarkerPos _pos; true;";

~1
_wp1 = _troop1 addwaypoint [position getMarkerpos _mk,1];
[_troop1,1] setWaypointType "move";
_troop1 setFormation "stagg column";
_troop1 setBehaviour "aware";
_troop1 setCombatMode "white";
hint "moving";

deletemarker _mk;

exit;

No difference - is still doesn´t woking.

Edited by Chaos

Share this post


Link to post
Share on other sites

for onmapsingleclick try implementing this set of code

mapclick = false;

onMapSingleClick """arty"" setMarkerPos _pos; clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

waituntil {mapclick};
_pos = clickpos;

so _pos is the position of mapclick. Change arty to your marker name. Pay attention to how many "" are used. Might be excessive at the end but does not give errors and works. I read somewhere thats how you end a mapclick.

Share this post


Link to post
Share on other sites

Thanks, i converted it to sqf:

_troop1 = razor1;

_mk = createMarker ["mark1",position player]; 
_mk setMarkerColor "colorRed";
_mk setMarkerShape "icon";
_mk setMarkerSize [1,1];
_mk setMarkerDir random -10 +random 20;
_mk setMarkerType "destroy";

mapclick = false;
onMapSingleClick """mark1"" setMarkerPos _pos; clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

waituntil {mapclick};
_pos = clickpos;

sleep 2 +random 3;
_wp1 = _troop1 addwaypoint [_pos,1];
[_troop1,1] setWaypointType "move";

exit;

It is working now.

Share this post


Link to post
Share on other sites

Thats good to here. I had trouble at the start with going from sqs to sqf, but now it is so much better. Glad to hear it is working for you. :D

Share this post


Link to post
Share on other sites
#top;

hint "Click on map for extract LZ";

#mapclick;

onMapSingleClick """LZE"" setMarkerPos _pos; clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

*** What would I put here for the script to wait until I click on the map in order to proceed to "move"***

goto "mapclick"

#move;

_pickup = getMarkerPos "LZE";

MV_EAGLE1 doMove _pickup;

Can someone help me on this one...

What command would I use for their to be a loop at "mapclick" and for the script to proceed to "move" only after I click on the map??

Edited by Meatball0311

Share this post


Link to post
Share on other sites

Replace what you have with this:

SQS:

markmoved=true

hint "Click on map for extract LZ"
onMapSingleClick """LZE"" setMarkerpos _pos;markmoved=false"

@!markmoved
onMapSingleClick ""
hint ""

_pickup = getMarkerPos "LZE"
MV_EAGLE1 doMove _pickup

SQF:

markmoved = true;

hint "Click on map for extract LZ";
onMapSingleClick """LZE"" setMarkerpos _pos;markmoved=false";

waitUntil{!markmoved};
onMapSingleClick "";
hint "";

_pickup = getMarkerPos "LZE";
MV_EAGLE1 doMove _pickup;

Edited by kylania
SQF/SQS examples

Share this post


Link to post
Share on other sites
MV_EAGLE1 sideChat "This is EAGLE ONE.... standing by for orders, over.";

sleep 2;

hint "Click on map for extract LZ";

sleep 10;

_mveagle1 = MV_EAGLE1;

#marker;

_LZmarker = createMarker["LZE",getPos _mveagle1];

_LZmarker setMarkerShape "ICON";

"LZE" setMarkerType "mil_pickup";

"LZE" setMarkerColor "ColorGreen";

#mapclick;

mapclick = false;

onMapSingleClick """LZE"" setMarkerPos _pos; clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

*** I NEED THE SCRIPT TO STOP HERE AND WAIT UNTIL I CLICK ON THE MAP BEFORE IT MOVES ON TO #pickup***

#pickup;

_pickup = getMarkerPos "LZE";

MV_EAGLE1 doMove _pickup;

I need to put some type of command that will wait until "onMapSingleClick" is clicked before it advances to #pickup ???

Share this post


Link to post
Share on other sites

Did you somehow completely miss my TWO answers to this question already posted? Completely ditch your goto mess and use the code I posted earlier.

Here's your code, including the dialog and dynamic marker creation:

markmoved = true;

MV_EAGLE1 sideChat "this is eagle one... standing by for orders, over.";
sleep 2;

hint "Click on map for extract LZ";
onMapSingleClick "LZmarker = createMarker[""LZE"",_pos];""LZE"" setMarkerShape ""ICON"";""LZE"" setMarkerType ""mil_pickup"";""LZE"" setMarkerColor ""ColorGreen"";;markmoved=false";

waitUntil{!markmoved};
onMapSingleClick "";
hint "";

_pickup = getMarkerPos "LZE";
MV_EAGLE1 doMove _pickup;

But really, to be honest you'd be much better off using the SOM module and transport option than trying to reinvent the wheel this way since once you get this part done you're gonna have to add in landing, waiting, and bringing you somewhere. All of that is automated with the SOM module.

Edited by kylania

Share this post


Link to post
Share on other sites

I did try the sqf one... do I need to use both scripts?? that sqf script that I used didnt work... actually the marker never moved to where I clicked on the map

Share this post


Link to post
Share on other sites

No, you don't need both, you just seem to be writing code in some strange mixture of SQS (the #marker stuff, that was used in SQS for goTo and is vile. :P) and SQF (sleep 2;) so I was showing you the difference between the two syntax.

Share this post


Link to post
Share on other sites

Thanks for you help... I havent tried the transport module yet.. so I will look into that instead of trying the hard way :) once again thanks

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  

×