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 


MemoryRecord.Active doesn't read or write

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
SpiderCreator
How do I cheat?
Reputation: 0

Joined: 28 Sep 2017
Posts: 2

PostPosted: Thu Sep 28, 2017 1:16 am    Post subject: MemoryRecord.Active doesn't read or write Reply with quote

I have a cheat table with a Lua script that's supposed to activate a memory record shortly after attaching to a process. My Lua script is as follows:

Code:
aalist=getAutoAttachList()
stringlist_add(aalist,"MyProcess.exe")

function onOpenProcess(processid)
  sleep(6000)
  local theMemoryRecord = getAddressList().getMemoryRecordByID(0)
  print(theMemoryRecord.Description)
  print(theMemoryRecord.Active)
  print(theMemoryRecord.Type)
  theMemoryRecord.Active = True
end


What I am given in response is the following:

Code:
My Memory Record Description

11


As you can see, print(theMemoryRecord.Active) prints nothing. Setting theMemoryRecord.Active to True does not check the box on the memory record.

I don't know what I'm doing wrong and I've checked every piece of documentation I could find. I also tried memoryrecord_freeze and memoryrecord_setActive to no avail. I could really use some help. Thanks.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 342

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

PostPosted: Thu Sep 28, 2017 2:32 am    Post subject: Reply with quote

don't sleep in onOpenProcess as the symbolhandler and related things have not been executed at that time.

use a timer instead

And you're sure the ID of your memory record is 0 ? (don't mistake ID for index)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
SpiderCreator
How do I cheat?
Reputation: 0

Joined: 28 Sep 2017
Posts: 2

PostPosted: Thu Sep 28, 2017 2:51 am    Post subject: Reply with quote

Dark Byte wrote:
don't sleep in onOpenProcess as the symbolhandler and related things have not been executed at that time.

use a timer instead
OK. I'll try that and get back to you.

Dark Byte wrote:
And you're sure the ID of your memory record is 0 ? (don't mistake ID for index)
Yes, I'm positive it's 0. Otherwise, onOpenProcess would not be able to correctly print the description and type of the memory record.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

Joined: 07 Nov 2008
Posts: 4188
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Sep 28, 2017 8:13 am    Post subject: Reply with quote

Boolean values can not be printed with just print function. You have to use tostring first, it will covert Boolean to text.
Code:
print(true)
print(false)
print(tostring(true))
print(tostring(false))


also, Lua is case sensitive. true is a Boolean, True is a variable.



fixed script
Code:
aalist=getAutoAttachList()
aalist.add("MyProcess.exe")

function onOpenProcess(processid)
  local t=createTimer(nil,true)
  t.Interval = 6000
  t.OnTimer = function()
    t.destroy()
    local theMemoryRecord = getAddressList().getMemoryRecordByID(0)
    print(theMemoryRecord.Description)
    print(tostring(theMemoryRecord.Active))
    print(theMemoryRecord.Type)
    theMemoryRecord.Active = true
  end
end

_________________
Back to top
View user's profile Send private message MSN Messenger
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