Results 1 to 7 of 7

Thread: Failsafe

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Failsafe

    Well i tried creating a function to find certain symbols. All it ever does it search for the first symbol.
    SCAR Code:
    function SymbolsSafe(Symbols:array of string; Number: integer): Boolean;
    var c, t: integer;
    begin
      c := 1;
      repeat
       Writeln('Searching for '+ Symbols[c]);
       if FindSymbol(x, y, Symbols[c]) then Result := False;
       Inc(t);
       c := c + 1 + t;
      until(c = Number)
    end;

    Any help?

  2. #2
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do this:

    SCAR Code:
    function SymbolsSafe(Symbols: array of string; Number: integer): Boolean;
    var c: integer;
    begin
      for c := 0 to Number do
      begin
        Writeln('Searching for '+ Symbols[c]);
        if FindSymbol(x, y, Symbols[c]) then
          Result := False;
      end;
    end;

    If you REALLY wanna do it your way :P :
    SCAR Code:
    function SymbolsSafe(Symbols: array of string; Number: integer): Boolean;
    var
      x, y, c, t: integer;
    begin
      c := 0;
      repeat
       Writeln('Searching for '+ Symbols[c]);
       if FindSymbol(x, y, Symbols[c]) then
         Result := False;
       Inc(c);
      until(c > Number);
    end;
    Last edited by Nadeem; 05-13-2009 at 09:57 AM.

  3. #3
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Edit:
    RunTime error?:
    SCAR Code:
    [Runtime Error] : Out Of Range in line 73 in script C:\Program Files (x86)\SCAR 3.20\Scripts\D.C.S. Rewritten.scar

    line:

    SCAR Code:
    Writeln('Searching for '+ Symbols[c]);
    Last edited by DeSnob; 05-13-2009 at 10:11 AM.

  4. #4
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm...
    Try this:

    SCAR Code:
    function SymbolsSafe(Symbols: TStringArray; Number: integer): Boolean;
    var
      x, y, c, t: integer;
    begin
      c := 0;
      repeat
       Writeln('Searching for '+ Symbols[c]);
       if FindSymbol(x, y, Symbols[c]) then
         Result := False;
       Inc(c);
      until(c > Number);
    end;



    ~NS

  5. #5
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That ia an error on your part. How are you calling it? And. Uae tstringarray .

  6. #6
    Join Date
    Feb 2006
    Posts
    44
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    function SymbolsSafe(Symbols:array of string; Number: integer): Boolean;
    var c: integer;
    begin
    c := 0;
    repeat
    if FindSymbol(x, y, Symbols[c]) then
    begin
    Result := True;
    end;
    c := c+1;
    until((c > Number) or(result=true));
    end;

    that would work, it stops when its reached its limit or when its found i think

  7. #7
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    it's nice to see you helping, but this has been fixed.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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