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 


Trainer Access Violation

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

Joined: 13 May 2009
Posts: 7

PostPosted: Sat Sep 15, 2012 6:18 pm    Post subject: Trainer Access Violation Reply with quote

I'm working on a trainer (first one), and for some reason, when i'm using a button to call a hotkey (eg memrec5_hotkey0 ...but no keypress assigned), its giving me "Error:Access violation".
However, if i assign an actual key to it, and press that key, the modifications occur correctly.

What are the places i need to look in order to try and troubleshoot this? (I'm assuming it has to do with the button not properly calling the hotkey)
My current example is as such (button name is 'Freeze'):
Code:
function FreezeClick(sender)
memoryrecordhotkey_doHotkey(memrec0_hotkey0)
end


If my understanding is correct, that should initiate the first hotkey in my list, as though a button were pressed... but, its giving access violation.
If i assign a key to the hotkey, the button performs correctly.


Yeah, i'm new to this, so bear with me Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Sep 15, 2012 8:16 pm    Post subject: Reply with quote

At the time when FreezeClick is executed, has memrec0_hotkey0 been defined ? (it's not automatically defined, you need to initialize it yourself)
_________________
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
empirebattles
How do I cheat?
Reputation: 0

Joined: 13 May 2009
Posts: 7

PostPosted: Sun Sep 16, 2012 4:10 am    Post subject: Reply with quote

Yeah... i had thought that too, but somethin seemed to be off...
at the top of the lua scripit for the trainer, i have added:
Code:
addresslist=getAddressList()
memrec0=addresslist_getMemoryRecordByID(addresslist,0)

memrec0_hotkey0=memoryrecord_getHotkeyByID(memrec0,0)


However, now, when i launch the trainer, it gives the "Error:Access violation
", error, and the process never visually launches (no window open), but the process is still displayed in Task Manager.
[/code]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Sep 16, 2012 4:31 am    Post subject: Reply with quote

Are you sure the id's are 0 ?
The id is a value that increases with each new entry and does not decrease when you delete an entry

Same for the hotkey id.
Easiest method to find out the id's is by copy/pasting the entry and check the <id></id> parts for the entry and hotkey.

Alternatively
use addresslist_getMemoryRecord(al,index) where index does count from 0+
or
addresslist_getMemoryRecordByDescription(al, description)

_________________
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
empirebattles
How do I cheat?
Reputation: 0

Joined: 13 May 2009
Posts: 7

PostPosted: Sun Sep 16, 2012 4:36 am    Post subject: Reply with quote

Yeah, when i'm lookin at the hotkey, in the bottom right corner, it shows 'ID=0' or 'ID=1'.
I'll go ahead and try the addresslist_getMemoryRecordByDescription(al, description)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Sep 16, 2012 4:37 am    Post subject: Reply with quote

Also, test by running the script in the lua engine window
_________________
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
empirebattles
How do I cheat?
Reputation: 0

Joined: 13 May 2009
Posts: 7

PostPosted: Sun Sep 16, 2012 5:12 am    Post subject: Reply with quote

Alright, by process of elimination. i've found that by attempting to define memrec0_hotkey0, by one of the following methods, its giving me access errors.:
Code:
memrec0_hotkey0=memoryrecord_getHotkeyByID(memrec0,0)

or
("00"is the description for the hotkey)
Code:
memrec0_hotkey0=addresslist_getMemoryRecordByDescription(memrec0,"00")



So, in last attempt, i finally got the Memory record this way:
Code:
addresslist_getMemoryRecord(addresslist,index)


An whala... it worked

so i was prolly looking at the index instead of the ID

Thanks for your help Very Happy !
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