I would use .sqf with
for [{_i=0},{_i<=9},{_i=_i+1}] do {
player globalChat format["%1",_i];
};
With this method _i mussnt be initialized with private.
I would use .sqf with
for [{_i=0},{_i<=9},{_i=_i+1}] do {
player globalChat format["%1",_i];
};
With this method _i mussnt be initialized with private.
u mean I should write something like
?Code:private "_i"; for "_i" from 0 to 9 do { player globalChat format["%1",_i]; };
That does not work aswell.
With the following:
Getting the same:Code:for [{_i=0},{_i<=9},{_i=_i+1}] do { player globalChat format["%1",_i]; };
Code:BLUFOR Player: "ANY"
---------- Post added at 11:53 AM ---------- Previous post was at 11:05 AM ----------
Looks like foreach loop can have multiline code block only in "spawn"ed functions.
For example:
Works perfectily in init.sqf and gives perfect result.Code:{player globalChat format["%1", _x];player globalChat format["%1", _x];} forEach _arr;
And
Does not, causing player to say just "ANY", but still works OK in the spawned function.Code:{ player globalChat format["%1", _x]; player globalChat format["%1", _x]; } forEach _arr;
Is it bug or feature?
Last edited by DiRaven; Jun 13 2009 at 11:11.
Could it be that you're no longer supposed to do loops like this from within a timing 'critical' script like init.sqf? I don't know really, it just sounds like some new limitation. Did you try starting such as script from a trigger or something?
Regards
Carl Gustaffa - left this game due becoming Steam Exclusive
I have no idea. In Arma1 there was no point in doing it, as you couldn't script new or changed slots (afaik). All slots had to be preplaced in the editor, where you also set your descriptions.
Can you now make dynamic slots?
You could try the 3D Editor approach, as it generates a mission.sqf. Check what commands it uses to create playable characters, and if description can be set.
As I have tried - absolutely clearly it is possible to _remove_ playable slots without players. Later will try to add some.
Still think it is now possible to add new game slots while game is already running.
Nice tip about the editor. It's still buggy and useless but there is a chance to get an answer to my question.
---------- Post added at 09:49 PM ---------- Previous post was at 09:44 PM ----------
One more thing... I have noticed that many loop-like commands (if, forEach and so on) works only in one-row-variant in the init.sqf script.
Like:
WRONG
RIGHTCode:{ player globalChat format["%1", _x]; hint format["%1", _x]; } forEach _markers;
May be this will help me when I will get back to thet piece of code... Still not sure if it is bug or feature?Code:{player globalChat format["%1", _x]; hint format["%1", _x];} forEach _markers;
---------- Post added at 10:09 PM ---------- Previous post was at 09:49 PM ----------
And once more - quick tip. How to execute script on every machine during the MP play? Not at the start via the init.sqf but in progress.
Should it be 0:0 trigger, working for everyone? Or there is another way to do it?
This is definately not a feature and I doubt it's broken, because that would mean pretty much none of the scripts in the game would work. The old SQS was line-based, but SQF is not. If you have a case where this is not true, please present it to usOne more thing... I have noticed that many loop-like commands (if, forEach and so on) works only in one-row-variant in the init.sqf script.
May be this will help me when I will get back to thet piece of code... Still not sure if it is bug or feature?![]()
Bohemia Interactive
Arma 3 - Project Lead
Watch us, tweet us, poke us
Take On Helicopters - Project Lead
Take On Noisecontrollers!
I'm using SQF ewerywhere now.
Right now have checked next code:
Works fine:
Gives "any" value instead of _x:Code:for [{_x=0},{_x<=49},{_x=_x+1}] do {arr_mkr_OPFOR_possibleDeploymentLocations = arr_mkr_OPFOR_possibleDeploymentLocations + ['mkr_OPFOR_possibledeployment_' + format ["%1", _x]];}
File format - UTF8Code:for [{_x=0},{_x<=49},{_x=_x+1}] do { arr_mkr_OPFOR_possibleDeploymentLocations = arr_mkr_OPFOR_possibleDeploymentLocations + ['mkr_OPFOR_possibledeployment_' + format ["%1", _x]]; }
Editor - NotePad++ with the ArmaEdit addon
---------- Post added at 01:34 PM ---------- Previous post was at 01:06 PM ----------
BTW multiline (/* comment */) comments do not work aswell.
Due to locality I've got another question:
1. How to execute script on the server. So I must be sure that:
- It is executed.
- It is executed by server.
2. How to do the same for the certain group of players. For example for one side, for one group, for all players. And again I must be sure that:
- Script is executed.
- Script is executed by the certain group of players.
The second to my mind can be done using repeating triggers with 0:0 area. But I have no idea how to do first one.
Last edited by Worldeater; Jun 15 2009 at 01:03.