Results 1 to 9 of 9

Thread: MMouse and TPoints..

  1. #1
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default MMouse and TPoints..

    Simba Code:
    procedure MiddlePoint;
    var
    mpx,mpy:integer;
     ax,ay: Tpoint;
    begin
    mpx := ax.x;
    mpy := ay.y;
      mpx := ((606 + 649)/2);
        writeln('mp X' + ToStr(mpx));
        if mpx > 0 then writeln('yay') else writeln('boo');
      mpy := ((15 + 15)/2);
        writeln('mp Y' +ToStr(mpy));

        MMouse(ax.x,ay.y,0,0); // or MMouse(mpx, mpy, 0, 0) Both move to top left
    end;

    begin
    SetupSRL;
    MiddlePoint;

    When I do this it just moves the mouse to the top left. Not sure why?
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  2. #2
    Join Date
    Jul 2012
    Posts
    437
    Mentioned
    10 Post(s)
    Quoted
    165 Post(s)

    Default

    You never give ax.x or ay.y a value so you basically called mmouse(0,0,0,0)

  3. #3
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    mpx := ax.x;
    mpy := ay.y;

    So this should be different?
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  4. #4
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    When you do
    mpx := ((606 + 649)/2);
    mpy := ((15 + 15)/2);

    I think mpx and mpy has changed to whatever you declared it to be after.

  5. #5
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    So I'm guessing this then?

    Simba Code:
    mpx := ((606 + 649)/2);
     mpx := ax.x;
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  6. #6
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    When you do mpx := ((606 + 649)/2); , mpx will be equal to 627. But after that if you do mpx := ax.x;, mpx will no longer be 627, it will now be ax.x, which is 0 because you haven't give it anything.


    Try this.
    Simba Code:
    Procedure midddddd;
    var
      x, y: Integer;
      box: TBox;
      middle: TPoint;
    begin
      middle := MiddleBox(IntToBox(x1, y1, x2, y2));
      MMouse(middle.x, middle.y, 0, 0);
    end;

  7. #7
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    I'm not making a box. I'm using this in a triangle.

    Just trying to find the Middle point of the line and click it.

    **Edit NM....hold on trying something.
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  8. #8
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Is there any more context to this?
    For the originally posted code, I'd simply do:
    Simba Code:
    {$include_once srl/srl.simba}
    begin
      SetupSRL;
      MMouse(Round((606 + 649) / 2), Round((15 + 15) / 2), 0, 0);
    end.

  9. #9
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Have no idea about triangles in Simba. Thought you were finding the middle point of a box since you have 2 xs and 2 ys. Sorry

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
  •