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 


Is this a possibility?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Fri Apr 08, 2016 2:47 pm    Post subject: Is this a possibility? Reply with quote

ok so I want to make a lua script where you type in a number into the edit box press the button and that number would be set in the script.

Code:

newmem:
 cmp [ecx+14],00
 je change_level
 cmp [ecx+14],01
 je change_level
 cmp [ecx+14],02
 je change_level
 cmp [ecx+14],03
 je change_level
 cmp [ecx+14],04
 je change_level
 cmp [ecx+14],05
 je change_level

change_level:
  mov [ecx+14],05
  mov [ecx+18],05
  mov [ecx+1C],05
  mov [ecx+20],05
  movdqu xmm0,[ecx+14]
  movdqu xmm0,[ecx+18]
  movdqu xmm0,[ecx+1C]
  movdqu xmm0,[ecx+20]
  jmp return


Ok so the above is the script and would something like this work

Code:

function CEButton1Click(sender)

autoassemble([[

newmem:
 cmp [ecx+14],00
 je change_level
 cmp [ecx+14],01
 je change_level
 cmp [ecx+14],02
 je change_level
 cmp [ecx+14],03
 je change_level
 cmp [ecx+14],04
 je change_level
 cmp [ecx+14],05
 je change_level

change_level:
  mov [ecx+14],setProperty(CETrainer.CEEdit1,"Text")
  mov [ecx+18],setProperty(CETrainer.CEEdit1,"Text")
  mov [ecx+1C],setProperty(CETrainer.CEEdit1,"Text")
  mov [ecx+20],setProperty(CETrainer.CEEdit1,"Text")
  movdqu xmm0,[ecx+14]
  movdqu xmm0,[ecx+18]
  movdqu xmm0,[ecx+1C]
  movdqu xmm0,[ecx+20]
  jmp return
   
  ]])


sorry I am not to pro with writing lua scripts but you might understand what I am trying to do... ... ... ... maybe
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Apr 08, 2016 4:30 pm    Post subject: Reply with quote

Code:
function CEButton1Click(sender)
   local value = (tonumber(CETrainer.CEEdit1.Text) and math.floor(tonumber(CETrainer.CEEdit1.Text)) or error("Error! please input a number")); -- error will stop the script execution
   autoassemble(string.format([[
   newmem:
      cmp [ecx+14],00
      je change_level
      cmp [ecx+14],01
      je change_level
      cmp [ecx+14],02
      je change_level
      cmp [ecx+14],03
      je change_level
      cmp [ecx+14],04
      je change_level
      cmp [ecx+14],05
      je change_level

   change_level:
      mov [ecx+14],%d
      mov [ecx+18],%d
      mov [ecx+1C],%d
      mov [ecx+20],%d
      movdqu xmm0,[ecx+14]
      movdqu xmm0,[ecx+18]
      movdqu xmm0,[ecx+1C]
      movdqu xmm0,[ecx+20]
      jmp return]],value,value,value,value))
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Smellyhobo101
Newbie cheater
Reputation: 0

Joined: 21 Sep 2014
Posts: 23

PostPosted: Mon Apr 11, 2016 1:46 am    Post subject: Reply with quote

I think you could simplify this:

Code:
   
newmem:
 cmp [ecx+14],00
 je change_level
 cmp [ecx+14],01
 je change_level
 cmp [ecx+14],02
 je change_level
 cmp [ecx+14],03
 je change_level
 cmp [ecx+14],04
 je change_level
 cmp [ecx+14],05
 je change_level


to this:

Code:
   
newmem:
 cmp [ecx+14],06
 jb change_level



Instead of checking if it is 1, 2, 3, 4 or 5, it just checks if it is below 6.[/code]
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Apr 11, 2016 1:57 am    Post subject: Reply with quote

Or this...

Code:
cmp [ecx+14],0
jge @f
jmp originalcode
@@:
cmp [ecx+14],6
jle change_level
jmp originalcode


Code:
cmp [ecx+14],0
jl originalcode
cmp [ecx+14],6
jg originalcode
jmp change_level


Code:
cmp [ecx+14],0
jb originalcode
cmp [ecx+14],6
ja originalcode
jmp change_level


etc..
Back to top
View user's profile Send private message
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