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 


incorrect operation of the script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Starter_But
Advanced Cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 53

PostPosted: Sat Jul 01, 2023 2:06 pm    Post subject: incorrect operation of the script Reply with quote

Hello, I want to make the value from Edit.Text fall into the assembler code
Code:

function CETrainer_rPlayerMobsAgroClick(sender)
 if CETrainer.rPlayerMobsAgro.Checked then
    CETrainer.AgroEf.Visible = true
    end
 local number = tonumber(CETrainer.AgroEf.Text)
 local assemblyCode = string.format("mov eax, %d", number)
 local Ascript = [[
define(address, Terraria.Player::ResetEffects+293)
define(bytes, 89 96 2C 03 00 00)

[ENABLE]

assert(address, bytes)

alloc(newmem, 1)

label(code)
label(return)
label(playerAggro)

registersymbol(playerAggro)

newmem:
code:
  %s
  mov [esi+32C], eax
  jmp return

playerAggro:
    dd (int)0

address:
  jmp newmem
  nop
return:

[DISABLE]

address:
  db bytes
  //mov [esi+328],edx

unregisterSymbol(*)
dealloc(*)
 ]]
           if CETrainer.rPlayerInstResp.Checked then
            local r
            discript12345=nil --not local for a reason

            r,discript12345=autoAssemble(Ascript)
            if not r then
               CETrainer.rPlayerInstResp.Checked=false
            end
            else
            if discript12345 then
               autoAssemble(Ascript,discript12345)
               discript12345=nil
            end
         end
end

But, as always, I couldn't do anything, what was I wrong about?
assembly code
Code:

define(address, Terraria.Player::ResetEffects+293)
define(bytes, 89 96 2C 03 00 00)

[ENABLE]

assert(address, bytes)

alloc(newmem, 1)

label(code)
label(return)
label(playerAggro)

registersymbol(playerAggro)

newmem:
code:
  fild dword ptr [playerAggro]
  fistp dword ptr [esi+32C]
  jmp return

  playerAggro:
    dd (int)0

address:
  jmp newmem
  nop
return:

[DISABLE]

address:
  db bytes
  //mov [esi+328],edx

unregistersymbol(*)
dealloc(*)
Back to top
View user's profile Send private message
YoucefHam
Cheater
Reputation: 5

Joined: 19 Mar 2015
Posts: 39
Location: Algeria

PostPosted: Sat Jul 01, 2023 4:02 pm    Post subject: Re: incorrect operation of the script Reply with quote

Starter_But wrote:
Hello, I want to make the value from Edit.Text fall into the assembler code
...............


use ]]..var..[[ to put it in script

Code:
function CETrainer_rPlayerMobsAgroClick(sender)
 if CETrainer.rPlayerMobsAgro.Checked then
    CETrainer.AgroEf.Visible = true
    end
 local number = tonumber(CETrainer.AgroEf.Text)
 local assemblyCode = string.format("mov eax, %d", number)
 local Ascript = [[
define(address, Terraria.Player::ResetEffects+293)
define(bytes, 89 96 2C 03 00 00)

[ENABLE]

assert(address, bytes)

alloc(newmem, 1)

label(code)
label(return)
label(playerAggro)

registersymbol(playerAggro)

newmem:
code:
  ]]..assemblyCode..[[
  mov [esi+32C], eax
  jmp return

playerAggro:
    dd (int)0

address:
  jmp newmem
  nop
return:

[DISABLE]

address:
  db bytes
  //mov [esi+328],edx

unregisterSymbol(*)
dealloc(*)
 ]]
           if CETrainer.rPlayerInstResp.Checked then
            local r
            discript12345=nil --not local for a reason

            r,discript12345=autoAssemble(Ascript)
            if not r then
               CETrainer.rPlayerInstResp.Checked=false
            end
            else
            if discript12345 then
               autoAssemble(Ascript,discript12345)
               discript12345=nil
            end
         end
end
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 467

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

PostPosted: Sat Jul 01, 2023 11:45 pm    Post subject: Reply with quote

You never put assemblyCode in the script. You use %s but never use string.format with the Ascript text

Code:

Ascript=string.format(Ascript, assemblyCode)

_________________
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
Starter_But
Advanced Cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 53

PostPosted: Sun Jul 02, 2023 9:27 am    Post subject: Reply with quote

nothing works(
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