Results 1 to 6 of 6

Thread: [help] Moving mouse in a circle.

  1. #1
    Join Date
    Mar 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [help] Moving mouse in a circle.

    Hey guys!
    I would like to move my mouse in a circle.

    But I don't know how to code it..
    I have tried something like

    Code:
    This isn't correct coding, but I tried something like this, well this was what I was going for, someone point me in the right line please :).
    
    GetMousePosition(x,y);
    x:= sqrt(1-y^2);
    y:=sqrt(1-x^2);
    MoveMouse(x,y).
    repeat.
    Problem here is that sqrt needs extended, and getMousePOs are ints. and well my logic 'x:=sqrt(1-y^2)' may just be plain wrong lol

  2. #2
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    the formula is wrong anyways, look at radialroadwalk for some idea's btw use
    SCAR Code:
    Round(x)
    to make x an integer
    Infractions, reputation, reflection, the dark side of scripting, they are.

  3. #3
    Join Date
    Mar 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay thanks! I'll carry on and try to figure it out ;D

    x^2 + y^2 = r^2 right.

    x:= sqrt(r^2-y^2);
    y:= sqrt(r^2-x^2);

    Am I on the right track.

  4. #4
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quickly whipped this up:

    SCAR Code:
    procedure CircleMouse(Sx, Sy, Diameter: Integer);
    var
      Ax, Ay, TheAngle: Integer;
    begin
      TheAngle := 0;
      while (True) do
      begin
        Inc(TheAngle);
        MoveMouse(Round(Diameter * Cos(TheAngle * (pi/180))) + Sx, Round(Diameter * Sin(TheAngle * (pi/180))) + Sy);
        if (TheAngle = 360) then
          Break
        else
          Wait(1);
      end;
    end;

    Should work.

  5. #5
    Join Date
    Mar 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It did, and thanks. I completely forgot that you could express them in-terms of sin and cosine, thanks mate.

    I believe you meant radius when you typed diameter :P :P

  6. #6
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by enig.ma View Post
    It did, and thanks. I completely forgot that you could express them in-terms of sin and cosine, thanks mate.

    I believe you meant radius when you typed diameter :P :P
    Yea ... I'm finnish and I don't really need words like that alot XD

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. help with moving mouse? again?
    By joshdabest01 in forum OSR Help
    Replies: 3
    Last Post: 11-01-2008, 12:54 PM
  2. help with moving mouse?
    By joshdabest01 in forum OSR Help
    Replies: 2
    Last Post: 11-01-2008, 09:52 AM
  3. Click the mouse without moving it?
    By orange in forum OSR Help
    Replies: 5
    Last Post: 08-08-2008, 10:13 PM
  4. Moving the mouse...
    By Jason2gs in forum Delphi/FPC Help and Tutorials
    Replies: 8
    Last Post: 08-10-2007, 05:48 PM

Posting Permissions

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