Random Clicker

Discussion in 'Programming General' started by drainingpower, Mar 26, 2008.

Random Clicker
  1. Unread #1 - Mar 26, 2008 at 1:14 PM
  2. drainingpower
    Joined:
    Jan 15, 2008
    Posts:
    1,166
    Referrals:
    0
    Sythe Gold:
    0

    drainingpower Guru

    Random Clicker

    I have been making an auto-alcher to see how programming was like in VB. I got it almost all completed but there is only one thing wrong. Since I heard many people got banned from clicking in the same spot, I want to know how I can make the mouse click within a short distance from the target (Random Offset). Is there any way to do this? Please respond. Thanks! :)
     
  3. Unread #2 - Mar 27, 2008 at 7:59 AM
  4. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    Random Clicker

    All you need to do is add a small random number to the coordinates it's supposed to click at using a random number function.

    Code:
    'Random Number Function'
    Public Function Random(ByVal Low As Long, ByVal High As Long) As Long
       Randomize: Random = Int((High - Low + 1) * Rnd) + Low
    End Function
    You then just modify your click to be something like this where your clicking function is LeftClick and it's parameters are the X coordinate and Y coordinate to click at (this would be giving it a max offset of -3 or 3 off of X and/or Y.
    Code:
    LeftClick X + Random(-3,3), Y + Random(-3,3)
    You could of course do it to your mouse moving function instead rather than the mouse clicking one which is what I do and find more effective. I just explained it the way that you asked though and you can decide whichever you think would be better for yourself.
     
  5. Unread #3 - Mar 27, 2008 at 8:57 AM
  6. Larry
    Joined:
    Feb 2, 2007
    Posts:
    267
    Referrals:
    2
    Sythe Gold:
    5

    Larry Forum Addict

    Random Clicker

    It is more usual to call randomize only once in the start of the program (form_load ?) then keep calling rnd
     
  7. Unread #4 - Mar 27, 2008 at 11:39 AM
  8. drainingpower
    Joined:
    Jan 15, 2008
    Posts:
    1,166
    Referrals:
    0
    Sythe Gold:
    0

    drainingpower Guru

    Random Clicker

    Thanks you so much :D now I can complete my macro!
     
  9. Unread #5 - Mar 28, 2008 at 2:33 AM
  10. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Random Clicker

    Doesn't VB .Net feature the 'return' keyword? Or am I just too far in to C based languages to remember anything? I always hated returning things by assignment.

    I think rather than just posting code like Nullware did, people should just post what needs to be done, and let the person learn. If they can't learn, they need to go back and run through everything until they _can_ get it right.
     
  11. Unread #6 - Mar 28, 2008 at 8:18 AM
  12. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    Random Clicker

    I'm not sure as I haven't programmed in .NET in about 18 months. Been doing mostly VB6/C/C++.

    He will have to learn himself. The code I posted is valid VB6 code but surely won't come close to working in .NET. :)
     
< My First Client (ShadowClient) | Help with class >

Users viewing this thread
1 guest


 
 
Adblock breaks this site