Hi, I am pretty new to C++ and would really appreciate some help.
I'm trying to write a program that will click on a particular color pixel on my screen. For instance, the program would click on a blue dot on my desktop.
I play a mmorpg and I have been codeing some autos to play the game for me. I've been running my scripts using x,y coordinates to click on the screen. I would like to start being able to use color as an alternative method of clicking. Any help would be greatly appreciated.
I tried using the command FindColor(#color_that_I_Want_To_Click_On) but that keeps coming up with an error.
Code So Far
#include <iostream>
#include <windows.h>
#include <stdlib.h>
using namespace std;
int main()
{
SetConsoleTitle("White Rabbit");
{
cout << "Welcome To White Rabbit: Power Miner" << endl;
cout << "\n\nPlease Have Your Inventory Open\nYou Should Be Directly South Of The Rock\nAlso Have A North By North East View\nHave Your View As High As Possible" << endl;
cout << " " << endl;
int x,y,slpTime,i;
cout << "Enter the number of ores to mine: " << endl;
cin >> i;
cout << "\n\nEnter X Coordinate (255): " << endl;
cin >> x;
cout << "\n\nEnter y Coordinate (305): " << endl;
cin >> y;
cout << "\n\nEnter Respawn Time For Ore In Seconds: " << endl;
cin >> slpTime;
cout << "\n\nStatus." << "\n X coordinate: " << x << " \nY coordinate: " << y << " \nTime in seconds between clicks: " << slpTime << endl;
for(int t = 1; t <= i; t++){
/*This is where I Need the help instead of (x,y) I need it to locate and click on a color*/
SetCursorPos(x,y);
Sleep(1000);
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
Sleep(10000);
SetCursorPos(565,390);
Sleep(1000);
mouse_event(MOUSEEVENTF_RIGHTDOWN, 565, 390, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, 565, 390, 0, 0);
Sleep (1000);
SetCursorPos(565,430);
Sleep(1000);
mouse_event(MOUSEEVENTF_LEFTDOWN, 565, 430, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 565, 430, 0, 0);
Sleep(slpTime*1000);
if (GetAsyncKeyState(VK_ESCAPE)){
exit(0);
}
else continue;
}
return 0;
}
}