Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 61

Thread: ChooseOptionMulti + WizzyPlugin

  1. #26
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    What is the purpose of the function exactly...? I don't get why your making it so complicated if its just to return all the TPAs that are do not match point from the TBox..? Unless i'm not understanding what your trying to do exactly...



    ~NS
    It's the easiest and fastest way todo it.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

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

    Default

    Yes, I got it. I was thinking of something else at that time.

    This is what I got, but its more less the same. I was thinking of maybe even making a pre-TPA gathering all the valid TBox points and if then for the filter at the end, but thats more time consuming :/

    pascal Code:
    function ReturnPointsNotInTPA(const TotalTPA: TPointArray; Box: TBox): TPointArray;
    var
      I, II, R, L, W, H: Integer;
      B: array of array of Boolean;
    begin
      W := iAbs(Box.x2 - Box.x1);
      H := iAbs(Box.y2 - Box.y1);
      if (W = 0) or (H = 0) then
      begin
        SetLength(Result, 1);
        Result[0].x := -1;
        Result[0].y := -1;
        Exit;
      end;
     
      SetLength(B, W + 1, H + 1);
      SetLength(Result, (W + 1) * (H + 1));
      L := Length(TotalTPA) - 1;
     
      // This could also be, B[][] := PointInBox(TotalTPA[I], Box);
      for I := 0 to L do
        if (TotalTPA[I].x >= Box.x1) and (TotalTPA[I].x <= Box.x2) and
           (TotalTPA[I].y >= Box.y1) and (TotalTPA[I].y <= Box.y2) then
          B[TotalTPA[I].x - Box.x1][TotalTPA[I].y - Box.y1] := True;
     
      for I := 0 to W do
        for II := 0 to H do
          if not B[I][II] then
          begin
            Result[R].x := I + Box.x1;
            Result[R].y := II + Box.y1;
            R := R + 1;
          end;
         
      SetLength(B, 0, 0);
      SetLength(Result, R);
    end;



    ~NS

  3. #28
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Okay, so I have been playing with the ReturnPointsNotInTPA and I cannot seem to fix it.

    Anyone else have any solutions? Here is what is in there:
    pascal Code:
    Function ReturnPointsNotInTPA(Const TotalTPA: TPointArray; const Box: TBox): TPointArray;
    var
      x, y, w, h, i, l: integer;
      B: Array of Array of Boolean;
    begin;
      w := Box.x2 - Box.x1;
      h := Box.y2 - Box.y1;
      if (w = 0) and (h = 0) then
        Exit;
      SetLength(b, w + 1, h + 1);
      l := High(TotalTPA);
      x := 0;
      for i := 0 to l do
        if ((TotalTPA[i].x >= Box.x1) and (TotalTPA[i].x <= Box.x2) and
            (TotalTPA[i].y >= Box.y1) and (TotalTPA[i].y <= Box.y2)) then
        begin;
          Inc(x);
          B[TotalTPA[i].x-Box.x1][TotalTPA[i].y-Box.y1] := True;
        end;
      if x = 0 then
        Exit;
      SetLength(result,(w + 1) * (h + 1) - x);
      i := 0;
      for x := 0 to w do
        for y := 0 to h do
          if not B[x][y] then
          begin;
            Result[i].x := x + Box.x1;
            Result[i].y := y + Box.y1;
            Inc(i);
          end;
      SetLength(b,0);
    end;
    Remove the -x or add a check if you already set the point when counting x.
    Also, see this.

    EDIT: Nadeem's code should work too?

    Although this is a bit over the top:

    SCAR Code:
    if (W = 0) or (H = 0) then
      begin
        SetLength(Result, 1);
        Result[0].x := -1;
        Result[0].y := -1;
        Exit;
      end;
    Last edited by nielsie95; 06-10-2009 at 04:39 AM.

  4. #29
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    I just redownloaded SRL and both my friend and I get [Runtime Error] : Exception: in line 584 in script C:\Program Files\SCAR 3.20\includes\SRL/SRL/Core/Text.scar
    every time ChooseOption is called.
    Thanks for working on this guys
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  5. #30
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Never happened to me, never. Running Win7 with SCAR 3.20d, portable and non-portable. No problems
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  6. #31
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    I just redownloaded SRL and both my friend and I get [Runtime Error] : Exception: in line 584 in script C:\Program Files\SCAR 3.20\includes\SRL/SRL/Core/Text.scar
    every time ChooseOption is called.
    Thanks for working on this guys
    Same thing Hopefully it will be fixed soon Thanks for your effort guys!


    ~Home

  7. #32
    Join Date
    Jun 2007
    Location
    Greenville, SC
    Posts
    1,149
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    In a function i wrote that handles the gate for the cows south of falador, I use 2 things that in my mind set off the error i get.

    error: Access violation at address 00529608 in module 'scar.exe'. Read of address 0000006C

    I use "FindColorSpiralTolerance" and "ChooseOption".

    heres the function:
    SCAR Code:
    Function HandleGate: boolean;
    var
      G:TPoint;
    begin
      G:=Point(3032, 3313);
      if not(loggedin) then exit;
      MyRandoms;
      if FindObjectEx(G, 7050, 5) then
      begin
        Writeln('Attempting to handle gate.');
        if (GetMyPos.x = 3031) then
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if IsUpText('pen') then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              ChooseOption('pen');
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if IsUpText('pen') then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              ChooseOption('pen');
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end;
      end else Writeln('Gate already open, walking in the cow pen now.');
    end;

    Can anyone help me? I think its a problem with scar, but i have no idea.

  8. #33
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Try this my friend, I replaced the ChooseOption with a find text .

    SCAR Code:
    Function HandleGate: boolean;
    var
      G:TPoint;
    begin
      G:=Point(3032, 3313);
      if not(loggedin) then exit;
      MyRandoms;
      if FindObjectEx(G, 7050, 5) then
      begin
        Writeln('Attempting to handle gate.');
        if (GetMyPos.x = 3031) then
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if IsUpText('pen') then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              ChooseOption('pen');
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              ChooseOption('pen');
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end;
      end else Writeln('Gate already open, walking in the cow pen now.');
    end;

  9. #34
    Join Date
    Jun 2007
    Location
    Greenville, SC
    Posts
    1,149
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'll try that, although it looks like you changed absolutely nothing. =\
    maybe im blind.

    EDIT: NVM, lol, i see it now. =]
    i hope it works =]

    EDIT again >.>: Didn't work, im still getting an access violation error. Im soooo confused. =[

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

    Default

    Fine nielsie :P

    Here:
    pascal Code:
    function ReturnPointsNotInTPA(const TotalTPA: TPointArray; Box: TBox): TPointArray;
    var
      I, II, R, L, W, H: Integer;
      B: array of array of Boolean;
    begin
      W := iAbs(Box.x2 - Box.x1);
      H := iAbs(Box.y2 - Box.y1);
      if (W = 0) or (H = 0) then Exit;
      SetLength(B, W + 1, H + 1);
      SetLength(Result, (W + 1) * (H + 1));
      L := Length(TotalTPA) - 1;

      for I := 0 to L do
        if (TotalTPA[I].x >= Box.x1) and (TotalTPA[I].x <= Box.x2) and
           (TotalTPA[I].y >= Box.y1) and (TotalTPA[I].y <= Box.y2) then
          B[TotalTPA[I].x - Box.x1][TotalTPA[I].y - Box.y1] := True;

      for I := 0 to W do
        for II := 0 to H do
          if not B[I][II] then
          begin
            Result[R].x := I + Box.x1;
            Result[R].y := II + Box.y1;
            R := R + 1;
          end;
      SetLength(B, 0, 0);
      SetLength(Result, R);
    end;

    Hey, Try this:
    SCAR Code:
    Function HandleGate: boolean;
    var
      G:TPoint;
      V: TIntegerArray;
    begin
      G:=Point(3032, 3313);
      if not(loggedin) then exit;
      MyRandoms;
      if FindObjectEx(G, 7050, 5) then
      begin
        Writeln('Attempting to handle gate.');
        V := [257, 183, 281, 237, 4, 208, 119, 225, 225, 4];
        if (GetMyPos.x = 3031) then F := 0 else F := 5;
        if FindColorSpiralTolerance(x, y, 5401208, V[F], V[F+1], V[F+2], V[F+3], V[F+4]) then
        begin
          MMouse(x, y, 2, 2);
          wait(100+Random(75));
          if IsUpText('pen') then
          begin
            GetMousePos(x, y);
            Mouse(x, y, 0, 0, false);
            wait(100+Random(75));
            ChooseOption('pen');
            Writeln('Successfully opened gate. =D');
            GatesOpened:=GatesOpened+1;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          Writeln('Failed to find gate.');
          LogOut;
          TerminateScript;
        end;
      end else
        Writeln('Gate already open, walking in the cow pen now.');
    end;

    I shortened up the code, and added GetMousePos(); If that doesn't work, try increasing the characters used in ChooseOption? Ex: 'pen gat', 'Open'



    ~NS
    Last edited by Nadeem; 06-11-2009 at 02:44 AM.

  11. #36
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  12. #37
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Rune Pro: Sorry my bad use this:

    SCAR Code:
    Function HandleGate: boolean;
    var
      G:TPoint;
    begin
      G:=Point(3032, 3313);
      if not(loggedin) then exit;
      MyRandoms;
      if FindObjectEx(G, 7050, 5) then
      begin
        Writeln('Attempting to handle gate.');
        if (GetMyPos.x = 3031) then
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if IsUpText('pen') then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
                Mouse(x, y, 0, 0, True);
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
          begin
            MMouse(x, y, 2, 2);
            wait(100+Random(75));
            if IsUpText('pen') Then
            begin
              Mouse(x, y, 0, 0, false);
              wait(100+Random(75));
              if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
                Mouse(x, y, 0, 0, True);
              Writeln('Successfully opened gate. =D');
              GatesOpened:=GatesOpened+1;
            end else
            begin
              Writeln('Failed to find gate.');
              LogOut;
              TerminateScript;
            end;
          end else
          begin
            Writeln('Failed to find gate.');
            LogOut;
            TerminateScript;
          end;
        end;
      end else Writeln('Gate already open, walking in the cow pen now.');
    end;

    That should work

  13. #38
    Join Date
    Jun 2007
    Location
    Greenville, SC
    Posts
    1,149
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The first one got this: [Error]: Access violation at address 00529608 in module 'scar.exe'. Read of address 00000280

    second one: [Error]: Access violation at address 00529608 in module 'scar.exe'. Read of address 0000018C

    I have no idea what could be wrong...

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

    Default

    Hmm... Maybe try this on a different version of SCAR...? Or probably just do what Shuttleu's recommending, i.e: dl dev rev 32



    ~NS

  15. #40
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    Hmm... Maybe try this on a different version of SCAR...? Or probably just do what Shuttleu's recommending, i.e: dl dev rev 32



    ~NS
    I just used 3.15b, and it worked. I then updated it's SRL, and then it stopped working.

    Something has changed is the latestt revs
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  16. #41
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Yes... The function ReturnPoints was changed.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

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

    Default

    Then maybe revert back to the previous one, or at least differentiate between what was changed to pin point error and come up with a better solution?



    ~NS

  18. #43
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Here is the old plugin if any one wants.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    nice post only one thing, its a dll...! a .dbr or .pas would've been better/easier IMO



    ~NS

  20. #45
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Here. The dll was just for people that need to use. Here is the other
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  21. #46
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    I have an idea to fix it. Give me a few.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  22. #47
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Double posting, but does the newest one work?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  23. #48
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Double posting, but does the newest one work?
    No, same error. Happens in ChooseOption for me.

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

    Default

    What was there change? I'd like to see please



    ~NS

  25. #50
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    Fine nielsie :P

    Here:
    pascal Code:
    function ReturnPointsNotInTPA(const TotalTPA: TPointArray; Box: TBox): TPointArray;
    var
      I, II, R, L, W, H: Integer;
      B: array of array of Boolean;
    begin
      W := iAbs(Box.x2 - Box.x1);
      H := iAbs(Box.y2 - Box.y1);
      if (W = 0) or (H = 0) then Exit;
      SetLength(B, W + 1, H + 1);
      SetLength(Result, (W + 1) * (H + 1));
      L := Length(TotalTPA) - 1;

      for I := 0 to L do
        if (TotalTPA[I].x >= Box.x1) and (TotalTPA[I].x <= Box.x2) and
           (TotalTPA[I].y >= Box.y1) and (TotalTPA[I].y <= Box.y2) then
          B[TotalTPA[I].x - Box.x1][TotalTPA[I].y - Box.y1] := True;

      for I := 0 to W do
        for II := 0 to H do
          if not B[I][II] then
          begin
            Result[R].x := I + Box.x1;
            Result[R].y := II + Box.y1;
            R := R + 1;
          end;
      SetLength(B, 0, 0);
      SetLength(Result, R);
    end;

    ~NS
    I honestly don't see the use for all those failsafes... If you just make sure you pass a correct box everything is well... I've already submitted a patch to nava which should fix the issue.

    All this checking is just too much overhead IMO. If I start passing random params to Functions in SCAR it will most likely crash too. You can't add failsafes for everything...



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

Page 2 of 3 FirstFirst 123 LastLast

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
  •