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 


Need help enabling script from child boxes

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

Joined: 30 Oct 2014
Posts: 9

PostPosted: Thu Nov 06, 2014 10:02 pm    Post subject: Need help enabling script from child boxes Reply with quote

So I'm on mobile right now and can't post my exact code but I saw a table that had all the aobscans and code instructions on a master enable toggle. It then jumped to the original code if a variable he made was set to 0. That much I understand. I tried to replicate it in a script I wrote for a different game but I'm having trouble. My ammo and mana scripts are working as advertised but if I try to cmp checkifenabled, 01 then I get errors saying that the variable does not have an address specified. So I allocated some memory at the beginning made sure everything was labeled and registered correctly and set all my enable flags to 0 by defining their respective variables as dd 0. I went to my code and made sure that the jumps to the modified aobs only occurred when the flags were on. The problem is when I try to create a child script under it that defines the enable variables dd 1 they aren't recognized as a location and I get an address not specified error. I'll post the script when I get home But for right now, is there any way to create a toggle box belonging to a master script in the cheat list? I created a header but couldn't figure out how to write a script to it without specifying an address. Unless, can I specify it to newmem then write the script to allocate newmem in that cheat? Wouldn't clicking the enable toggle allocate the target memory for the master enable to go to?

All I want is a master enable holding the actual cheats coding/scans and child toggles underneath to activate them. If this has been posted before, I apologize I used the search tool but couldn't find anything specific. Also if this is like super obvious to do then again sorry but I just started learning monday

Edit:Ok so my code works if I don't allocate memory or set up anything but the scan and the edit. But when I add in the memory and the flags a lot of the new variables are getting address specifier not valid errors and the script won't enable. So here is what I have so far

Quote:
[ENABLE]


aobscanmodule(ammo_aob,Shock2.exe,89 11 8B 14 24) // should be unique
alloc(master, $1000)
label(master)
label(ammo_enable_flag)
label(ammo_code1)
label(ammo_return)

registersymbol(master)
registersymbol(ammo_enable_flag)

master:
// Cheat Enable Flags

Ammo_enable_flag:
dd 00

// Actual Cheat Instructions
ammo_aob:
ammo_code1:
cmp [ammo_enable_flag], 01
jne ammo_return
db 90 90

//Returns

ammo_return:


[DISABLE]

ammo_code:
db 89 11 8B 14 24

unregistersymbol(master)
unregistersymbol(ammo_code)
dealloc(master)

{
// ORIGINAL CODE - INJECTION POINT: "Shock2.exe"+1B2F93

"Shock2.exe"+1B2F7B: 52 - push edx
"Shock2.exe"+1B2F7C: 56 - push esi
"Shock2.exe"+1B2F7D: 50 - push eax
"Shock2.exe"+1B2F7E: 8B 41 50 - mov eax,[ecx+50]
"Shock2.exe"+1B2F81: FF D0 - call eax
"Shock2.exe"+1B2F83: 85 C0 - test eax,eax
"Shock2.exe"+1B2F85: 74 1B - je Shock2.exe+1B2FA2
"Shock2.exe"+1B2F87: 8B 0C 24 - mov ecx,[esp]
"Shock2.exe"+1B2F8A: 8B 54 24 08 - mov edx,[esp+08]
"Shock2.exe"+1B2F8E: A1 88 FD 7F 01 - mov eax,[Shock2.exe+51FD88]
// ---------- INJECTING HERE ----------
"Shock2.exe"+1B2F93: 89 11 - mov [ecx],edx
"Shock2.exe"+1B2F95: 8B 14 24 - mov edx,[esp]
// ---------- DONE INJECTING ----------
"Shock2.exe"+1B2F98: 8B 08 - mov ecx,[eax]
"Shock2.exe"+1B2F9A: 52 - push edx
"Shock2.exe"+1B2F9B: 56 - push esi
"Shock2.exe"+1B2F9C: 50 - push eax
"Shock2.exe"+1B2F9D: 8B 41 48 - mov eax,[ecx+48]
"Shock2.exe"+1B2FA0: FF D0 - call eax
"Shock2.exe"+1B2FA2: 59 - pop ecx
"Shock2.exe"+1B2FA3: C3 - ret
"Shock2.exe"+1B2FA4: CC - int 3
"Shock2.exe"+1B2FA5: CC - int 3


I figured I'd start with something older so I went with System Shock 2. I got the AOB by scanning for my ammo, finding what writes to it, changing the code to nop to verify, then used CE's AOB injection for the sig. I'm trying to make a script toggle below it that says

Quote:
[ENABLE]
ammo_enable_flag:
dd 01
[DISABLE]
ammo_enable_flag:
dd 00


but CE won't add it to the list because ammo_enable_flag has an invalid address specifier. Since I can't toggle the allocated memory, I can't browse to it in memory viewer to set the script to. All of this is exactly like how the cheat table had its scripts set up. Sorry about the wall of text but I'd really like to figure the why of this out. I can post the original table I'm trying to emulate if need be.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Nov 07, 2014 5:36 pm    Post subject: Reply with quote

Activate your first script
After that you can add the second one

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

Joined: 30 Oct 2014
Posts: 9

PostPosted: Sat Nov 08, 2014 5:05 am    Post subject: Reply with quote

Unfortunately that seems to be my problem. I cleaned up a lot of the typos and now it can be assigned to the cheat table but it won't execute and I don't know if there is some sort of fault checker to help figure out why it won't enable. I understand that I need the memory allocated first but I can't do that if the script is bad. Anyhow here's what I have so far

Quote:
[ENABLE]
aobscanmodule(ammo_aob,Shock2.exe,89 11 8B 14 24) // should be unique
globalalloc(master, $1000)
label(master)
label(ammo_enable_flag)
label(ammo_code1)
label(ammo_return)
registersymbol(master)
registersymbol(ammo_code1)
registersymbol(ammo_enable_flag)

master:
// Cheat Enable Flags

ammo_enable_flag:
db 00

// Actual Cheat Instructions
ammo_aob:
ammo_code1:
cmp [ammo_enable_flag], 01
jne ammo_return
db 90 90

//Returns

ammo_return:


[DISABLE]

ammo_code1:
db 89 11 8B 14 24

unregistersymbol(master)
unregistersymbol(ammo_enable_flag)
unregistersymbol(ammo_code1)
dealloc(master)


I changed alloc to global so if I want to add in more codes or something I can just have them all assigned to the same area. Of course I'm probably using the function wrong but neither alloc or globalalloc will allow the scrip to run. Is there a way to find out what CE is doing when I try to tick the box? Maybe that would help find which line/lines are bad. Thanks a lot for the help by the way.

Edit: Just realized this topic is about AA scripting not LUA and there is a difference between the two....sorry if this is the wrong section but I'm new
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