Page 2 of 5 FirstFirst 12345 LastLast
Results 11 to 20 of 49

  Click here to go to the first Developer post in this thread.  

Thread: Some questions about the Arma 2 scripting engine.

  1. #11
    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.

  2. #12
    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:
    Code:
    for [{_i=0},{_i<=9},{_i=_i+1}] do {
    
    player globalChat format["%1",_i];
    
    };
    Getting the same:
    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:
    Code:
    {player globalChat format["%1", _x];player globalChat format["%1", _x];} forEach _arr;
    Works perfectily in init.sqf and gives perfect result.

    And

    Code:
    {
    player globalChat format["%1", _x];
    player globalChat format["%1", _x];
    } forEach _arr;
    Does not, causing player to say just "ANY", but still works OK in the spawned function.

    Is it bug or feature?
    Last edited by DiRaven; Jun 13 2009 at 11:11.

  3. #13
    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

  4. #14
    Quote Originally Posted by CarlGustaffa View Post
    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?
    Will try, but later. Now want to give people to test my pra-alpha version. =)

    In the meantime I have another question:
    How to set unit desctiption (see Editor, unit mode, unit creating/editing dialog) via script?

  5. #15
    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.

  6. #16
    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 ----------

    Quote Originally Posted by CarlGustaffa View Post
    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?
    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
    Code:
    {
      player globalChat format["%1", _x];
      hint format["%1", _x];
    } forEach _markers;
    RIGHT
    Code:
    {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?

    ---------- 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?

  7.   This is the last Developer post in this thread.   #17
    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.
    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?
    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 us
    Bohemia Interactive
    Arma 3 - Project Lead
    Watch us, tweet us, poke us

    Take On Helicopters - Project Lead
    Take On Noisecontrollers!

  8. #18
    I'm using SQF ewerywhere now.

    Right now have checked next code:

    Works fine:
    Code:
    for [{_x=0},{_x<=49},{_x=_x+1}] do {arr_mkr_OPFOR_possibleDeploymentLocations = arr_mkr_OPFOR_possibleDeploymentLocations + ['mkr_OPFOR_possibledeployment_' + format ["%1", _x]];}
    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 - UTF8
    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.

  9. #19
    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.

  10. #20
    Corporal Worldeater's Avatar
    Join Date
    Jan 23 2009
    Location
    some weird prison planet full of apes
    Posts
    88
    Your examples won't work since both are missing a semicolon after the code block.

    You might want to take a look at your RPT file. I guess you'll find a lot of answers in there...

    Edit: Are you sure you use execVM and not exec to run your scripts?
    Last edited by Worldeater; Jun 15 2009 at 01:03.

Page 2 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •