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 


problem with lua script

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

Joined: 12 Nov 2022
Posts: 6

PostPosted: Wed Jan 18, 2023 3:51 pm    Post subject: problem with lua script Reply with quote

hello so i have a little problem with this script. im also reposting it because i was in the wrong forum section.

Code:

[ENABLE]
   {$lua}
            if syntaxcheck then return end
            if process and readInteger(process) ~= 0 then mono_initialize()
                 LaunchMonoDataCollector() end
                 local extraDebug = false
local GCD =
                mono_class_findInstancesOfClassListOnly(mono_enumDomains()
                [1],mono_findClass('','GameContentData'))[1]
                local cGDCData = 0

function getContents(p,l)
                       for z = 0,l*4-4,4 do
        local cData = readInteger(readInteger(p) + 0x10 + z)
        local cKey = readString(readInteger(cData + 0x8) + 0x0C,1000,true)
        if z == l*4-4 then
DumpFile:write('     ' .. cKey,"\n\n")
       else
            DumpFile:write('     ' .. cKey,"\n")
end
       --print(readString(readInteger(cData + 0x8) + 0x0C,500,true))
end end

local offsetTable =
    mono_class_enumFields(mono_findClass('','GameContentData'))
    DumpFile = io.open(getCheatEngineDir() .. 'BootyCallsDump.txt', "w+")
           for i = 1,#offsetTable do
       if (offsetTable[i].isStatic) == false then
  if string.match((offsetTable[i].name), "DataDict") then break end
       --print(offsetTable[i].name)
                  local gp = GCD + offsetTable[i].offset
                local p = readPointer(gp) + 0x08
             local l = readInteger(p + 0x04)
            if l ~= 0 then
local cGDCData = i
       if cGDCData == i then DumpFile:write(string.format('[' ..
          offsetTable[i].name .. ']\n')) end
        getContents(p,l)
        end end end
DumpFile:close()
          shellExecute(getCheatEngineDir():gsub("%\\", "\\\\") .. 'BootyCallsDump.txt')
[DISABLE]


i also got this error and i just can't saw what is wrong.
<<lua error in the script at line 2:[string "local syntaxcheck,memrec=... ..."]:11:
:attempt to perform arithmectic on nil value

is it maybe something with this:

{$lua}?

hope someone can help me.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Wed Jan 18, 2023 4:28 pm    Post subject: Reply with quote

The errors occurs in line 11, so there is already some lua code run, the error is not cause near {$lua}.

The error cause by a nil value. Try place some debug print here and there to see which variable cause the error.
eg.1.
Code:

local GCD = ...
print('GCD',tostring(GCD))

eg.2.
Code:

-- original
local cData = readInteger(readInteger(p) + 0x10 + z)
-- debug check
local p_int = readInteger(p)
print('p_int, z',tostring(p_int), tostring(z)) -- check if readInteger(p) and z valid
local cData = readInteger(p_int) + 0x10 + z)
print('cData',tostring(cData))
...



btw,

mono_initialize is run once function and it is already run from autorun from CE launch, it doesn't matter if your target process use monoscript or not.

readInteger return nil if no process or unreadable memory at the address, so the check '~=0' doesn't check if a process is attached.

To test present of an attached mono process, may use this,
Code:

  if readInteger'mono_free'  then --   mono_free is an exported function from mono*.dll
  ...

which will work as intent under these conditions:
1. no game/process attached -> the 'then' code will not run;
2. mono byte-code/JIT game -> run ;
3. mono il2cpp game -> run ;
4. other loaded game -> not run ;

_________________
- Retarded.
Back to top
View user's profile Send private message
bananapowers
How do I cheat?
Reputation: 0

Joined: 12 Nov 2022
Posts: 6

PostPosted: Wed Jan 18, 2023 8:07 pm    Post subject: Reply with quote

Quote:
The error cause by a nil value. Try place some debug print here and there to see which variable cause the error.
eg.1.


no.

Quote:
btw,

mono_initialize is run once function and it is already run from autorun from CE launch, it doesn't matter if your target process use monoscript or not.

readInteger return nil if no process or unreadable memory at the address, so the check '~=0' doesn't check if a process is attached.

To test present of an attached mono process, may use this,


no+idc+ratio.

Quote:
- Retarded.


don't worry buddy i gave up ab this script. but the fact that u took time to respond make you even more retarded.

retard. Very Happy
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Thu Jan 19, 2023 12:31 am    Post subject: Reply with quote

bananapowers wrote:
Quote:
- Retarded.


don't worry buddy i gave up ab this script. but the fact that u took time to respond make you even more retarded.

retard. Very Happy

That's the signature of the post. It gets added to every post made. panraven wasn't insulting you.

Why would you even think that? That post consisted of good help. There was no reason to insult you.

If you've given up, simply don't bother responding. Email updates can be disabled via a link at the bottom of the thread.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
bananapowers
How do I cheat?
Reputation: 0

Joined: 12 Nov 2022
Posts: 6

PostPosted: Thu Jan 19, 2023 7:22 am    Post subject: Reply with quote

Quote:

That's the signature of the post. It gets added to every post made. panraven wasn't insulting you.

Why would you even think that? That post consisted of good help. There was no reason to insult you


Dam now i really feel like a retarded. I dont know guess posting on forums and getting insulted for posting something about cheat engine
Because i dont understand a single thing about it made me insecure im sorry im really am.

Guess im the retarded after all.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Thu Jan 19, 2023 9:12 am    Post subject: Reply with quote

bananapowers wrote:
Quote:

That's the signature of the post. It gets added to every post made. panraven wasn't insulting you.

Why would you even think that? That post consisted of good help. There was no reason to insult you


Dam now i really feel like a retarded. I dont know guess posting on forums and getting insulted for posting something about cheat engine
Because i dont understand a single thing about it made me insecure im sorry im really am.

Guess im the retarded after all.



This apology is a virtue.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Thu Jan 19, 2023 6:36 pm    Post subject: Reply with quote

My sign is kind of parody another forum member.

I don't understand bananapowers's second message and not known the sign may has some interesting side effect until ParkourPenguin tell the possibility. Thanks ParkourPenguin.

No worry bananapowers, it is alright.

_________________
- Retarded.
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