Jump to content
Sign in to follow this  
CarlGustaffa

My sqf hint syntax won't work

Recommended Posts

Hi

Here is a little code snippet that won't work for me. I thought you could use curly braces {}to indicate "blocks" of code that the engine would read as a whole line. Maybe I misunderstand.

Sorry to bug you all with so many noob questions confused_o.gif

The code goes something like this:

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

//Unit counter loop report

_iCount=0;

while {_iCount<1} do {

sleep 10;

_gAlpha = {alive _x} count units gAlpha;

_gBravo = {alive _x} count units gBravo;

_gCharlie = {alive _x} count units gCharlie;

_gDelta = {alive _x} count units gDelta;

_gPlatoon = _gAlpha + _gBravo + _gCharlie + _gDelta;

_gWest = WEST countSide list tUnitCounter;

_gEast = EAST countSide list tUnitCounter;

_gResistance = resistance countSide list tUnitCounter;

{hint format

["UNITS:\n

gAlpha: %1\n

gBravo: %2\n

gCharlie: %3\n

gDelta: %4\n

gPlatoon: %5\n\n

West: %6\n

East: %7\n

Resistance: %8",

_gAlpha, _gBravo, _gCharlie, _gDelta, _gPlatoon, _gWest, _gEast, _gResistance]

};

};

When curlys are removed and everything put to one line, it works as it should.

Is this possible? If so, where is my mistake?

Share this post


Link to post
Share on other sites

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

_iCount=0;

_lineFunction = {hint format

["UNITS:\n

gAlpha: %1\n

gBravo: %2\n

gCharlie: %3\n

gDelta: %4\n

gPlatoon: %5\n\n

West: %6\n

East: %7\n

Resistance: %8",

_gAlpha, _gBravo, _gCharlie, _gDelta, _gPlatoon, _gWest, _gEast, _gResistance]

};

while {_iCount<1} do {

sleep 10;

_gAlpha = {alive _x} count units gAlpha;

_gBravo = {alive _x} count units gBravo;

_gCharlie = {alive _x} count units gCharlie;

_gDelta = {alive _x} count units gDelta;

_gPlatoon = _gAlpha + _gBravo + _gCharlie + _gDelta;

_gWest = WEST countSide list tUnitCounter;

_gEast = EAST countSide list tUnitCounter;

_gResistance = resistance countSide list tUnitCounter;

call compile _lineFunction; //  or

[]spawn _lineFunction; //  if you want it to run at same time

};Example_3:_Inline_Function

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  

×