Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Coding autopotter
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Thu Jun 26, 2008 10:08 am    Post subject: Coding autopotter Reply with quote

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
View user's profile Send private message AIM Address
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Thu Jun 26, 2008 10:21 am    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/ms532282(VS.85).aspx

hope that helps.

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Thu Jun 26, 2008 10:36 am    Post subject: Reply with quote

I've visited that page at least ten times. No it doesn't help.
Back to top
View user's profile Send private message AIM Address
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Thu Jun 26, 2008 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Thu Jun 26, 2008 12:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Thu Jun 26, 2008 4:42 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Thu Jun 26, 2008 5:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Fri Jun 27, 2008 7:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jun 27, 2008 9:44 am    Post subject: Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Jun 27, 2008 12:12 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Sun Jun 29, 2008 10:02 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 29, 2008 12:23 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun Jun 29, 2008 1:22 pm    Post subject: Reply with quote

Are you using screen or client coords?
_________________
Back to top
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Sun Jun 29, 2008 2:03 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun Jun 29, 2008 2:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites