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 


AOB Scan Script help!

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

Joined: 10 Feb 2011
Posts: 43

PostPosted: Tue Mar 26, 2013 6:31 am    Post subject: AOB Scan Script help! Reply with quote

Hello here a scrip from a friend

-- Search via AOB
sl = AOBScan("D9 40 04 D8 45 08");

if(sl == nil) then
print("No code found!");
else
j = stringlist_getCount(sl);
print("Found:",j);
for i = 1, j do
print(stringlist_getString(sl,i-1));
end
object_destroy(sl);
end
-- end of the script

How i can write a script that scan more as 1 code ( like Health,ammo )

sl = AOBScan("D9 40 04 D8 45 08"); Ammo
sl = AOBScan("0F B7 81 10 0F 00 00"); Health
Back to top
View user's profile Send private message
Rectangle
Advanced Cheater
Reputation: 1

Joined: 23 Feb 2013
Posts: 73

PostPosted: Tue Mar 26, 2013 9:25 am    Post subject: Reply with quote

What do they need to be in the same script for?
Why not just make separate scripts?

#EDIT: Oh wait, you're not using an auto-assemble script. In that case, you've already answered your own question:
Code:
ammoScan = AOBScan("D9 40 04 D8 45 08"); --Ammo
hpScan = AOBScan("0F B7 81 10 0F 00 00"); --Health
Back to top
View user's profile Send private message
Mobie
Cheater
Reputation: 0

Joined: 10 Feb 2011
Posts: 43

PostPosted: Tue Mar 26, 2013 4:49 pm    Post subject: Reply with quote

thanks for reply

here my script

-- Search via AOB
scanammo = AOBScan("66 29 54 41 0A"); --ammo
scanhealth = AOBScan("0F B7 81 10 0F 00 00 0F B7 8E 22 02 00 00"); --health

if(sl == nil) then
print("No code found!");
else
j = stringlist_getCount(sl);
print("Found:",j);
for i = 1, j do
print(stringlist_getString(sl,i-1));
end
object_destroy(sl);
end
-- end of the script

when i go to execute than comes this error in ouput

Error:Access violation
Script Error
Question
Back to top
View user's profile Send private message
Rectangle
Advanced Cheater
Reputation: 1

Joined: 23 Feb 2013
Posts: 73

PostPosted: Tue Mar 26, 2013 5:55 pm    Post subject: Reply with quote

You need to use the variables you created.
AOBScan returns a list of address strings. In your script above, you are creating two variables, each holding a list of address strings, and then you are trying to use another variable (sl) to get the number of results in a string list... but since you changed the variable name to scanammo and scanhealth, sl either contains nothing ("nil") or something else entirely instead of a string list.

Change your code to use the variables you created.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Mar 26, 2013 5:55 pm    Post subject: Reply with quote

sl is not defined.
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Rectangle
Advanced Cheater
Reputation: 1

Joined: 23 Feb 2013
Posts: 73

PostPosted: Tue Mar 26, 2013 10:29 pm    Post subject: Reply with quote

Mother of hack wrote:
sl is not defined.

I thought of stating it like that, except I wasn't sure if the code posted above was the entirety of the script, or simply an excerpt where sl may be defined elsewhere.
And judging by the user's question and response, he doesn't seem to understand the logic of the script... so I figured it would be better to help him understand not just what was wrong, but also why, so that he can write his own scripts instead of potentially asking for more code which he doesn't understand, leading him once again back to the forum.
Sort of a "teach a man to fish" versus "give a man a fish" scenario.
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