Results 1 to 4 of 4

Thread: arrays in leosolver

  1. #1
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default arrays in leosolver

    i keep getting out of range in Side[i]:=CountColorD(6710894,MSX1,MSY1,MSX2,MSY2,10)
    SCAR Code:
    Function FindWhichStone:string;
    var i,S,B:integer;
        Side:array of integer;
    Begin
      i:=1
      Marktime(Mark);
      Repeat
        repeat
          Setarraylength(Side,i);
          wait(100)
          Side[i]:=CountColorD(6710894,MSX1,MSY1,MSX2,MSY2,10)
          B:=CountColorD(4473928,MSX1,MSY1,MSX2,MSY2,28)
          Writeln('Background '+inttostr(B))
        until Side[i] > 1000
        Writeln(inttostr(side[i]))
        i:=i+1
      until timeFromMark(Mark) > 20000;
      S:=AMax(Side)
      Writeln('final amount of pixels = '+inttostr(S))
      if FindBitMapTol(x,y,close,MSX1,MSY1,MSX2,MSY2) then
      MMouse(x,y,2,2)
      if isuptext('lose') then
      getmousePos(x,y)
      Mouse(x,y,0,0,true)
      Result:=stone
    end;

    it worked before now i did something but i forgot what i did and now id doesnt work

  2. #2
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    You set the array length as 1, which means you can only call on Side[0]. You're trying to call on Side[1]. To do that, you'd have to set the array length greater than 1.

  3. #3
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    actually thats an i not 1. but this is my first time using arrays and it was going fine till i did something that i dont remember what i did.

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Oh I know, you set i as 1.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Arrays, stuck on arrays
    By Camaro' in forum OSR Help
    Replies: 1
    Last Post: 03-08-2008, 02:02 AM
  2. Need Help With Arrays
    By papenco in forum OSR Help
    Replies: 16
    Last Post: 11-28-2007, 03:56 AM
  3. Help with Arrays
    By kooldude in forum OSR Help
    Replies: 16
    Last Post: 06-15-2007, 05:36 AM

Posting Permissions

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