| View previous topic :: View next topic |
| Author |
Message |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Thu Jun 26, 2008 10:08 am Post subject: Coding autopotter |
|
|
Hello, I finished the autoattack/autoloot/autoclick functions on my bot and am now working on the autopotter. I'm not really sure how to do this however. I've looked up the GetPixel API and am not sure how to apply that to the HP/MP bar since the gradients change. Help in delineating the basics on how an auto potter should be coded would be appreciated. Thank you.
BTW, I'm coding this in Win32 API C++. No MFC.
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Thu Jun 26, 2008 10:36 am Post subject: |
|
|
| I've visited that page at least ten times. No it doesn't help.
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jun 26, 2008 11:46 am Post subject: |
|
|
The gradient may change, but the bar stays the same length. Just split it up into sections. Then check if there is gray behind a section.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Thu Jun 26, 2008 12:08 pm Post subject: |
|
|
You can check if red or blue > green.
if(rgb.red>rgb.green){true}
EDIT:
I forget if the gray gradient changes too. If not, just check the gray instead of the red/blue.
_________________
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Thu Jun 26, 2008 4:42 pm Post subject: |
|
|
| Well, I just tried that and it just pots constantly. I'm sure there has to be a better way. How about autoChat? How would one implement that? I've tried sending my edit boxes WM_COPY messages, and then postmessagging the WM_PASTE function to MS, but nothing seems to work.
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Thu Jun 26, 2008 5:01 pm Post subject: |
|
|
Usually when you are using windows forms you use managed code and can use the String class from the BCL.
| Code: |
System::String^ theText = textBox1.Text;
|
Then you can do | Code: | | PostMessageX(theText . . . | get me?
EDIT: or you can use this | Code: | Clipboard.SetDataObject(MyTextbox.SelectedText, true);
|
Might only work in C#, as i'm better at it.
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Fri Jun 27, 2008 7:56 am Post subject: |
|
|
for the autopotter, look at the bar when its empty, there is a line just above the line black notches where the colours remain the same all the way along
just find the rgb value of that and check it
as for the autochat, my C++ isnt great, but from memory you do something like
for i =1 to (Length of text string) do
PostMessageX(your maple handle, WM_CHAR, Ord(TextString(i)), 0)
im not sure if Ord(TextString(i)) works in C++, the i is just the integer (1st, 2nd 3rd) of the charcter
_________________
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jun 27, 2008 9:44 am Post subject: |
|
|
Why not using HP and MP values instead of GetPixel?
| Snootae wrote: | for i =1 to (Length of text string) do
PostMessageX(your maple handle, WM_CHAR, Ord(TextString(i)), 0)
im not sure if Ord(TextString(i)) works in C++, the i is just the integer (1st, 2nd 3rd) of the charcter |
Just:
| Code: | | PostMessage(hwnd, WM_CHAR, string[i], 0); |
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Jun 27, 2008 12:12 pm Post subject: |
|
|
Ok, to avoid using all this bypassed postmessage stuff just inject the message into the Window Procedure.
| Code: |
BOOL InjectMSG(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
WNDPROC WndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
if(WndProc != NULL) {
if(CallWindowProc(WndProc, hWnd, Msg, wParam, lParam)) {
return TRUE;
}
}
return FALSE;
}
|
I find it easier than all the work that you need to do just to use one API.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Sun Jun 29, 2008 10:02 am Post subject: |
|
|
| Ok, I've spent literally 3 days trying to figure out the autopotter and nothing is working. I tried using getpixel but the only color it returns is black. Any ideas on what is going wrong?
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 29, 2008 12:23 pm Post subject: |
|
|
Can you post your code?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun Jun 29, 2008 1:22 pm Post subject: |
|
|
Are you using screen or client coords?
_________________
|
|
| Back to top |
|
 |
WafflesFTW Expert Cheater
Reputation: 0
Joined: 21 Mar 2008 Posts: 131
|
Posted: Sun Jun 29, 2008 2:03 pm Post subject: |
|
|
Alright the pertinent code that I'm using is
| Code: | DWORD WINAPI AutoPotFunction(LPVOID lpParam)
{
AutoPotOnOff = TRUE;
HDC MSHDC = GetDC(MSHWND);
while(AutoPotOnOff == TRUE)
{
HPRGBValue = GetPixel(MSHDC, HPLocation.x, HPLocation.y);
MPRGBValue = GetPixel(MSHDC, MPLocation.x, MPLocation.y);
if(GetRValue(HPRGBValue) <= GetBValue(HPRGBValue))
SendKeyUp(VK_9);
if(GetBValue(MPRGBValue) <= GetRValue(MPRGBValue))
SendKeyUp(VK_0);
}
return 0;
} |
GetCursorPos(HPLocation);
GetCursorPos(MPLocation);
I registered various hotkeys to perform the top two commands. All variables are correctly initialized earlier in the script. Builds with 0 warnings/erors.
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sun Jun 29, 2008 2:13 pm Post subject: |
|
|
Might want to try http://msdn.microsoft.com/en-us/library/ms533179(VS.85).aspx incase you're trying to get the coords from without the client. Are you playing in full screen or window?
And you're using a bypassed getpixel?
_________________
|
|
| Back to top |
|
 |
|