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 


2 compares running at once
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Wed Nov 20, 2013 4:39 pm    Post subject: 2 compares running at once Reply with quote

So this is a bug that I just noticed with an option that I made 2 days ago. How do I make it so that 2 options, that share the same code, can be running at once? I tried comparing them to the same and different offsets, but one of the options just refuses to work while the other is running. On this instance, the 2 options are for money and ammo, but no matter in what order I activate them, if the ammo option is running, the money option refuses to work. Here is a pic of the 2 scripts and the code structure:


Compares.png
 Description:
 Filesize:  756.04 KB
 Viewed:  13303 Time(s)

Compares.png


Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Nov 20, 2013 5:00 pm    Post subject: Reply with quote

Code:
newmem:
cmp [eax+2C],00000005
je money
cmp [eax+30],00000000
je ammo
jmp originalcode


Alternatively, you can combine money and ammo in to the same cheat, since you are performing the same routine:

Code:
newmem:
cmp [eax+2C],00000005
je cheat
cmp [eax+30],00000000
je cheat
jmp originalcode

cheat:
mov ecx,#999999
mov [eax+0C],ecx
mov al,01
jmp returnhere


If the instruction is only accessing money and ammo, and nothing else, then no compare is required. You can check this by right-clicking on the instruction in memory viewer and selecting 'find out what addresses this instruction accesses'.

If only those two addresses are being accessed (not likely), then this will do:

Code:
newmem:
mov ecx,#999999
mov [eax+0C],ecx
mov al,01
jmp returnhere


Ultimately, there are many different ways you can do this.

EDIT: if the instruction is accessing more than just money and ammo, you may need to add more addresses to your structure list to find a proper compare (only assuming you haven't already done so).
Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Wed Nov 20, 2013 5:09 pm    Post subject: Reply with quote

Well this is for ACIV and this same code also accesses 5 other values - the ship resources. I already know how to make a simple option that makes everything that that code accesses to 999999, I was asking how to make separate options for these 2 values. I already know how to split them up, but they can't both be activated at once without one of them not working.
EDIT: Out of curiosity, I tried making it like this to see what would happen:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(test)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

cmp [eax+2C],0000001D
je test
cmp [eax+30],00000001
je test
jmp originalcode

originalcode:
mov [eax+0C],ecx
mov al,01
jmp returnhere

test:
mov ecx,#999999
mov [eax+0C],ecx
mov al,01
jmp returnhere



"AC4BFSP.exe"+C81D33:
jmp newmem
returnhere:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"AC4BFSP.exe"+C81D33:
mov [eax+0C],ecx
mov al,01
//Alt: db 89 48 0C B0 01

but if it's like this, none of the values change to 999999
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Nov 20, 2013 5:29 pm    Post subject: Reply with quote

I don't mean to offend you. Maybe I don't understand. You can have both cheats working, for cash and ammo using the example above:

Code:
newmem:
cmp [eax+2C],00000005
je cheat
cmp [eax+30],00000000
je cheat
jmp originalcode

cheat:
mov ecx,#999999
mov [eax+0C],ecx
mov al,01
jmp returnhere


If you're asking how to enable cash and ammo separately, but still be able to run them simultaneously, then you can do this:

Code:
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(filter1)
label(filter2)
label(cheat)
label(money_enable)
label(ammo_enable)
registersymbol(money_enable)
registersymbol(ammo_enable)

newmem:
cmp [eax+2C],00000005
je filter1
cmp [eax+30],00000000
je filter2
jmp originalcode

filter1:
cmp [money_enable],1
je cheat
jmp originalcode

filter2:
cmp [ammo_enable],1
je cheat
jmp originalcode

originalcode:
mov [eax+0C],ecx
mov al,01
jmp returnhere

cheat:
mov ecx,#999999
mov [eax+0C],ecx
mov al,01
jmp returnhere

money_enable:
dd 0
ammo_enable:
dd 0

"AC4BFSP.exe"+C81D33:
jmp newmem
returnhere:
 
[DISABLE]
dealloc(newmem)
"AC4BFSP.exe"+C81D33:
mov [eax+0C],ecx
mov al,01

unregistersymbol(money_enable)
unregistersymbol(ammo_enable)


By doing this, you will need to create entries in your cheat table for "money_enable" and "ammo_enable", and set a separate hotkeys for both, that will set the values to 1 and 0, for enable and disable, accordingly.

EDIT:
If none of the cheat values are changing, be sure to double check your compare values against a current data structure to ensure that your values haven't changed.
Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Wed Nov 20, 2013 5:41 pm    Post subject: Reply with quote

Can you give me an example cheat table of how this all looks when it's connected so I can "reverse engineer" it? Cause so far I'm getting a bit confused on the part where I have to create entries in my cheat table and I have a question for when this all comes into a trainer. For example if I have to create an entry for money_enable, does that mean that if I were to put that into a trainer, i'd also have to put the same hotkey for the option, which contains the code? This is something that I've always been wondering when it comes to trainer-making. When I'm generating a trainer, do I include both money_enable and the option with the script and assign them to the same hotkey? If so, what about ammo_enable? Obviously THAT's going to have a different hotkey, but part of the code for that is in the option which I would have already set in money_enable. How would this all work, unless ammo_enable and money_enable are the only ones with a hotkey and the actual option with the script is something that runs in the background while being always-active?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Nov 20, 2013 6:04 pm    Post subject: Reply with quote

FYI, you can also use the pointer scanner in lieu of writing a script.

The hotkey that you set for enabling the script, can be the same hotkey that you set for money or ammo. You can also use a different hotkey for enabling/disabling the script, and different hotkeys for money and ammo...or the same hotkeys, all around. It's really up to you. The hotkeys that you assign for money/ammo will not work until you enable the script...you can set whatever hotkey you want. You can set a hotkey for enable, disable and/or toggle script. It is your choice.

If you notice, I set a hotkey for the following items, but you do not have to do it this way:

F2 - Toggle Script
F3 - Enable Script
F4 - Disable Script

F5 - Set money_enable value to '1' (i.e. turn on)
F6 - Set money_enable value to '0' (i.e. turn off)

F7 - Set ammo_enable value to '1'
F8 - Set ammo_enable value to '0'

You can simplify this or customize it further. You can create a master hotkey that will enable all or disable all etc., or set individual and/or multiple hotkeys for everything. The hotkeys that you set will be the same hotkeys for your trainer. I should also note, that, you can edit the script to revert ammo/money values back to reasonable amounts when the cheat is disabled - should you choose to do so. In other words, you can pretty much do what you want.



AC4BFSP.CT
 Description:

Download
 Filename:  AC4BFSP.CT
 Filesize:  3.25 KB
 Downloaded:  663 Time(s)

Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Thu Nov 21, 2013 2:18 am    Post subject: Reply with quote

Okay, thx again, I'll try this out and see if it works.
EDIT: So you're saying I can put ALL the codes into ONE option and assign an "activate" and "deactivate" option in it and then just assign hotkeys for the other (OPTION)_enable options?
EDIT2: How do I create the entries? If I select CREATE HEADER, it lets me name it, but not change it's address, value type or value.
EDIT3: I'm not sure if this will work, but I tried making the entries by finding 2 random addresses and changing their address to (OPTION)_enable and their value type to BYTE and putting them inside the other option, so they're a little bit to the right, will it work like that?
EDIT4: Actually, when doing it like this, I had to manually change their value to 1 so the other option would work. How do I make it so that their value changes to 1 upon activating them and to 0 when deactivating them?
EDIT5: NVM, I guess it has to be like this, 2 different hotkeys to activate them and one universal to disable everything. Oh and when generating a generic lua trainer, how do I add more hotkeys to 1 option, cause it doesn't let me add more than 1
EDIT6: Now that I think of it, even pro trainer-makers don't make options which can be both activated and de-activated with the same hotkey. They have one universal hotkey, which disables everything, which brings me to my next question:
If I were to make a master option that makes way for all the other ones, do I have to put in the codes even for options that aren't split? And If I were to do that, would that mean that the master code would have to have TWO "originalcode" lines? Is that possible to make? For example I compare the split codes and send them to filter1 and filter2 and then at the end of them I set "jmp originalcode", Is it possible to directly send the health to filter3 without comparing it and then at the end of the lines for that code I make (for example) "jmp originalcode2"?
Or to make things more easier to answer: Can an option have TWO 'originalcode" and "originalcode2" lines and still work? And can this same method be used from my previous topic about injustice to make separate health and one hit kill options? And another thing: If I were to make an option with split code that I want to ONLY change a certain amount of values within the shared code, when comparing them, would I have to find an offset that's the same value for the options I want to change and different for the ones I don't want? Finding this would be difficult, so I find a static offset and change it's value to the one I want, would it STAY static to that value and when I make a trainer out of the table, would the trainer change the offset to the required value for people who are just using the trainer and haven't changed their offset manually?
EDIT7: With this method in mind, I tried making a similar code to test something out in the CE tutorial in step 9, but it doesn't seem to work. Can you see if anything's wrong? I tried making separate options for inf health and one hit kill that can run simultaneously. Oh and for future purposes, do you have a way I can contact you directly for any future questions? Oh and one more thing: If the jumps are all directing the code to the correct places, then does it matter WHERE I place MY code, as long as it's not beneath the DISABLED section?



CE tutorial test.CT
 Description:

Download
 Filename:  CE tutorial test.CT
 Filesize:  129.07 KB
 Downloaded:  694 Time(s)

Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Nov 21, 2013 12:53 pm    Post subject: Reply with quote

Hmm...a lot to respond to. Not sure I understand everything you're asking, but I'll give it a try.

Quote:
EDIT: So you're saying I can put ALL the codes into ONE option and assign an "activate" and "deactivate" option in it and then just assign hotkeys for the other (OPTION)_enable options?
-Yes. For that matter, you can have 5 different scripts that all do different things, and assign them all the same hotkey for enable/disable/toggle etc. You can also assign the same hotkeys for setting values for on/off for your option_enable cheats etc.

Quote:
EDIT2: How do I create the entries? If I select CREATE HEADER, it lets me name it, but not change it's address, value type or value.
-Click on 'Add Address Manually', just above your cheat table, on the right.

Quote:
EDIT3: I'm not sure if this will work, but I tried making the entries by finding 2 random addresses and changing their address to (OPTION)_enable and their value type to BYTE and putting them inside the other option, so they're a little bit to the right, will it work like that?
You can do that, yes, but you will still have to assign hotkeys so that you can set the values to 1 or 0, for on/off. If you look at the table that I uploaded, you can see that I have already set hotkeys for everything.

Quote:
EDIT4: Actually, when doing it like this, I had to manually change their value to 1 so the other option would work. How do I make it so that their value changes to 1 upon activating them and to 0 when deactivating them?
Simply set up the hotkeys as such. Right now, the hotkeys for enabling/disabling/toggling the script are different from the hotkeys for turning on your options/cheats. However, you can change them and set them to whatever you like. For example, you can use the same hotkey for enabling the script that you use for turning on your options/cheats, that way, everything gets activated with a single hotkey.

Quote:
EDIT5: NVM, I guess it has to be like this, 2 different hotkeys to activate them and one universal to disable everything.
This shouldn't be the case. What made you determine this?

EDIT:
You may have to hit the key twice (once for enabling the script and once for setting values to 1), but you can still use the same hotkey for enable all. This is why you typically see a master hotkey that is used to activate trainer...because it activates the scripts.

Quote:
Oh and when generating a generic lua trainer, how do I add more hotkeys to 1 option, cause it doesn't let me add more than 1
It does...right-click on the script or address etc., and select 'Set /Change hotkeys'. Here, you can set multiple hotkeys for the same thing, or for different things. The hotkeys should work with your trainer...just test it.

Quote:
EDIT6: Now that I think of it, even pro trainer-makers don't make options which can be both activated and de-activated with the same hotkey. They have one universal hotkey, which disables everything, which brings me to my next question:
If I were to make a master option that makes way for all the other ones, do I have to put in the codes even for options that aren't split?
-Not sure I understand what you are asking, however, you can have multiple cheats and multiple scripts that are enabled/disabled with the same hotkeys. You do not have to combine the cheats in to one script or anything like that.

Quote:
And If I were to do that, would that mean that the master code would have to have TWO "originalcode" lines? Is that possible to make? For example I compare the split codes and send them to filter1 and filter2 and then at the end of them I set "jmp originalcode", Is it possible to directly send the health to filter3 without comparing it and then at the end of the lines for that code I make (for example) "jmp originalcode2"?
Or to make things more easier to answer: Can an option have TWO 'originalcode" and "originalcode2" lines and still work? And can this same method be used from my previous topic about injustice to make separate health and one hit kill options?
-You can certainly combine scripts if you choose...but it's not necessary. For example, you can have newmem1, newmem2 and newmem3...as well as originalcode1, originalcode2 and originalcode3 etc. You can have multiple injection points being initialized by the same script etc.

Quote:
If I were to make an option with split code that I want to ONLY change a certain amount of values within the shared code, when comparing them, would I have to find an offset that's the same value for the options I want to change and different for the ones I don't want? Finding this would be difficult, so I find a static offset and change it's value to the one I want, would it STAY static to that value and when I make a trainer out of the table, would the trainer change the offset to the required value for people who are just using the trainer and haven't changed their offset manually?
-I do not understand what you are asking. The instructions or offsets shouldn't change unless someone is using your trainer on a different version...even then, only the location of the instruction typically changes. We can utilize AOB for this problem.

Quote:
EDIT7: With this method in mind, I tried making a similar code to test something out in the CE tutorial in step 9, but it doesn't seem to work. Can you see if anything's wrong? I tried making separate options for inf health and one hit kill that can run simultaneously.
-I had to change my injection point because you are using a different tutorial...however...you have everything correct with a few exceptions:

1. You need to change the health_enable and onehitkill_enable addresses: The 'type' should be 'byte'. Also, I typically show them as hexadecimal (right-click, show as hexadecimal).
2. Change your code:

Code:
cheat:
mov eax,(float)500.0
mov [ebx+04],eax
fldz
jmp returnhere


Since the value for health is stored as float type.
Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Thu Nov 21, 2013 1:02 pm    Post subject: Reply with quote

THX, although I already answered my own question on EDIT7, guess I probably should've said so. BTW, do you mind if I ask you for skype for example or something like that so I can ask you more directly if I have more questions? I really wouldn't mind if you said no. And what I meant about EDIT6, is if it's possible to make a script that only accesses CERTAIN values within a shared code, and then if it's possible to make another script, which changes everything that code accesses to 999999 EXCEPT the values from the shared code that the PREVIOUS script is accessing. Also, in the code structure dissection, is it possible to find an offset with STATIC values, WITHOUT playing the game to see if they change? What I mean is, can you make CE tell you which values in the offsets are static, so you won't get mad if you thought they were static but later they changed? Can it show that the same way it shows which addresses are static when searching?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Nov 21, 2013 1:12 pm    Post subject: Reply with quote

Okay...so you answered your own question, you do not need to tell me.

Any questions that you may have, you can ask here, so that everyone can benefit. If you have questions regarding topics that are prohibited for discussion per the forum rules, I am not interested.

Quote:
is if it's possible to make a script that only accesses CERTAIN values within a shared code, and then if it's possible to make another script, which changes everything that code accesses to 999999 EXCEPT the values from the shared code that the PREVIOUS script is accessing.
-Yes. This can be done with a single script. It can easily be done with multiple scripts as well...but only if you have an additional instruction for your injection point that access all of the same addresses that the first instruction accesses. Doing this with two or more scripts without having multiple instructions that access all addresses would be very time consuming and is not recommended. There is no reason you cannot do this with a single script, given the example that I have provided to you.

Quote:
Also, in the code structure dissection, is it possible to find an offset with STATIC values, WITHOUT playing the game to see if they change? What I mean is, can you make CE tell you which values in the offsets are static, so you won't get mad if you thought they were static but later they changed? Can it show that the same way it shows which addresses are static when searching?
-I do not believe so, however, Dark Byte can give you a definitive answer.

Regarding structure tables, there is a compare feature that allows you to easily compare structures to look for any changes. Simply lock the addresses in the first group and compare them to a second group that has the same address+offset. As you play the game, you can see which addresses changed and which ones did not.
Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Thu Nov 21, 2013 1:38 pm    Post subject: Reply with quote

yeah, but that can be a bit hard when you have FIVE groups, and not to mention the additional FIVE ship resources, which I haven't even gotten into right now
EDIT: I just had an idea. Can I create my own offset? And if I can, can I make it a static offset and when I make a trainer out of it, will it work for other people, since they don't have this offset?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Nov 21, 2013 1:55 pm    Post subject: Reply with quote

If you can not find a proper ID for your compares, or you do not want to, you might consider using the pointer scanner and forgetting about using a script.

That being said, I do not understand what it is that you are asking. What is it that you are trying to accomplish? Maybe if you explained to me what you are dealing with, and what you are wanting to do, I can better help you.
Back to top
View user's profile Send private message
kik4444
Expert Cheater
Reputation: 0

Joined: 07 Sep 2013
Posts: 120
Location: Bulgaria

PostPosted: Thu Nov 21, 2013 2:22 pm    Post subject: Reply with quote

For example, in assassin's creed 4, this code right here -
Code:
mov [eax+0C],ecx
mov al,01
Accesses 5 values for weapons for your character, 3-4 values for weapons for your ship and another 5 values for the ship's resources. Having over 10 groups and trying to find a single static offset that's different for all codes is pure hell. I guess this must be what a programmer feels like when he has to find 1 mistake in over 1000 lines of code Crying or Very sad
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Nov 21, 2013 2:43 pm    Post subject: Reply with quote

When you say static offset, you are referring to an offset that can be used for a compare/ID? If that is the case, and you are unable to filter out the addresses that you need by finding a proper ID for compare, then you can use pointers.

You can use the pointer scanner to add each address to your cheat table and/or incorporate them in to your script.

In a case like this, where finding a proper ID for compare is nearly impossible (or would take a great deal of time), I would simply opt for using the pointer scanner and adding the cheats to my cheat table, individually.

It's really easy since you already have the instruction that accesses all of the addresses that you need (i.e. you don't have to search for the values to find the addresses).
Back to top
View user's profile Send private message
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Thu Nov 21, 2013 3:00 pm    Post subject: Reply with quote

a little simplified version of ++METHOS's code, PLUS a slight modification to it:

Code:

[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(money_enable)
label(ammo_enable)
registersymbol(money_enable)
registersymbol(ammo_enable)
label(ammo_check)

newmem:
cmp [money_enable],1
jne ammo_check
cmp [eax+2C],00000005
jne ammo_check

mov ecx,#999999

ammo_check:
cmp [ammo_enable],1
jne originalcode
cmp [eax+30],00000000
jne originalcode

mov ecx,#999999

jmp originalcode


originalcode:
mov [eax+0C],ecx
mov al,01
jmp returnhere


money_enable:
dd 0
ammo_enable:
dd 0

"AC4BFSP.exe"+C81D33:
jmp newmem
returnhere:
 
[DISABLE]
dealloc(newmem)
"AC4BFSP.exe"+C81D33:
mov [eax+0C],ecx
mov al,01

unregistersymbol(money_enable)
unregistersymbol(ammo_enable)


not sure what you exactly want, but this one does the check for both values on every time executed, and since you are comparing IDs using two addresses, you need to check these:

cmp [eax+2C],00000005
so for ammo, what is value in EAX+2C ??

cmp [eax+30],00000000
and for the money what is value in EAX+30 ??
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 Gamehacking 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