Results 1 to 12 of 12
  1. #1
    ket_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    2
    My Mood
    Psychedelic

    Red face Bot For Web Browser Game

    Hello all mpgh members. I wanted to contribute to community with something so here it goes. I was looking for a bot tutorials and as a beginner in scene is pretty hard to start but while i was looking for it i found one where some guy was looking for help with a game where he needed help he wanted to make a bot but no solid replies were given to him so i try'd code one my self -> link to idea.

    P.s If someone can help me to improve code please reply with suggestions i'm not so good so i got my own ways how to do things ! ;]

    The game what we are going to BOT is -> Cursor Game
    It's simple .swf game where you have to click on circles as time iss running out and you can't see your cursor.

    Ok my way how i managed to pull out this bot is simple lets start with a programm core lets make console project and put this is source:

    Code:
    #include <windows.h>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    
    
     return 0;
    }

    next we add our variables..
    Code:
    #include <windows.h>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
         int rez = 0, rez2 = 0;
         int xpos;                    // possition of x axis
         int ypos;                    // possition of y axis
         int r,g,b;                    // red green blue color variables see later on why ;)
         srand(time(NULL));      // for rand 
    
     return 0;
    }
    next we add function so we can open up our url link with a game and variable for a value aka score what we need to set in this game
    and we will use setcursorpos(),mouse_event(), for setting our cursor to start game button and then later on click on it

    Code:
    #include <windows.h>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
         int rez = 0, rez2 = 0;
         int xpos;                            
         int ypos;                         
         int r,g,b;                             
         srand(time(NULL));               
    
    
         cout << "Enter result what you want to score: ";
         cin >> rez2;        // asks for score 
         
         ShellExecute(NULL, "open", "https://dagobah.net/flash/Cursor_Invisible.swf",
                      NULL, NULL, SW_SHOWNORMAL);                                                   // opens up browser with our game
                     
         Sleep(5000); // little sleep func. for flash game to load up in a case we got slow internet..  
         SetCursorPos(500,650);  // set cursor on start button
         mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // click start button
         Sleep(3900); // waits for game to start it's 3 seconds but i put more in case of small flash lag 
    
    
     return 0;
    }
    Next thing is going to be positioning on screen and getting color from pixel where our mouse pointer is.

    Code:
    #include <windows.h>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
         int rez = 0, rez2 = 0;
         int xpos;                         
         int ypos;                       
         int r,g,b;                      
         srand(time(NULL));       
    
    
         cout << "Enter result what you want to score: ";
         cin >> rez2; 
         
         ShellExecute(NULL, "open", "https://dagobah.net/flash/Cursor_Invisible.swf", 
                      NULL, NULL, SW_SHOWNORMAL);                         
                     
         Sleep(5000);                                                                     // little sleep func. for flash game to load up in a case we got slow internet..  
         SetCursorPos(500,650);                                                      // set cursor on start button
         mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);             // click start button
         Sleep(3900);                                                                    // waits for game to start it's 3 seconds but i put more in case of small flash lag 
    
    do  // we will loop this until rez < rez2 aka our wanted game score is == with our variable...
     {
         xpos =  rand() % 600 + 200,ypos =  rand() % 450 + 250; 
    
    /* randomize X,Y positions on screen it's for black box where all the action hapenns
    we don't want to click out of that area right ? + i made it a n00b way but well it works for me lol /*
         
         SetCursorPos(xpos,ypos);                         // set cursor @ random position on screen
         
                                                                   // next 6 lines are for get pixel func. and rgb code.
         HDC hdcScreen = GetDC(0);  
         COLORREF crPixel = GetPixel(hdcScreen,xpos,ypos);  // getting color from pixel from our coordinates from rand(); my explanation's rock lol
         ReleaseDC(0,hdcScreen);
         r = GetRValue(crPixel);                            // getting r code next two lines the same only g,b ! RGB FTW!
         g = GetGValue(crPixel);  
         b = GetBValue(crPixel); 
        
         DeleteDC(hdcScreen);                            // i dont know how to explain this
         
         if(r == 240 && g == 240 && g == 240)      // if our target color is grey [look in game the center of circles or outter lines then we click... 
              {
              mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);  // mouse click event
              Sleep(500);                            // i put sleep after click becouse sometimes flash games make's glitches and my score dont count every hit
              rez++;                                  // if  we click on circle +1 to our score ;]
              }
      
     }while(rez < rez2); 
    
     return 0;
    }
    Well this works for me only thing is you need to add -> libgdi32.a to a project
    And my screen resolution was 1152x864 if you got different you need to rewrite
    a) xpos = rand() % 600 + 200,ypos = rand() % 450 + 250; // with your screen coords
    b) SetCursorPos(500,650); // for game start button coords



    Please give good critic and advice to me how can i improve my code thanks.

  2. The Following User Says Thank You to ket_ For This Useful Post:

    pDevice (05-04-2012)

  3. #2
    DarkHackerSociety's Avatar
    Join Date
    May 2012
    Gender
    male
    Location
    In Your Shadow
    Posts
    31
    Reputation
    10
    Thanks
    2
    My Mood
    Cool
    who test this ??

    please i need your feedback!

  4. #3
    ket_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    2
    My Mood
    Psychedelic
    Quote Originally Posted by DarkHackerSociety View Post
    who test this ??

    please i need your feedback!
    I can make video if you need compiling -> testing

    here is DL link with compiled version..
    Compiled version

    But remember: This was tested on XP SP2, adn screen resolution was 1152x864 if your screen rez will be different you wount get this to work you have to edit few
    lines in code.
    Last edited by ket_; 05-02-2012 at 12:18 PM. Reason: Uploaded compiled file

  5. #4
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    "if(r == 240 && g == 240 && g == 240)"

    checking g twice

    Also
    Code:
    if(GetPixel(hdcScreen,xpos,ypos) == RGB(240, 240, 240))
    {
    ...
    }
    would've been less work
    Ah we-a blaze the fyah, make it bun dem!

  6. #5
    ket_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    2
    My Mood
    Psychedelic
    Quote Originally Posted by Hell_Demon View Post
    "if(r == 240 && g == 240 && g == 240)"

    checking g twice

    Also
    Code:
    if(GetPixel(hdcScreen,xpos,ypos) == RGB(240, 240, 240))
    {
    ...
    }
    would've been less work
    Thanks didn't notice r g g's mistake and that for shure makes code more compact & readable :]

  7. #6
    GokuVoelKop's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    39
    Reputation
    10
    Thanks
    0
    My Mood
    Blah
    have you noticed you can use tab to select the circle and just press spacebar?
    code a tab, spacebar bot.

    here is a sample I made for this game in autoit.

    Code:
    #include <misc.au3>
    
    global $x = 0
    
    while 1
    	if _IsPressed(56) Then
    		Send("{TAB}")
    		Sleep(20)
    		_go()
    	EndIf
    WEnd
    
    func _go()
    	While $x<100
    		$x = $x+1
    		Send("{TAB}")
    		Sleep(100)
    		Send("{SPACE}")
    	WEnd
    	Exit
    EndFunc
    Last edited by GokuVoelKop; 05-04-2012 at 05:30 AM.

  8. #7
    ket_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    2
    My Mood
    Psychedelic
    Quote Originally Posted by GokuVoelKop View Post
    have you noticed you can use tab to select the circle and just press spacebar?
    code a tab, spacebar bot.

    here is a sample I made for this game in autoit.

    Code:
    #include <misc.au3>
    
    global $x = 0
    
    while 1
    	if _IsPressed(56) Then
    		Send("{TAB}")
    		Sleep(20)
    		_go()
    	EndIf
    WEnd
    
    func _go()
    	While $x<100
    		$x = $x+1
    		Send("{TAB}")
    		Sleep(100)
    		Send("{SPACE}")
    	WEnd
    	Exit
    EndFunc
    haha didn't notice that this could save up some lines for shure

  9. #8
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    GetPixel() is a horrible function to use to check as many pixels as this. Good job for coding it, but you will come to notice that it has many draw backs. If you want really fast pixel searching, save a snapshot then filter through the pixels.

    Good job bro.

  10. #9
    pDevice's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    d3d9.h
    Posts
    1,306
    Reputation
    15
    Thanks
    420
    My Mood
    Stressed
    very nice



  11. #10
    ket_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    33
    Reputation
    10
    Thanks
    2
    My Mood
    Psychedelic
    Quote Originally Posted by 258456 View Post
    GetPixel() is a horrible function to use to check as many pixels as this. Good job for coding it, but you will come to notice that it has many draw backs. If you want really fast pixel searching, save a snapshot then filter through the pixels.

    Good job bro.
    Thanks in advice but isn't saving a snapshot then filter through it it will be a little bit longer ? Like i use getpixel() only for that random cursor position if it's ok then click of not ok other random position and again getpixel() if it's ok then click.. ! I would like to see some kind of example of your suggestion will try to look up if i'll can't find any wait for PM

  12. #11
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Quote Originally Posted by ket_ View Post
    Thanks in advice but isn't saving a snapshot then filter through it it will be a little bit longer ? Like i use getpixel() only for that random cursor position if it's ok then click of not ok other random position and again getpixel() if it's ok then click.. ! I would like to see some kind of example of your suggestion will try to look up if i'll can't find any wait for PM
    I will try to see if i still have that code. I made it like a year ago.

  13. #12
    salmonfish's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Hello, does anyone know what x, y axis you'd have to add for it to work on 1366x768 resolution? I've been playing around with it but don't quite understand, I can get it to click the start button but then it starts moving the mouse indefinitely not really clicking anything and the only way to get out of the program is to Ctrl+C and terminate the process (Shift+F5) in Visual Studio.

Similar Threads

  1. [Request] NirokWar Web Browser Game Hacks/Cheats
    By Shubi in forum Hack Requests
    Replies: 1
    Last Post: 07-16-2011, 08:23 AM
  2. [REALEASE] Web Browser for MPGH
    By The Game in forum Art & Graphic Design
    Replies: 19
    Last Post: 06-28-2009, 08:16 AM
  3. Web browser game
    By statics in forum Debate Fort
    Replies: 0
    Last Post: 06-15-2009, 02:21 AM
  4. Tutorial for Browser Games
    By Striker in forum General Game Hacking
    Replies: 4
    Last Post: 11-23-2006, 09:54 AM
  5. Hack for Browser game
    By suppaman in forum General Game Hacking
    Replies: 6
    Last Post: 01-22-2006, 11:09 AM