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 


I need help making a script for Final Fantasy X-2 steam
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Sun Dec 04, 2016 10:48 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
Error in line 6(luacall/writeBytes("INJECT+9", readBytes(" 097CCF18+9", 1) * 2))) :Undefined lua error.

So where'd readBytes(" 097CCF18+9", 1) come from?


097CCF18 is the address for HP. the first 4 bytes keep changing but CF18 always stay the same. +9 is the address for strength. And ", 1" is prob what you gotta put in for bytes?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Dec 05, 2016 12:13 am    Post subject: Reply with quote

aobscan can be made for game code (assembly code) - you use it in "code injection."
and can be made for game data (player structure, npc structure, etc.) - you use it more or less like default memory scan (first scan, exact, array of byte).


You keep trying to use AA template which are designed for code injection. Also you still don't get how {$Lua}{$Asm} section works. You probably do not know what preprocessing is.


If your Lua script doesn't return any string. It can be placed anywhere in the ENABLE section.

Code:
[ENABLE]
aobscan(INJECT,whatever here)
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
{$lua}
// your lua code here, without return
{$Asm}

jmp return


INJECT:
jmp code
nop
return:
registersymbol(INJECT)



is exactly the same as:
Code:
[ENABLE]
aobscan(INJECT,whatever here)
{$lua}
// your lua code here, without return
{$Asm}
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:

jmp return


INJECT:
jmp code
nop
return:
registersymbol(INJECT)

_________________
Back to top
View user's profile Send private message MSN Messenger
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Mon Dec 05, 2016 9:33 am    Post subject: Reply with quote

Ok. So, there has to be something wrong with this code otherwise it wouldn't be complaining. This is the code Zanzer gave me and I put it exactly to CE. This is what the code looks like:
_____________________________________________________________
[ENABLE]
aobscan(INJECT,E0 01 00 00 00 00 00 00 08 10 03 02)
registersymbol(INJECT)
luacall(writeInteger("INJECT", readInteger("INJECT") * 2))
luacall(writeInteger("INJECT+4", readInteger("INJECT+4") * 2))
luacall(writeBytes("INJECT+9", readBytes("INJECT+9", 1) * 2))
luacall(writeBytes("INJECT+B", readBytes("INJECT+B", 1) * 2))

[DISABLE]
INJECT:
db E0 01 00 00 00 00 00 00 08 10 03 02
unregistersymbol(INJECT)
_____________________________________________________________
It complains about the line:
luacall(writeBytes("INJECT+9", readBytes("INJECT+9", 1) * 2))

It says:
_____________________________________________________________
Error in line 6 luacall(writeBytes("INJECT+9", readBytes(" 099ECF18+9", 1) * 2))
_____________________________________________________________
And in Lua Engine check it says:
_____________________________________________________________
Error:Failure determining what INJECT+9 means
_____________________________________________________________
Guys, there has to be a solution to this problem. Anyone here know what's wrong?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Dec 05, 2016 10:18 am    Post subject: Reply with quote

Click 'Yes' to 'Are you sure you want to edit it to this?'
Now you can magically check the box anyway!
Back to top
View user's profile Send private message
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Mon Dec 05, 2016 10:20 am    Post subject: Reply with quote

Zanzer wrote:
Click 'Yes' to 'Are you sure you want to edit it to this?'
Now you can magically check the box anyway!


Huh?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Dec 05, 2016 10:31 am    Post subject: Reply with quote

I'm giving up.
Code:
{$lua}
if syntaxcheck then return end
[ENABLE]
local success = autoAssemble([[
aobscan(INJECT,E0 01 00 00 00 00 00 00 08 10 03 02)
registersymbol(INJECT)
]])
if success then
  writeInteger("INJECT", readInteger("INJECT") * 2)
  writeInteger("INJECT+4", readInteger("INJECT+4") * 2)
  writeBytes("INJECT+9", readBytes("INJECT+9", 1) * 2)
  writeBytes("INJECT+B", readBytes("INJECT+B", 1) * 2)
else
  showMessage("Unable to find the pattern.")
  assert(false)
end

[DISABLE]
{$asm}
INJECT:
  db E0 01 00 00 00 00 00 00 08 10 03 02
unregistersymbol(INJECT)
Back to top
View user's profile Send private message
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Mon Dec 05, 2016 11:06 am    Post subject: Reply with quote

I'm sorry for giving you headache. At least you tried to help. Well thanks anyway.
Back to top
View user's profile Send private message
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Tue Dec 06, 2016 3:29 am    Post subject: Reply with quote

By the way, I've gotten curious. Is it possible to assign pointers as write/read Integer/Bytes address value?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Dec 06, 2016 11:14 am    Post subject: Reply with quote

Let's say you have such multilevel pointer:

base address (usually static): Sam3.exe+00BFDC58
first offset: A8
second offset: 0
next offset: 20
next offset: 14
last offset: 440


Side note:
entries (memory records) added to the address list (bottom part of CE main window) can be:
- normal addresses (value types: byte, 2byte, 4byte, 8byte, float, etc)
- multilevel pointers (value types: byte, 2byte, 4byte, 8byte, float, etc)
of course level1 pointers included.

- Auto Assemble Scripts (NA, only AA script, it may contain embedded Lua script)
- groupheaders.

Back to topic. If you add a new address ("add address manually") you can tick "pointer" checkbox. You create it from bottom to the top. Base address is at the bottom, first offset is above base address, last offset is at the top.


In CE, there is also a special notation for pointers. It looks like this:
"[[[[[Sam3.exe+00BFDC58]+A8]+0]+20]+14]+440"

and above line is a string. All pointer offsets must be hexadecimal numbers.

Then you can use readInteger (and other similar functions) like this:
Code:
local value = readInteger("[[[[[Sam3.exe+00BFDC58]+A8]+0]+20]+14]+440")







Still I don't know why you don't want to use "find out what accesses ....." I mentioned earlier.

_________________
Back to top
View user's profile Send private message MSN Messenger
samuraiboss666
Newbie cheater
Reputation: 0

Joined: 03 Dec 2016
Posts: 19

PostPosted: Tue Dec 06, 2016 1:21 pm    Post subject: Reply with quote

I thought it wouldn't work since I gotta keep working on modding so many enemy files. However I started with it yesterday and I found Str and Mag values for the boss. Or so I thought. It's weird but it looks like the pointers i created for the boss now function on normal encounter enemies as well. And the values I thought were the right values before maybe aren't even though they have identical values in same order (12 identical bytes in same order).
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
Goto page Previous  1, 2
Page 2 of 2

 
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