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 


Quick script for mono statics

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
jgoemat
Master Cheater
Reputation: 23

Joined: 25 Sep 2011
Posts: 266

PostPosted: Wed Jul 22, 2026 1:51 am    Post subject: Quick script for mono statics Reply with quote

Just wrote an autoassembler lua script to find and create children for static fields on a class. This is for 'Keep on Mining' and has some values affecting the pick.

Code:

[enable]
{$lua}
if syntaxcheck then return end

local namespaceName = ""
local className = "TheAnvil"
local fields = {
  equippedMineTime = vtSingle,
  equippedMinePower = vtSingle,
  equipped2XChance = vtSingle,
  equippedMiningArea = vtSingle,
  collTime = vtSingle
}

LaunchMonoDataCollector()

local addressList = getAddressList()

-- remove existing children
while memrec.Count > 0 do
  memrec[0].destroy()
end

function addMemoryRecord(address, name, recordType)
  local entry = addressList.createMemoryRecord()
  entry.Description = name
  entry.Type = recordType
  entry.Address = address
  entry.Parent = memrec
end

local class = mono_findClass(namespaceName, className)
local baseAddress = mono_class_getStaticFieldAddress(mono_enumDomains()[1], class)
for i,f in ipairs(mono_class_enumFields(class)) do
  if f.isStatic and fields[f.name] ~= nil then
    addMemoryRecord(baseAddress + f.offset, f.name, fields[f.name])
  end
end
{$asm}

[disable]

{$lua}
if syntaxcheck then return end

-- destroy children
while memrec.Count > 0 do
  memrec[0].destroy()
end
{$asm}
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

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

PostPosted: Wed Jul 22, 2026 6:07 am    Post subject: Reply with quote

also in 7.7 you can give a memory record the address
Code:

classname.staticfieldname

and it'll automatically be at the correct address once it becomes available

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3411

PostPosted: Fri Jul 24, 2026 8:27 am    Post subject: Reply with quote

Cheers DB, I was not aware, quite useful!
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