freghar / template

Generic Arma 3 Mission Template for Serious Gameplay
Other
1 stars 0 forks source link

create OSD-printing set of functions #19

Closed freghar closed 8 years ago

freghar commented 8 years ago

Create the following wrappers for BIS_fnc_typeText or BIS_fnc_typeText that would abstract the XML-like formatting:

(these could be combined, but that would perhaps complicate the data input format).

Also create a function that would display mission info (nearestLocations, time as "0800", map name, ... holywood style) using the OSD functions.

freghar commented 8 years ago

Note that for cinematic effect, BIS_fnc_establishingShot may be better - it includes typing the text, date, time and shows the target location from an UAV-like view. It can also display icons in 3D as map markers, allowing ie. establishing shot of multiple enemy artillery positions, each with a marker on it.

// [target_position_or_object, "text to display", altitude_of_camera, radius_of_camera_around_pos]
0 = [player, "Awaiting counterattack", 50, 20] spawn BIS_fnc_establishingShot;

It also has more arguments, see https://community.bistudio.com/wiki/BIS_fnc_establishingShot .

@milivojm - maybe useful for the case you originally had in mind.

milivojm commented 8 years ago

Very nice. Again, you found a function I wasn't aware of. :+1:

freghar commented 8 years ago

In any case, the basic OSD version is also done, eaa5e4cbb4.

milivojm commented 8 years ago

Wanted to ask you, I've seen you use a lot of exitWith? Does it behave like it should? I know there is a warning on the wiki page about that not behaving well.

freghar commented 8 years ago

Well, it's the only way to break out a scope without restarting it, essentially the equivalent of break and return in other languages, so I kind of have to use it to create programming logic that doesn't look like brainf*ck. :)

Yes, it seems to behave as it should, but it has some unexplained behavior as it doesn't simply end the scope in all cases - ie. in a forEach loop, it ends the loop entirely, despite being in its own {}. This makes common sense, but it defies the strict definition.

The weirdest thing is that you cannot write constructions like

while {something} do {
    if (cond) then {
        exitWith {};
    };
};

in SQF, because the exitWith terminates the if scope, not the while scope. Hence the alternative syntax of

while {something} do {
    if (cond) exitWith {};
};

(notice no then and no new scope). Unfortunately, this makes nested conditions breaking the while loop impossible to do.

It behaves deterministically, it's just a bit weird to use if you're used to some actual programming languages. :)