After looking into the code snippets beneficial to my SQL Shaiya database, it has come to my attention that doing this project in c++ will have a much better outcome than VB.net. I've been playing with c++ GetPixel() and SetPixel() and have decided that it would come in really handy for players that dont like playing in windowed mode.
GetPixel() retrieves an RGB value of a pixel at any coordinate of your chosing. The script i designed to test my theory works by asking the player for an umber of Pixel locations by pressing CTRL when the mouse is hovering over the destination, and again for each instance. After all pixel locations have been set, the program runs a continuous loop to read those same pixels until the color changes (at this point, it doesn't care what color it is, was, or will be, it just flags when it has changed, and for each instance).
In Lamens terms, If you set 3 pixel watchers in the game, 1 for HP minimum, 1 for MP minimum, 1 for Stamina minimum, the program would raise a flag when the color was no longer what it was (for this instance, it was Red, now it's Black (almost dead). You could easily add the function "emulate keypress (Z or X) for whichever hot-key would recover the missing stat.
In 2nd example, If you set up a point-to-point loop to check every pixel from coordinate 1 to coordinate 2, you could retrieve (for instance) what % exp you have every minute (rather than every loop cycle). have it store the last 30 values, average them, and then give you a time frame of how long it would take to level at the same rate. Limiting this by 30 minutes allows you to keep it accurate after you go afk.
Now, I've also determined that SetPixel() could be used to re-draw the minimap with a better detailed, pre-defined version. For instance... I can use GetPixel() around the in-game coordinate (toggled on/off with H key) and match the numbers to pre-set bitmaps, the program could determine where you are, hide your minimap, and draw a new one pixel-by-pixel from your coordinates, and draw friendlies using the same program on it as well... Not to mention the availability of a Quest Tracker addon function later programmed, with color-codes to show the player where he/she should be grinding.
This would of course lead to the function of "run to location" using key-coordinated pre-defined routes in order to get to wherever it is you wanted to get to. ^.^ yay for botting.
heres the source so far... c++ Win32 Console
Code:
GetPixel() retrieves an RGB value of a pixel at any coordinate of your chosing. The script i designed to test my theory works by asking the player for an umber of Pixel locations by pressing CTRL when the mouse is hovering over the destination, and again for each instance. After all pixel locations have been set, the program runs a continuous loop to read those same pixels until the color changes (at this point, it doesn't care what color it is, was, or will be, it just flags when it has changed, and for each instance).
In Lamens terms, If you set 3 pixel watchers in the game, 1 for HP minimum, 1 for MP minimum, 1 for Stamina minimum, the program would raise a flag when the color was no longer what it was (for this instance, it was Red, now it's Black (almost dead). You could easily add the function "emulate keypress (Z or X) for whichever hot-key would recover the missing stat.
In 2nd example, If you set up a point-to-point loop to check every pixel from coordinate 1 to coordinate 2, you could retrieve (for instance) what % exp you have every minute (rather than every loop cycle). have it store the last 30 values, average them, and then give you a time frame of how long it would take to level at the same rate. Limiting this by 30 minutes allows you to keep it accurate after you go afk.
Now, I've also determined that SetPixel() could be used to re-draw the minimap with a better detailed, pre-defined version. For instance... I can use GetPixel() around the in-game coordinate (toggled on/off with H key) and match the numbers to pre-set bitmaps, the program could determine where you are, hide your minimap, and draw a new one pixel-by-pixel from your coordinates, and draw friendlies using the same program on it as well... Not to mention the availability of a Quest Tracker addon function later programmed, with color-codes to show the player where he/she should be grinding.
This would of course lead to the function of "run to location" using key-coordinated pre-defined routes in order to get to wherever it is you wanted to get to. ^.^ yay for botting.
heres the source so far... c++ Win32 Console
Code:
#include <windows.h>
#include <iostream>
using namespace std;
#define MAXCOORDS 2
POINT pt;
struct coord {
int x;
int y;
};
struct RGBcolor {
int RED;
int GREEN;
int BLUE;
};
struct pixel {
coord Loc;
RGBcolor Now;
RGBcolor Was;
};
pixel PLoc[MAXCOORDS];
coord GetMouse(void) {
coord cCoord;
GetCursorPos(&pt);
cCoord.x = (pt.x);
cCoord.y = (pt.y);
return cCoord;
}
RGBcolor GetPixelRGB(coord Dest) {
RGBcolor retVal;
HDC hdcScreen = GetDC(0);
COLORREF crPixel = GetPixel(hdcScreen,Dest.x,Dest.y);
ReleaseDC(0,hdcScreen);
retVal.RED = GetRValue(crPixel);
retVal.GREEN = GetGValue(crPixel);
retVal.BLUE = GetBValue(crPixel);
return retVal;
}
short CTRLStateNow = 0, CTRLStateThen = 0;
int CNTRLPressed(void) {
int CTRLPressed = 0;
CTRLStateNow = GetAsyncKeyState(VK_CONTROL);
if (CTRLStateNow != CTRLStateThen) { // key state changed
//cout << "Value= " << CTRLPressed << "." << endl;
if (CTRLStateThen == 0) { // key down
CTRLPressed = 1;
} else { // key held or released
if (CTRLStateNow == 0) { // released
CTRLPressed = 3;
} else { // held
CTRLPressed = 2;
}
}
CTRLStateThen = CTRLStateNow;
}
return CTRLPressed;
}
int main()
{
for (int a=0;a<MAXCOORDS;a++) {
cout << "Hover on coordinate " << a+1 << ", then press CTRL..." << endl;
while (true) {
if (CNTRLPressed() == 3) { break; }
}
// get pixel location
PLoc[a].Loc = GetMouse();
// get pixel color
RGBcolor GotRGB = GetPixelRGB(PLoc[a].Loc);
PLoc[a].Now = GotRGB;
// print data
cout << "C" << a+1 << "(" << PLoc[a].Loc.x << ", " << PLoc[a].Loc.y << ") = r" << PLoc[a].Now.RED << "g" << PLoc[a].Now.GREEN << "b" << PLoc[a].Now.BLUE << ";" << endl;
}
while (true) {
RGBcolor GotRGB;
for(int i=0;i<MAXCOORDS;i++) {
GotRGB = GetPixelRGB(PLoc[i].Loc);
if (GotRGB.RED != PLoc[i].Was.RED || GotRGB.GREEN != PLoc[i].Was.GREEN || GotRGB.BLUE != PLoc[i].Was.BLUE) { // pixel changed
cout << "Pixel " << i+1 << " changed!" << endl;
PLoc[i].Was = PLoc[i].Now;
PLoc[i].Now = GotRGB;
}
}
}
system("pause");
//DeleteDC(hdcScreen);
return 0;
}