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 


LUA Return Define string to AA ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Reaper79
Advanced Cheater
Reputation: 2

Joined: 21 Nov 2013
Posts: 68
Location: Germany

PostPosted: Mon Nov 23, 2020 4:00 pm    Post subject: LUA Return Define string to AA ? Reply with quote

Hiho,

Weired title i know...

Code:

{$lua}
local newmem = 'myNewMem'
local result = 0x12345

return ([[ define(%s, %s)]]):format(newmem, string.format('%X',result))


It seems the "consts / token" from define doesn't accept strings...

Anyway to get around this ?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Nov 23, 2020 4:15 pm    Post subject: Reply with quote

seems to work fine
Code:

alloc(bla,1024)

{$lua}
local newmem = 'myNewMem'
local result = 0x12345

return ([[ define(%s, %s)]]):format(newmem, string.format('%X',result))
{$asm}

bla:
mov eax,myNewMem

_________________
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
Reaper79
Advanced Cheater
Reputation: 2

Joined: 21 Nov 2013
Posts: 68
Location: Germany

PostPosted: Mon Nov 23, 2020 5:03 pm    Post subject: Reply with quote

I must have expressed myself wrong,

I want the same as if you were doing "Define(newmem, 0x12345)" in AA...

But via LUA script....

Code:

{$lua}
--psydo code
  -- local result = 0x1401234
  -- local memoryLabel = 'newmem'

  return ([[ define(%s, %s)]]):format(memoryLabel, string.format('%X',result))


The AA Define() uses tokens / Const?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Nov 23, 2020 5:23 pm    Post subject: Reply with quote

define(string,string)
_________________
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
Reaper79
Advanced Cheater
Reputation: 2

Joined: 21 Nov 2013
Posts: 68
Location: Germany

PostPosted: Tue Nov 24, 2020 3:45 pm    Post subject: Reply with quote

Hi,

i think i found the issue, issue ?

I called a function from the Cheat Table Lua Script from an AA script:

Cheat Table LUA Script:

Code:

function luaDefine(label, address)
  return ([[define(%s,%s)]]):format(label, string.format('%x',address))
end


AA Script:

Code:

[ENABLE]
   luacall(luaDefine('myLabel', 1401234)) //Doesn't work

  {$lua}
  luaDefine('myLabel', 1401234) -- WORKS

  {$asm}
  label(pPointer)
  registersymbol(pPointer)

  myLabel:
  pPointer:
    dq 0

[DISABLE]
  unregistersymbol(pPointer)


gaga me or don't know....

It seems luacall doesn't return the return ? Or is it out of scope ?

i did a workaround with registerAutoAssambleCommand in the lua script and it returns how it should ^^ Much cleaner ?

PS: Workaround

Code:

function luaDefine(parameters, syntaxcheck)

  // example 2
  https://wiki.cheatengine.org/index.php?title=Lua:registerAutoAssemblerCommand

end

registerAutoAssemblerCommand('luaDefine', luaDefine)
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 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