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 


script for comparing and locking values etc

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
fishcorpse
How do I cheat?
Reputation: 0

Joined: 06 May 2015
Posts: 4

PostPosted: Sun May 31, 2015 4:43 am    Post subject: script for comparing and locking values etc Reply with quote

There is a game that i have to keep pressing(holding down) "x" key until i reach the target value. Think as it, a target score or a target location.
So i want to do it without physically holding that key. I have found all required pointers/addresses, but dont know to put them in a use.


pointer_my_score : address that keeps my score. (assume pointer is something like this= "Game.exe"+00022A08 offset1:a4 offset2: b8 )
[pointer_my_score] : value of my score
pointer_target_score : address that keeps target score
[pointer_target_score] :value of target score
[Game.dll+9A5EA4] : status of x key. 1 = key down



this is my pseudo code:
Code:
compare [pointer_my_score] , [pointer_target_score]   //i found the pointers, but i dont know how to do it.
jg  dontpress_anymore      //if i reach my target, dont press anymore
change value of  Game.exe+9A5EA4  to  1      //it equals to pressing "x" key

dontpress_anymore:



In other words, i need a script that should lock this value [Game.exe+9A5EA4] to "1" until i reach to the target score.
Back to top
View user's profile Send private message
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Sun May 31, 2015 9:04 am    Post subject: Reply with quote

find some instruction that constantly accesses "Game.exe+9A5EA4", use that as your injection point, then just add a "mov [Game.exe+9A5EA4],1"
Back to top
View user's profile Send private message
fishcorpse
How do I cheat?
Reputation: 0

Joined: 06 May 2015
Posts: 4

PostPosted: Sun May 31, 2015 2:02 pm    Post subject: Reply with quote

vng21092 wrote:
find some instruction that constantly accesses "Game.exe+9A5EA4", use that as your injection point, then just add a "mov [Game.exe+9A5EA4],1"

>mov [Game.exe+9A5EA4],1
yes i can do that, but i need more functional and clear code. if i do that in your way i have to change some other things as well to avoid game crash/bug, i tried. This is the case for the game i am currently working on.

Anyways, I dont want to do it by doing code injecting. Because i want to use same script template for other games easily, and actually, all i need is just to make "advanced hotkeys"


for example:
Code:
//set value to 1 for 30 seconds
when i press hotkey1; (toogle hack=1)
mov [Game.exe+9A5EA4],1
sleep 30 seconds
mov [Game.exe+9A5EA4],0

when i press hotkey1, if hack is running; (toogle hack=0)
mov [Game.exe+9A5EA4],0
stop hack




Code:
when i press hotkey2;  (if i press the hotkey again, it must stop)
controlpoint:
cmp [pointer_my_coordinate_x] ,  [pointer_target_coordinate_x] //compare my coordinate with target and keep pressing the key until i reach
jg dontpress_anymore
mov [Game.exe+9A5EA4],1
dontpress_anymore:

sleep 100 miliseconds 
jmp controlpoint  //go compare my coordinate and target again. wait 100 ms in each control.


Surely i can set hotkeys in CE without scripting, but in my cases, there are some conditions that depends on other values in game. I can't set a hotkey in CE's hotkey menu, that freezes/locks a value for 30 seconds. Or i cant make a hotkey that works if some another value is diffrerent than 1.


There will be dozens of scripts like this. Can it be done with autoassembly or i need lua scripting?
Back to top
View user's profile Send private message
WhiteSnoop
How do I cheat?
Reputation: 1

Joined: 15 May 2009
Posts: 7
Location: http://alino.ucoz.com

PostPosted: Sun Jul 19, 2015 8:45 am    Post subject: Reply with quote

What I would do is setting up 3 injecting points.

Something like:
Code:

GlobalAlloc(maxtarget,4)
GlobalAlloc(myscore,4)

Game.DLL+targetinstuction:
Jmp getmaxtarget
exitMaxtarget:

Game.DLL+scoreinstuction:
Jmp getscore
exitGetscore:

Game.DLL+keydowninstuction:
Jmp keydown
exitKeydown:

getmaxtarget:
mov [maxtarget],eax. //whatever the original register was
//original stuff from this instruction
jmp exitMaxtarget

getscore:
mov [myscore],eax //eax is an example of course
//original instruction
jmp exitGetscore

keydown:
push eax
mov eax,[myscore]  // copy myscore into eax
cmp eax,[maxtarget] // compare maxtarget with myscore
pop eax
je exitKeydown // if the score equals max then exit
mov [Game.exe+9a5ea4],1
jmp exitKeydown



Ofcourse the script misses allot. But i am typing this on my phone so give me a break haha[/code]
Back to top
View user's profile Send private message MSN Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 19, 2015 11:31 am    Post subject: Reply with quote

Code:
[ENABLE]
{$lua}
timer=createTimer(nil)
timer.Interval = 30000
timer.OnTimer = function(timer)
  writeInteger("Game.exe+9A5EA4", 0)
end
timer.Enabled = true
writeInteger("Game.exe+9A5EA4", 1)
{$asm}
[DISABLE]
{$lua}
timer.Enabled = false
timer.Destroy()
timer = nil
writeInteger("Game.exe+9A5EA4", 0)
{$asm}
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
Page 1 of 1

 
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