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 to change values without hotkeys
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Wed Jan 17, 2018 10:47 pm    Post subject: script to change values without hotkeys Reply with quote

the opcode that writes the value is 02000000 - 89 41 30 - mov [ecx+30],eax
Back to top
View user's profile Send private message Send e-mail
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Thu Jan 18, 2018 4:07 am    Post subject: Reply with quote

if you meant like you wanna write 02000000 decimal to the memory-location of [ecx+30]
then you can do it this way:

mov [ecx+30],#2000000

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu Jan 18, 2018 9:20 am    Post subject: Reply with quote

if 02000000 is an address then the basic idea would be to write a code injection at 02000000, but since a jmp typically needs 5 bytes and that mov is only 3 you'd need to overwrite another instruction as well.

Alternatively you could use lua to set a breakpoint, step (so that the mov is executed) and then write to ECX+0x30 yourself, but if it's something that runs a lot then that's going to cause issues because the context switching involved with breaking, running lua, continuing, (repeat) is quite slow. But if it's just once every few seconds then it should work ok.
something like
Code:
if not debug_isDebugging() then debugProcess() end
debug_setBreakpoint(0x02000000, function()
  debug_continueFromBreakpoint(co_step) -- execute mov
  writeInteger(ECX+0x30, 9999) -- write 9999 to ecx+30
  debug_continueFromBreakpoint(co_run) -- continue running
end)


edit: I think you could also just change the value of EAX and then continue....might be the better method
Back to top
View user's profile Send private message
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 4:17 pm    Post subject: Reply with quote

the code worked it changed to one color permanently. How do I make into a script that changes into 5 colors without me doing anything. I tried to freeER's code and got an error in saying it can't be compiled. what should I paste in the auto assemble script?

Last edited by bronywarlord on Thu Jan 18, 2018 4:49 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 4:44 pm    Post subject: Reply with quote

What FreeER gave you is Lua, this is the Cheat Engine Lua Scripting section, but I am pretty sure that Cheat engine only says that for Auto Assembler scripts that fail syntax check. And what OldCheatEngineUser gave you was ASM for an Auto Assembler script. So is this a Lua script or an AA script.
_________________
Back to top
View user's profile Send private message Visit poster's website
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 5:03 pm    Post subject: Reply with quote

i meant for auto assembler script. I want a script that changes to 5 different values for this address without me pressing anything. was about to post in auto assemble script section but its locked.
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 5:19 pm    Post subject: Reply with quote

So to use what FreeER gave you you would need to tell the Auto Assembler that the code is Lua, this is doen with "{$lua}".

Code:
//// ASM code
{$lua}
-- Lua code
{$asm}
//// Back to ASM


Code:
[Enable]
{$lua}
if not debug_isDebugging() then debugProcess() end
debug_setBreakpoint(0x02000000, function()
  debug_continueFromBreakpoint(co_step) -- execute mov
  writeInteger(ECX+0x30, 9999) -- write 9999 to ecx+30
  debug_continueFromBreakpoint(co_run) -- continue running
end)
-- ...
[Disable]


But I think he may have meant for this to go into the cheat table Lua form.

And to do it in AA you would need to write an injection script or create a thread with a loop. And you would still need to enable the script.

_________________
Back to top
View user's profile Send private message Visit poster's website
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 5:46 pm    Post subject: Reply with quote

this is my code auto assembler code. where should I paste this Tim?

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat

alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

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

originalcode:
mov [ecx+30],eax
lea ebx,[ebx+000000AC]

exit:
jmp returnhere

02000000:
jmp newmem
nop
nop
nop
nop
returnhere:



[DISABLE]
//code from here till the end of the code will be used to disable the cheat
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 6:40 pm    Post subject: Reply with quote

That is an Auto Assembler script, from the Memory View form, "Alt+A" or tools -> Auto Assembler. Then File -> add script to table. And that will give you a script memory record that you can save to the table.

You may also want to look at the Auto Assembler Templates menu item. And look into AOB scripts. Just select the instruction in the Memory View form where you want to inject before generating a template.

EDIT:
And just add some thing like what I have here under the "newmem:" line and before "origialcode:"

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat

alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

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

mov eax,(int)200 // or what ever decimal (base 10) value you want

originalcode:
mov [ecx+30],eax
lea ebx,[ebx+000000AC]

exit:
jmp returnhere

02000000:
jmp newmem
nop
nop
nop
nop
returnhere:



[DISABLE]
//code from here till the end of the code will be used to disable the cheat
02000000:
mov [ecx+30],eax
lea ebx,[ebx+000000AC]
// This will disable the cheat when disabling the script, a lest if the value is corrected some where by the game

_________________
Back to top
View user's profile Send private message Visit poster's website
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 8:51 pm    Post subject: Reply with quote

I pasted the code now where do i paste the break point code in the post you did two posts up? is there a script that allows you you to press hot keys for you? and where would i put it in the code?
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 10:01 pm    Post subject: Reply with quote

The code that FreeER posted can go in the table Lua script, main form -> Table -> Show table Lua script. But that is just writing to the value using breakpoints and the AA script dose it with an injection, so you should only need one.

bronywarlord wrote:
is there a script that allows you you to press hot keys for you?


Not sure what you mean. But there is this in the "celua.txt" file in the cheat engine folder.

Quote:
doKeyPress(key) : simulates a key press

_________________
Back to top
View user's profile Send private message Visit poster's website
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 10:33 pm    Post subject: Reply with quote

where do i put the values i want the script to use? right now its locked on one value. its on value 000000C8.
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 11:11 pm    Post subject: Reply with quote

Code:
mov eax,(int)200 // or what ever decimal (base 10) value you want


200 in decimal (base 10), is C8 in hexadecimal (base 16)

If you want to set it in hex just remove the "(int)" part.

At this point I am going to suggest that you try the Cheat Engine tutorial in the Help menu section, I think you may have better luck next time if you do.

_________________
Back to top
View user's profile Send private message Visit poster's website
bronywarlord
Newbie cheater
Reputation: 0

Joined: 14 Feb 2016
Posts: 20

PostPosted: Thu Jan 18, 2018 11:16 pm    Post subject: Reply with quote

if want it to change from one color to another do i use commas or a code?
Back to top
View user's profile Send private message Send e-mail
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Jan 18, 2018 11:23 pm    Post subject: Reply with quote

bronywarlord wrote:
if want it to change from one color to another do i use commas or a code?


Do what now?

_________________
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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