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 


How to write a game cheat in lua?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Tue Mar 06, 2012 3:50 am    Post subject: How to write a game cheat in lua? Reply with quote

Suppose this is my script. What should I do with it.

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)

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

originalcode:
fstp dword ptr [edi+000002CC]

exit:
jmp returnhere

"crimsonland.exe"+1779E:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"crimsonland.exe"+1779E:
fstp dword ptr [edi+000002CC]
//Alt: db D9 9F CC 02 00 00


I pasted this in my lua table but it did nothing.
Code:
myscript= [[//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)

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

originalcode:
fstp dword ptr [edi+000002CC]

exit:
jmp returnhere

"crimsonland.exe"+1779E:
jmp newmem
nop
returnhere:]]
autoAssemble(myscript)

But it does nothing. What should I do?
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Tue Mar 06, 2012 5:17 am    Post subject: Reply with quote

Have you executed that lua script?
Was a process opened with ce when you executed that script ?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Tue Mar 06, 2012 10:52 pm    Post subject: Reply with quote

How to disable my script?
And how do I disable my script after 10 seconds?


Code:
myscript = [[alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)

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

originalcode:
fstp dword ptr [edi+000002CC]
mov dword ptr [edi+000002CC],200

exit:
jmp returnhere

"crimsonland.exe"+1779E:
jmp newmem
nop
returnhere:

]]

offscript = [[dealloc(newmem)
"crimsonland.exe"+1779E:
fstp dword ptr [edi+000002CC]
//
]]

timer = createTimer(nil,true)
timer_setInterval(timer,20000)
i=1
function onhere()
autoAssemble(myscript)
if i==1 then
timer_onTimer(timer, offok)
i=2
end
end

offok=function offhere()
autoAssemble(offscript)
end

onhere()
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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