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 


Failure determining what .... means?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Wed Feb 24, 2016 2:21 am    Post subject: Failure determining what .... means? Reply with quote

The following code keeps giving me this error: Failure determining what power means. I have marked the line of code which causes the problem, however, I do not know how to fix it. Sad

Code:

number = 0
power = 0

t =
  {
  {
  '1',
  [[
  alloc(newmem,4096)
  label(returnhere)
  label(originalcode)
  label(exit)
  label(addStats1)
  label(addStats2)
  label(checkPower)



  newmem:
  cmp byte ptr [ebx+19],$number
  jne addStats1
  jmp checkPower

  checkPower:
  cmp byte ptr [ebx+1A],$power
  jne addStats2
  jmp exit

  addStats1:
  movzx eax,byte ptr [number]
  mov byte ptr [ebx+19],al
  jmp exit

  addStats2:
  movzx eax,byte ptr [power]
  mov byte ptr [ebx+1A],al
  jmp exit

  originalcode:
  movzx eax,byte ptr [ebx+19]
  cmp eax,ecx

  exit:
  jmp returnhere

  "game.exe"+5AA3A:
  jmp newmem
  nop
  returnhere:
  ]],
  [[

  dealloc(newmem)
  "game.exe"+5AA3A:
  movzx eax,byte ptr [ebx+19]
  cmp eax,ecx
  ]]
  }
  }

checkText = {0}

function CEButton3Click(sender)
  if checkText[1] == 0 then
    checkText[1] = 1
    number = 80
    power = 50
    writeBytes("number",number)
    writeBytes("power",power)     <----This line is causing the problem
    autoAssemble(t[1][2])
    showMessage("Test message")
  else
    checkText[1] = 0
    autoAssemble(t[1][3])
  end
 end


Thanks a lot.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Feb 24, 2016 2:52 am    Post subject: Reply with quote

most likely because "power" is not registered inside the target process. You may have to allocate and register that first


(also, disable sections can't be done with the autoAssemble function)

_________________
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
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Feb 24, 2016 3:15 am    Post subject: Reply with quote

The $number and number has different meaning
Code:

  cmp byte ptr [ebx+19],$number // A
...
  addStats1:
  movzx eax,byte ptr [number]    // B


$number in (A) is to refer a lua variable 'number' ONLY during executing the AA script, it will replace TEXTUALLY $number with the hexadecimal value of lua variable 'number'. Then after the AA script executed successfully, the AA script is convert to native code in the target process. There is no more connection between the lua variable and the generated native code.

'number' in (B) should be an address symbol, that's why Zanzer in your other post make some change to your script to establish the address symbol. Probably naming the symbol as 'pNumber' would make it clear the symbol is not related to a lua variable 'number'.
But by the address symbol, you can manipulate the content value of that address via lua way
Code:
writeInteger('pNumber',number)

or AA script way
Code:
[ENABLE]
pNumber:
dd 1
[DISABLE]
pNumber:
dd 0

_________________
- Retarded.
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Wed Feb 24, 2016 11:04 am    Post subject: Reply with quote

panraven wrote:
The $number and number has different meaning
Code:

  cmp byte ptr [ebx+19],$number // A
...
  addStats1:
  movzx eax,byte ptr [number]    // B


$number in (A) is to refer a lua variable 'number' ONLY during executing the AA script, it will replace TEXTUALLY $number with the hexadecimal value of lua variable 'number'. Then after the AA script executed successfully, the AA script is convert to native code in the target process. There is no more connection between the lua variable and the generated native code.

'number' in (B) should be an address symbol, that's why Zanzer in your other post make some change to your script to establish the address symbol. Probably naming the symbol as 'pNumber' would make it clear the symbol is not related to a lua variable 'number'.
But by the address symbol, you can manipulate the content value of that address via lua way
Code:
writeInteger('pNumber',number)

or AA script way
Code:
[ENABLE]
pNumber:
dd 1
[DISABLE]
pNumber:
dd 0


I have tried what you said, but it still does not work. So frustrated.. Sad
Do I need to alloc and register pNumber? Shoud it be "db" or "dd"?
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