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 


Loading a pointer? [C++]
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
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Sep 03, 2007 4:30 pm    Post subject: Loading a pointer? [C++] Reply with quote

This is for a bot I'm making.
I'm doing- if HP value < 15%, send potion key.
How do I do that?
For buffing, it was easy, since the buff count address is static.
Code:
if(*(DWORD*)BuffCountAdr == 0)
   //send buff key

But I don't know what to do when offsets come into play (there are more than one).
Noz (and The_Undead) said:
Code:
*(DWORD*)(Base+Offset1+Offset2...)

That didn't work for me, but it could be something else that I did wrong. I want to hear what you all have to say.

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.


Last edited by Cx on Mon Sep 03, 2007 4:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Sep 03, 2007 4:34 pm    Post subject: Reply with quote

Not enough information, we don't know what type "base", "offset1", and "offset2" are. Post a direct snippet, please.
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Sep 03, 2007 4:43 pm    Post subject: Reply with quote

What?
Base would be the base address of the pointer.
Offset 1 would be the first offset, offset 2 would be the second offset.
Base is a DWORD, others are just small offsets.

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Sep 03, 2007 4:52 pm    Post subject: Reply with quote

You're still being vague. "not working for me" = what. Compiler errors? Run-time errors? Did you debug?
Back to top
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Mon Sep 03, 2007 5:07 pm    Post subject: Reply with quote

appalsap wrote:
You're still being vague. "not working for me" = what. Compiler errors? Run-time errors? Did you debug?


Don't be dim, you know what he means. Base address = 0x12345678, Offset1 = 0xFFA... etc.

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Sep 03, 2007 5:09 pm    Post subject: Reply with quote

Programmer wrote:
appalsap wrote:
You're still being vague. "not working for me" = what. Compiler errors? Run-time errors? Did you debug?


Don't be dim, you know what he means. Base address = 0x12345678, Offset1 = 0xFFA... etc.


Those are poor assumptions to make, and your reply doesn't have anything to do with my post you quoted.
Back to top
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Mon Sep 03, 2007 5:12 pm    Post subject: Reply with quote

appalsap wrote:
Programmer wrote:
appalsap wrote:
You're still being vague. "not working for me" = what. Compiler errors? Run-time errors? Did you debug?


Don't be dim, you know what he means. Base address = 0x12345678, Offset1 = 0xFFA... etc.


Those are poor assumptions to make, and your reply doesn't have anything to do with my post you quoted.


You said "You're still being vague.". Anyway, it isnt an assumption! And if you don't have enough information you SHOULD make assumptions or your going to get no where.

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Sep 03, 2007 5:14 pm    Post subject: Reply with quote

Programmer wrote:
You said "You're still being vague.".


Read what I said after that, "it doesn't work" is being vague.

Programmer wrote:
Anyway, it isnt an assumption!


He's hiding essential information, probably because he's using "private addresses"; if he's going to be difficult why make it easier for him Smile

Programmer wrote:
And if you don't have enough information you SHOULD make assumptions or your going to get no where.


In this case you have a good chance of being wrong, and it's very easy to ask.
Back to top
View user's profile Send private message
gamesguru
Grandmaster Cheater
Reputation: 0

Joined: 22 Mar 2006
Posts: 926
Location: detroit

PostPosted: Mon Sep 03, 2007 5:22 pm    Post subject: Reply with quote

OK, pointers are basically memory locations for the real address, that means:
base address's value+offset=pointer address.
So to do this, it'll look something like this:
Code:
int Value = BitConverter.ToInt32(ReadProcessMemory(
    mapleHandle,
    pointerBase,
    buffer, //buffer is the value of the pointerBase in byte[] value
    4, //if it's a 4 byte value that is.
    out IntPtr lpNumberOfBytesRead //just any IntPtr variable
    ));
Value+=0x00 //make that the offset
ReadProcessMemory(Value); //you know what to do from here, i hope.

_________________


Last edited by gamesguru on Mon Sep 03, 2007 5:24 pm; edited 2 times in total
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Sep 03, 2007 5:22 pm    Post subject: Reply with quote

appalsap wrote:
Programmer wrote:
You said "You're still being vague.".


Read what I said after that, "it doesn't work" is being vague.

It compiles fine, but when I try it, autopot doesn't work.
Didn't do any tests, but autobuff works fine (just a static address).

appalsap wrote:
Programmer wrote:
Anyway, it isnt an assumption!


He's hiding essential information, probably because he's using "private addresses"; if he's going to be difficult why make it easier for him Smile

They're just addresses I don't want to give out.
They make no difference though! At all!
I could have easily just given random numbers, like Programmer did.

appalsap wrote:
Programmer wrote:
And if you don't have enough information you SHOULD make assumptions or your going to get no where.


In this case you have a good chance of being wrong, and it's very easy to ask.

He happened to be correct.


gamesguru: I was hoping to not have to do that.
Besides I'm inside the process, it's a .DLL.

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.


Last edited by Cx on Mon Sep 03, 2007 5:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Mon Sep 03, 2007 5:23 pm    Post subject: Reply with quote

I understood what he meant straight away. It works FYI, i've tried it before.
_________________
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Sep 03, 2007 5:24 pm    Post subject: Reply with quote

Programmer wrote:
I understood what he meant straight away. It works FYI, i've tried it before.

Crap.

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Mon Sep 03, 2007 5:28 pm    Post subject: Reply with quote

Cx wrote:
Programmer wrote:
I understood what he meant straight away. It works FYI, i've tried it before.

Crap.


Lol?

_________________
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Mon Sep 03, 2007 5:30 pm    Post subject: Reply with quote

Programmer wrote:
Cx wrote:
Programmer wrote:
I understood what he meant straight away. It works FYI, i've tried it before.

Crap.


Lol?

Meaning something else is wrong. D:

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Mon Sep 03, 2007 6:33 pm    Post subject: Reply with quote

Cx wrote:
Programmer wrote:
Cx wrote:
Programmer wrote:
I understood what he meant straight away. It works FYI, i've tried it before.

Crap.


Lol?

Meaning something else is wrong. D:


And that is?

_________________
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