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 


[C++] Auto Pot (MapleStory) [Solved]
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
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 7:44 am    Post subject: [C++] Auto Pot (MapleStory) [Solved] Reply with quote

I'm making an auto pot for my bot. It works perfectly in fullscreen maple but not in windowed.
Code:
void AutoPot()
{
   while(true)
   {
      HWND hWnd = FindWindow(_T("MapleStoryClass"), _T("MapleStory"));
      HDC hdc = GetDC(hWnd);
      COLORREF hpPot = GetPxl(hdc, 252, 588);
      COLORREF mpPot = GetPxl(hdc, 350, 589);
      BYTE hpR, mpR, hpG, mpG, hpB, mpB;
      hpR = GetRValue(hpPot),   hpG = GetGValue(hpPot), hpB = GetBValue(hpPot);
      mpR = GetRValue(mpPot), mpG = GetGValue(mpPot), mpB = GetBValue(mpPot);
      if(hpR == 190, hpG == 188, hpB == 189)
         PostMsg(MapleWnd, WM_KEYDOWN, 0x23, (MapVirtualKey(0x23, 0) << 16));
      else if(mpR == 173, mpG == 178, mpB == 173)
         PostMsg(MapleWnd, WM_KEYDOWN, 0x41, (MapVirtualKey(0x41, 0) << 16));
      Sleep(100);
   }
}
I don't know why it's not working in windowed mode. In my eyes this should work in windowed mode withput preblems Shocked .

Last edited by TraxMate on Mon Oct 27, 2008 3:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

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

PostPosted: Sun Oct 26, 2008 8:01 am    Post subject: Reply with quote

because i think maplestory changes the colours in different modes apparently, test the colours
_________________
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Sun Oct 26, 2008 8:01 am    Post subject: Reply with quote

Have you tried using ClientToScreen();?


void AutoPot()
{
while(true)
{
HWND hWnd = FindWindow(_T("MapleStoryClass"), _T("MapleStory"));
HDC hdc = GetDC(hWnd);

POINT pt[2] = { {252, 588},{350,589} }

ClientToScreen(hWnd, &pt[1]);
COLORREF rgb (hdc, pt[1].x, pt[1].y); // this is wrong, fix it ;D

umm and the rest, i cannot remember Very Happy try it like this..
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 8:23 am    Post subject: Reply with quote

Snootae wrote:
because i think maplestory changes the colours in different modes apparently, test the colours
I don't think it's that. I used Pixels (a program made by me, check binaries.) to see if it was a match and it wasn't because the x/y is not the same in windowed and full :/.

blackmorpheus wrote:
Have you tried using ClientToScreen();?


void AutoPot()
{
while(true)
{
HWND hWnd = FindWindow(_T("MapleStoryClass"), _T("MapleStory"));
HDC hdc = GetDC(hWnd);

POINT pt[2] = { {252, 588},{350,589} }

ClientToScreen(hWnd, &pt[1]);
COLORREF rgb (hdc, pt[1].x, pt[1].y); // this is wrong, fix it ;D

umm and the rest, i cannot remember try it like this..
Hmm if you don't remember how could I do? ^^ Never even heard of ClientToScreen :p
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Sun Oct 26, 2008 9:56 am    Post subject: Reply with quote

Alright, try this:
Code:

void AutoPot()
{
   while(true)
   {
      HWND hWnd = FindWindow(_T("MapleStoryClass"), _T("MapleStory"));
      HDC hdc = GetDC(hWnd);
      POINT pt[2] = { {252, 588},{350,589} }
      ClientToScreen(hWnd, &pt[1]);
      COLORREF hpPot = GetPxl(hdc, pt[1].x, pt[1].y);
      ClientToScreen(hWnd, &pt[2]);
      COLORREF mpPot = GetPxl(hdc, pt[2].x,pt[2].y);
      BYTE hpR, mpR, hpG, mpG, hpB, mpB;
      hpR = GetRValue(hpPot),   hpG = GetGValue(hpPot), hpB = GetBValue(hpPot);
      mpR = GetRValue(mpPot), mpG = GetGValue(mpPot), mpB = GetBValue(mpPot);
      if(hpR == 190, hpG == 188, hpB == 189)
         PostMsg(MapleWnd, WM_KEYDOWN, 0x23, (MapVirtualKey(0x23, 0) << 16));
      else if(mpR == 173, mpG == 178, mpB == 173)
         PostMsg(MapleWnd, WM_KEYDOWN, 0x41, (MapVirtualKey(0x41, 0) << 16));
      Sleep(100);
   }
}
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 10:06 am    Post subject: Reply with quote

Stiill not working :/. Could it be that it's only for me that it's not working in windowed mode?
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

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

PostPosted: Sun Oct 26, 2008 10:09 am    Post subject: Reply with quote

i doubt it, find out what the problem is, check if its the wrong spot, or the wrong colours
_________________
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 10:26 am    Post subject: Reply with quote

Snootae wrote:
i doubt it, find out what the problem is, check if its the wrong spot, or the wrong colours
It is the wrong spot(atleast according to Pixels.), but how can it be the wrong spot when the pixels should be the same all the time? Even in windowed mode maple is only 800 x 600 pixels. I don't know about the color, will check it now.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Oct 26, 2008 10:31 am    Post subject: Reply with quote

try get the device context of the entire screen calling GetDC(0).
_________________
Stylo
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

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

PostPosted: Sun Oct 26, 2008 10:34 am    Post subject: Reply with quote

bad idea, in case anyone moves it, but i sort of agree since it doesnt currently work, in the long run not great
_________________
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 11:03 am    Post subject: Reply with quote

1qaz wrote:
try get the device context of the entire screen calling GetDC(0).
t works when I do that but then it's like Snootae said, if someone moves the window it stops working. And I have to change the x and y valuse since the borders are there.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sun Oct 26, 2008 12:25 pm    Post subject: Reply with quote

WM_MOVE is sent after a window has been moved

on WM_CREATE get the cords of maples window
on WM_MOVE get the cords of new maple position

Find the difference in x,y and add/subtract to the pixel x/y

_________________
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sun Oct 26, 2008 12:27 pm    Post subject: Reply with quote

if the shades are differnt, you can always use the "if red at xy" type of function...
_________________
Back to top
View user's profile Send private message Send e-mail
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Oct 26, 2008 1:24 pm    Post subject: Reply with quote

No.
Shades are the same for red all the way across.
The color of red is the same from left to right.

The problem is mp. Cause tehre is a grad. But I got pass that by measuring the grey behind it. Cause they gray is always the same.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Oct 26, 2008 2:31 pm    Post subject: Reply with quote

in your auto pots thread use this code
i guess it should do the job if the window moved (wrote it on quick reply)
so correct me if i'm wrong
Code:

HWND msWnd;
MSG msg;
msWnd = FindWindow(_T("MapleStoryClass"),_T("MapleStory"));
if (msWnd != 0){
   GetMessage(&msg,msWnd,0,0);
   if (msg.message == WM_MOVE){
      int newWndX, newWndY;
      newWndX = LOWORD(msg.lParam);
      newWndY = HIWORD(msg.lParam);
      int x = 0, y = 0;
      x = newWndX - oldWndX;
      y = newWndY - oldWndY;
      xPos += x;
      yPos += y;
   }
}

considering that xPos and yPos are the coords of hp/mp bar

_________________
Stylo
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