Results 1 to 3 of 3

Thread: Variable assignment problem

  1. #1
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default Variable assignment problem

    Simba Code:
    function findDTMCustom(x,y,DTM,x1,y1,x2,y2 : Integer) : Boolean;
    var aFound : Extended;
    Tmpx,Tmpy : Integer;
    begin
      Result :=  FindDTMRotated(DTM, Tmpx, Tmpy, x1,y1,x2,y2, -Pi, Pi, Pi/30, aFound);
      x := tmpX;
      y := tmpy;
       writeln('found DTM' + inttostr(x));
    end;
    function followBirdArrow : Boolean;
    var xP,y : Integer;
    begin
      Result := false;
      if findDTMCustom(xP, y,birdArrowMMDTM, MMX1, MMY1, MMX2, MMY2) then
        begin
        writeln('found arrow' + inttostr(xP));
          Mouse(xP,y,3,3,Mouse_left);
          sleepWhileMoving;
          Result := true;
        end;
    end;

    Output:

    Output //

    found DTM624
    found arrow0

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by slushpuppy View Post
    Simba Code:
    function findDTMCustom(x,y,DTM,x1,y1,x2,y2 : Integer) : Boolean;
    var aFound : Extended;
    Tmpx,Tmpy : Integer;
    begin
      Result :=  FindDTMRotated(DTM, Tmpx, Tmpy, x1,y1,x2,y2, -Pi, Pi, Pi/30, aFound);
      x := tmpX;
      y := tmpy;
       writeln('found DTM' + inttostr(x));
    end;
    function followBirdArrow : Boolean;
    var xP,y : Integer;
    begin
      Result := false;
      if findDTMCustom(xP, y,birdArrowMMDTM, MMX1, MMY1, MMX2, MMY2) then
        begin
        writeln('found arrow' + inttostr(xP));
          Mouse(xP,y,3,3,Mouse_left);
          sleepWhileMoving;
          Result := true;
        end;
    end;

    Output:



    your x, y on findDTMCustom should be var parameters.
    Also could just pass the var param from FindDTMRotated directly to your function var param.
    Simba Code:
    function findDTMCustom(var x,y: Integer; DTM,x1,y1,x2,y2 : Integer) : Boolean;
    var
      aFound : Extended;
    begin
      Result :=  FindDTMRotated(DTM, x, y, x1,y1,x2,y2, -Pi, Pi, Pi/30, aFound);
      writeln('found DTM' + inttostr(x));
    end;

    http://villavu.com/forum/showthread.php?t=90561

  3. #3
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default

    Thanks! Massive oversight on my part

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
  •