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 


Suddenly getting error on a script that I didn't even change

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Autem
Expert Cheater
Reputation: 1

Joined: 30 Jan 2023
Posts: 149

PostPosted: Wed Apr 05, 2023 2:33 am    Post subject: Suddenly getting error on a script that I didn't even change Reply with quote

Is there something different about how the newest version of CE deals with hotkeys in scripts? I opened up a script to copy something out of it but didn't actually change anything in it, and when I clicked "ok" to close it I suddenly got an error stating..

"attempt to index a nil value (global'hkey')"

But like I said I didn't actually make any edits, and that script has worked fine for months with no errors. The only difference is that I updated to the latest CE in the last day or so. Could the update be causing this, and how can I fix it?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Wed Apr 05, 2023 2:57 am    Post subject: Reply with quote

there is a change to the layout of the hotkey form but besides that not so much that should cause issues. (assuming the script doesn't use hardcoded offsets...)

but without the script I can't say

_________________
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
Autem
Expert Cheater
Reputation: 1

Joined: 30 Jan 2023
Posts: 149

PostPosted: Wed Apr 05, 2023 3:03 am    Post subject: Reply with quote

It's starting to look like maybe Windows Defender is interfering with certain things CE is trying to do. Maybe me updating CE caused Defender to wrongfully block some aspect of CE? I'm also getting "access violation" popups now when I try to close/save some of my scripts.

How can I check further into that to confirm and fix it if so?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Wed Apr 05, 2023 3:19 am    Post subject: Reply with quote

Sounds more like invalid pointer operations

Does the script assemble code inside CE or does the script use usersataToInteger and then reads/modified local memory?

_________________
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
Autem
Expert Cheater
Reputation: 1

Joined: 30 Jan 2023
Posts: 149

PostPosted: Wed Apr 05, 2023 3:31 am    Post subject: Reply with quote

Basically it takes a value I entered into "hp" in the addresslist and then converts whatever number I input to 0.

Worked perfectly for months. I made zero edits to it. Errors only began once I updated CE in the last couple days. The random "violation errors" never happened before either.

Interesting to note, I also have an older version of CE still on my computer because it works with an addon that newer ones don't, so I gave that older version a try and it's also having the exact same error now! This makes me think something in my system is sabotaging some part of CE that the below script requires?

Feel free to check out the script that's having the sudden issue but I have a bad feeling something else went wrong because I didn't make any changes to it.

Code:
[ENABLE]
alloc(hp,17)
registersymbol(hp)

{$lua}
if syntaxcheck then return end

function ChangeValue1(v, v2)
print('Starting...')
pause()
local MemScan = createMemScan()
MemScan.firstScan(soExactValue, vtDword, nil, v, nil, '0', '7fffffffffff', '+W*C*X', nil, '0', false, true, false, false)
MemScan.waitTillDone()
local Results = createFoundList(MemScan)
Results.initialize()
for i=0,Results.Count-1 do
   writePointer(Results[i],v2)
end
MemScan.destroy()
Results.destroy()
unpause()
print('done')
sleep(2500)
GetLuaEngine().close()
---below disables script itself after 2500
if syntaxcheck then return end

local t=createTimer()
t.Interval=2500
t.OnTimer=function()
  memrec.Active=false
  t.destroy()
end
---above disables scripts itself after 2500
end

function ChangeValues2(sender)
ChangeValue1(readInteger('hp'), 0) --convert hp value into 0
end
hkey=createHotkey("ChangeValues2",VK_K,VK_L)



[DISABLE]
{$lua}
hkey.destroy()
{$asm}
dealloc(*)
unregistersymbol(*)


Edit: Experimenting with it, I just figure out if I have the script enabled while I open it and close it... it works again. This is new behavior though so I'm not sure what to make of it. I know for sure I worked on it before without having it enabled, and never got this error. *shrug*
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Wed Apr 05, 2023 4:39 am    Post subject: Reply with quote

hmm, that script should cause errors in the game, not CE

but i would put a
Code:
 
if syntaxcheck then return end

inside the disable lua block

_________________
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
Autem
Expert Cheater
Reputation: 1

Joined: 30 Jan 2023
Posts: 149

PostPosted: Wed Apr 05, 2023 5:52 am    Post subject: Reply with quote

Dark Byte wrote:
hmm, that script should cause errors in the game, not CE


What part would cause errors? So far it always did exactly as expected but if there's room to improve it I'd be interested in anything that stood out to you and what might be better.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Wed Apr 05, 2023 8:00 am    Post subject: Reply with quote

You're doing a 4 byte value scan for a value stored in the HP variable and change it to 0

Depending on the value, this will end up changing a lot more than just HP
The lower the value of HP, the bigger the chance there's an unrelated value somewhere.

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