Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: Question about exitWith command

  1. #21
    Quote Originally Posted by (Spinor @ May 17 2007,12:50)
    Quote Originally Posted by [b
    Quote[/b] ]I'm more a fan of "gosub" (from days way past *** ) ***I know that can be done by calling another script, ***I just like looking at 1 page of code vs having several different scripts open to
    follow.
    Same here. As a solution, you can simply define private functions within a script, much like you would in C:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// code
    private&#34;_myfunc&#34;;
    _myfunc=
    {
    *** private&#91;&#34;_a&#34;,&#34;_b&#34;&#93;;
    *** _a=_this select 0;
    *** _b=_this select 1;
    *** _a+_b
    };

    // more code

    _sum = &#91;1,2&#93;call _myFunc;
    As for the topic of exiting and switching scopes, also check out the functions &#39;scopeName&#39;, &#39;breakTo&#39; and &#39;breakOut&#39; to assign a name to a scope, and selectively breaking from/to a given scope.[/QUOTE]
    Thanks for that little tidbit.....I never knew that could be done either. I have a long way to go with this stuff.

  2. #22
    Quote Originally Posted by [b
    Quote[/b] ]From what I&#39;ve seen from other peoples works, that they don&#39;t depend on the "Function" portion (returning values) of .sqf, but more for format and readability.
    Just because they do it that way, doesn&#39;t make it right.

    Consequently, what I get from you argument is that you are frustrated because you don&#39;t want to use either convention (SQS or SQF) as they were intended to be used. This seems a bit anti-progressive to me. You are only setting yourself up for these pitfalls because you want to go Left instead of Up or Down.

  3. #23
    Quote Originally Posted by (CrashDome @ May 17 2007,14:03)
    Quote Originally Posted by [b
    Quote[/b] ]From what I&#39;ve seen from other peoples works, ***that they don&#39;t depend on the "Function" portion (returning values) of .sqf, ***but more for format and readability.
    Just because they do it that way, doesn&#39;t make it right.

    Consequently, what I get from you argument is that you are frustrated because you don&#39;t want to use either convention (SQS or SQF) as they were intended to be used. This seems a bit anti-progressive to me. You are only setting yourself up for these pitfalls because you want to go Left instead of Up or Down.
    No, not frustrated. Both .sqf and .sqs are very good. Its just that .sqs seems to be going away, or they would like us to move tward .sqf format. I just hate to loose capibility while moving ahead.

    Your earlyer points are well taken. As I&#39;m learning this stuff I&#39;ll have to forget old habits I guess. Again, I&#39;m just a noob at this stuff anyway.

  4. #24
    No, we&#39;re not losing capability by switching from .sqs to .sqf, only gaining. Any functionality that could have been done with .sqs can now be restructured for .sqf. I find the best thing to do at this point is forget all about .sqs, forget that it ever existed, and start from the ground up with .sqf. It may not be as straight forward or newb-friendly, and it certainly requires more planning, but it&#39;s technically superior to .sqs.

    Back to the specific topic, there really isn&#39;t any technical need to exit in .sqf, an entire .sqf script can be written without exiting if you structure it right, with no less functionality than an .sqs script filled with exits. Also, exitWith fulfills its function, IMO it does just what we need it to, no more, no less.
    VBS2 Designer

    Quote Originally Posted by Armored_Sheep View Post
    I like to call Arma a sandbox game that works pretty much like LEGO - you buy it not just because you want to have a nice car from the main picture on its box, do you?

  5. #25
    The script I was debugging was a script to handle I/O from and to a Dialog box. Therefore it needed to end once the dialog was completed. In the case of the .sqs, exit worked perfectly.

    I ended up restructuring the layout and exited the loop without further problems. What I read in the wiki wasn&#39;t clear for me, so I expected one thing, and got another. I just need to learn the bounds of the newer format. Several have suggested other methods to use in the .sqf format that I didn&#39;t know were available either.

    I&#39;ll get there some day

  6. #26
    We&#39;re here to help

Page 3 of 3 FirstFirst 123

Posting Permissions

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