Jump to content
Sign in to follow this  

Recommended Posts

This is driving me crazy because I can't find it but;

Is it possible to call a block in a script? Example

Block1

{

[parameters] call Block2;

doStuff;

}

Block2

{

_var= _this select 0;

doStuff;

}

So as you can see I want to call block 2 from block 1. Also I want to end the script after block1 ends. Is this possible? If not what's the best way to go about this? Change call to exec and run Block2.sqs or whatever? I'm working on an artil script and ill post if I get it done, but what's going on is I want the radio command to set some vars, let the user click the destination (using onMapSingleClick) then pass those vars off to a FireArtillery block which runs a check list then sends the fire command. The point is to make this user friendly so all you would have to do is add a radio function, play with a few variables and BAM instant artillery (not Secop). Ty for any help

Share this post


Link to post
Share on other sites

Something like this?

Block2 = {
_var = _this select 0;
doStuff;
};

//Block1
[parameters] call Block2;
doStuff;

Edited by Fincuan

Share this post


Link to post
Share on other sites

Normally I would either call Block2 as seperate script or make a function.

block2 = compile (preprocessFileLineNumbers "block2.sqf");
[parameter] call block2;

but its not necessary to put it in a seperate file if you dont want to, you can also save "block2" in a string and use call compile on that.

Oh and

exit;

cancels a script.

Share this post


Link to post
Share on other sites

Ok so block={ }; names the block? Ty. Also what code is good for a break? I've made a scopeName and break out of that but I'm sure there's a better way

---------- Post added at 10:14 AM ---------- Previous post was at 10:12 AM ----------

Cool tyvm guys. Hopefully this works, if it does ill post it. Hell I may make a quick vb program that generates it and let's users input options all nice a easy like.

Share this post


Link to post
Share on other sites

What are you planning to do ?

Share this post


Link to post
Share on other sites

I'm trying to generate a script that will let the user enter the bare minimum and get a decent fire mission without using secop. I have a fee ideas on how to go about it but right now I'm just putting to paper and seeing what comes up. Problem is I don't know the limits of the engine, like can users name their own type of round and then pass that as a parameter or will that generate an error, etc. In the end I want to make it as easy to use as possible, yet powerful enough to allow users to do what they want.

Share this post


Link to post
Share on other sites

Oh and

exit;

cancels a script.

exit only works in sqs, in sqf it doesnt do anything.

Share this post


Link to post
Share on other sites

Oh right, guess that was why I never used it. "exitWith" should work though.

Hmm, you could for example compile the mission with all your scripts and have it use an external config-file that can be easily edited. There are several ways to do this I'd say.

An dialog that shows up when the mission starts, allowing to set the parameters would also be an option. *shrug* up to you ;)

Edited by Tajin

Share this post


Link to post
Share on other sites

Ok next big Q, anyone know how to spawn, name and link the new game logics? I'm seeing if I can code in a mortar team that can be placed by putting a marker on the map and naming it.

Share this post


Link to post
Share on other sites

spawning a gamlogic:

_gLogic="logic" createvehiclelocal[0,0,0];
_glogic setpos getpos player;

creating "red dot" markers for all units of a group

_i=1;
{
   createmarker[format["%1",_i],getpos _x];
//		format["%1",_i] setMarkerShape "RECTANGLE";
   format["%1",_i] setMarkerShape "ICON";
   format["%1",_i] setMarkerType "dot";
   format["%1",_i] setMarkerSize [0.2,0.2];
   format["%1",_i] setmarkercolor "ColorRed";
//    format["%1",_i] setmarkertext format["%1",_i];
	_i=_i+1;
}foreach units group _unit;

markers represent movements of all group members:

_i=1;
while {true}do{
_i=1;
{
	(format["%1",_i]) setmarkerpos getpos _x;
	_i=_i+1;
}foreach units group _unit;
sleep 0.2;
};

Edited by Wiper

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  

×