|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 7:25 am Post subject: Input pointers' info in Assembly wtih conditional activation |
|
|
Hi all,
I'm currently writing an in-battle assembly script for FFXIII-2. The objective of the script is to activate appropriate en-'element' spell (enfire, enfrost, etc...) when the leader carry out the corresponding 'element'-strike action (such as flamestrike, froststrike, etc...).
I have found the 2 pointers for en-element spell activation and the next action respectively. Using hotkeys will also allow me to activate the spell successfully but I'd like to write a script to handle this modding.
I wrote an auto assembly script as below but it doesn't work since I'm totally new to this code writing. Would anyone help me identify the errors in my script?
Thank you very much in advance.
Code: |
[ENABLE]
alloc(newmem, 1024) //allocate memory for script writing
alloc(enfire, 1024)
alloc(enfrost, 1024)
alloc(enthunder, 1024)
alloc(enaero, 1024)
alloc(enfire1, 1024)
alloc(enfrost1, 1024)
alloc(enthunder1, 1024)
alloc(enaero1, 1024)
label(return)
return: //Set return point
newmem:
push ebx //set up pointer1
mov ebx,[ffxiii2img.exe+211E5F8]
mov ebx, [ebx+410]
mov ebx, [ebx+2aa]
pop ebx
push esp //set up pointer2
mov esp,[ffxiii2img.exe+211E5F8]
mov esp, [esp+410]
mov esp, [esp+14c]
pop esp
cmp dword [esp], 'at01' //Check if the 1st 4 characters of the string pointed by esp is "at01"
jne return
je enfire
enfire:
cmp dword [esp+4], '0_10' //Check if the last 4 characters of the string pointed by esp is "0_10"
jne enfrost
je enfire1
enfire1:
mov [ebx], 20 //Activate enfire for the character
jmp return
enfrost:
cmp dword [esp+4], '0_20'
jne enthunder
je enfrost1
enfrost1:
mov [ebx], 30
jmp return
enthunder:
cmp dword [esp+4], '0_30'
jne enaero
je enthunder1
enthunder1:
mov [ebx], 40
jmp return
enaero:
cmp dword [esp+4], '0_50'
jne return
je enaero1
enaero1:
mov [ebx], 60
jmp return
[DISABLE]
dealloc(newmem)
dealloc(enfire)
dealloc(enfrost)
dealloc(enthunder)
dealloc(enaero)
dealloc(enfire1)
dealloc(enfrost1)
dealloc(enthunder1)
dealloc(enaero1) |
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
Posted: Sat Nov 14, 2015 8:41 am Post subject: |
|
|
Is this working ? Hmmm
Code: |
[ENABLE]
globalalloc(en-element_spell,1024) //allocate memory for script writing
createthread(en-element_spell)
label(enfire)
label(enfrost)
label(enthunder)
label(enaero)
label(enfire1)
label(enfrost1)
label(enthunder1)
label(enaero1)
label(return)
label(_end)
registersymbol(_end)
return: //Set return point
pop esp
pop ebx
push #100
call sleep
cmp [_end],01
jne en-element_spell
ret
_end:
dd 0
en-element_spell:
push ebx //set up pointer1
mov ebx,[ffxiii2img.exe+211E5F8]
mov ebx,[ebx+410]
mov ebx,[ebx+2aa]
push esp //set up pointer2
mov esp,[ffxiii2img.exe+211E5F8]
mov esp,[esp+410]
mov esp,[esp+14c]
cmp [esp],31307461 //Check if the 1st 4 characters of the string pointed by esp is "at01"
jne return
je enfire
enfire:
cmp [esp+4],30315F30 //Check if the last 4 characters of the string pointed by esp is "0_10"
jne enfrost
je enfire1
enfire1:
mov [ebx],20 //Activate enfire for the character
jmp return
enfrost:
cmp [esp+4],30325F30 //'0_20'
jne enthunder
je enfrost1
enfrost1:
mov [ebx],30
jmp return
enthunder:
cmp [esp+4],30335F30 //'0_30'
jne enaero
je enthunder1
enthunder1:
mov [ebx],40
jmp return
enaero:
cmp [esp+4],30355F30 //'0_50'
jne return
je enaero1
enaero1:
mov [ebx],60
jmp return
[DISABLE]
_end:
dd 01
unregistersymbol(_end)
|
_________________
... |
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 9:59 am Post subject: |
|
|
Thank you for your quick reply Cake-san. I've just tried your codes in the game. It still doesn't work though.
To be honest, you don't fully understand the correction you made. I thought ebx and esp should be "pop" before comparison.
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 10:16 am Post subject: |
|
|
Hi Cake-san,
Is your script required to have a separate address to set 01 and 00 for the "_end" symbol?
I'm just not sure if I used your code correctly?
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
Posted: Sat Nov 14, 2015 10:21 am Post subject: |
|
|
ngoyui wrote: | Hi Cake-san,
Is your script required to have a separate address to set 01 and 00 for the "_end" symbol?
I'm just not sure if I used your code correctly? |
what separate address? if you meant by separate script then ,no.It doesn't required seperated scipt for "_end" symbol because it's used to disable the script then, emptied the stack.
Sorry, I'm not good at explaining thing -_-
_________________
... |
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 10:28 am Post subject: |
|
|
@Cake-san
I've just checked the values for comparison in your script. They are all correct.
Regarding my testing, after I paused the game when the party went to battle. I tried to activate the script but I just couldn't. Beside, I was also not able to activate the script in non-battle mode.
I'm not sure where the error is.
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
Posted: Sat Nov 14, 2015 10:36 am Post subject: |
|
|
can you give the pointer for the value that you want to change for ?
Just copy the pointer inside your table and paste it into the comment using code display.
Edited
Wait, why do you need to compare if you have the pointer ? Is that an instruction address ?
If it's an instruction address, you have to use code injection instead of createthread.
_________________
... |
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 10:48 am Post subject: |
|
|
Here is the pointer for the en-element spell:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>72628</ID>
<Description>"En-spell"</Description>
<LastState Value="60" Activated="0" RealAddress="130D322A"/>
<ShowAsHex>1</ShowAsHex>
<Color>0000FF</Color>
<VariableType>Byte</VariableType>
<Address>ffxiii2img.exe+211E5F8</Address>
<Offsets>
<Offset>2AA</Offset>
<Offset>410</Offset>
</Offsets>
</CheatEntry>
</CheatEntries>
</CheatTable>
And here is the pointer for the next action of the character:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>72629</ID>
<Description>"Next command"</Description>
<LastState Activated="0" RealAddress="130D30CC"/>
<ShowAsHex>1</ShowAsHex>
<Color>0000FF</Color>
<VariableType>String</VariableType>
<Length>10</Length>
<Unicode>0</Unicode>
<ZeroTerminate>1</ZeroTerminate>
<Address>ffxiii2img.exe+211E5F8</Address>
<Offsets>
<Offset>14C</Offset>
<Offset>410</Offset>
</Offsets>
</CheatEntry>
</CheatEntries>
</CheatTable>
I hope you can figure out something.
EDIT: Basically, I'm totally a newbie. This is my first time try to use something other than simply searching the required addresses.
Do code injection have something to set the condition on when to change the value?
EDIT:
I believe they are just normal addresses not the instruction ones.
The set-up of the game is that when a character has an en-element spell activated, their corresponding element-strike will have different animation and power. The problem is that while the character can have different element-strikes in one turn, she can only have one en-element spell activated during one turn. Hence, normally I have to use hotkeys to activate different en-element spells during a 6-strike attack animation which is quite annoying. That's why I think of using a script to do this.
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
Posted: Sat Nov 14, 2015 11:32 am Post subject: |
|
|
can you check if this script works of not ?
Code: |
[ENABLE]
globalalloc(_en-element_spell,80) //allocate memory for script writing
createthread(_en-element_spell)
label(_enfire)
label(_enfrost)
label(_enthunder)
label(_enaero)
label(_end)
registersymbol(_end)
_en-element_spell:
push ebx
push eax
mov ebx,[ffxiii2img.exe+211E5F8]
mov ebx,[ebx+410]
mov eax,[ebx+14c] // now,eax contain the addres of next command
mov ebx,[ebx+2aa] // now,ebx contain the addres of En-spell
cmp [eax],31307461
jne return
cmp [eax+4],30315F30
je _enfire
cmp [eax+4],30325F30
je _enfrost
cmp [eax+4],30335F30
je _enthunder
cmp [eax+4],30355F30
je _enaero
jmp return
_enfire:
mov [ebx],20
jmp return
_enfrost:
mov [ebx],30
jmp return
_enthunder:
mov [ebx],40
jmp return
_enaero:
mov [ebx],60
return: //Set return point
pop eax
pop ebx
push #100
call sleep
cmp [_end],01
jne _en-element_spell
ret
_end:
dd 0
[DISABLE]
_end:
dd 01
unregistersymbol(_end)
|
I think I have fix it
_________________
... |
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 1:51 pm Post subject: |
|
|
Sorry for the late reply. I thought the page can auto-refresh. So, I thought you haven't replied.
I made a test again. It still doesn't work but I think you came very close. Apart from the label for "return", I found some errors in the code indicating the 2 pointers.
mov eax,[ebx+14c] // now,eax contain the addres of next command
mov ebx,[ebx+2aa] // now,ebx contain the addres of En-spell
I think these 2 lines will copy the value (not the address) into eax and ebx respectively. I tried to rewrite the code as below but when I activated it the game crash (It didn't crash when I used yours). I have a feeling that you probably can fix it this time . Thank you very much for your help. I didn't know that people in the forum was that helpful.
[code]
[ENABLE]
globalalloc(_en-element_spell,80) //allocate memory for script writing
createthread(_en-element_spell)
label(_enfire)
label(_enfrost)
label(_enthunder)
label(_enaero)
label(_end)
label(return)
registersymbol(_end)
_en-element_spell:
push ebx
push eax
mov ebx,[ffxiii2img.exe+211E5F8]
mov ebx,[ebx+410]
mov eax,[ebx+410]
add ebx,2aa // now,ebx contain the addres of En-spell
add eax,14c // now,eax contain the addres of next command
cmp [eax],31307461
jne return
cmp [eax+4],30315F30
je _enfire
cmp [eax+4],30325F30
je _enfrost
cmp [eax+4],30335F30
je _enthunder
cmp [eax+4],30355F30
je _enaero
jmp return
_enfire:
mov [ebx],20
jmp return
_enfrost:
mov [ebx],30
jmp return
_enthunder:
mov [ebx],40
jmp return
_enaero:
mov [ebx],60
return: //Set return point
pop eax
pop ebx
push #100
call sleep
cmp [_end],01
jne _en-element_spell
ret
_end:
dd 0
[DISABLE]
_end:
dd 01
unregistersymbol(_end)
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 2:17 pm Post subject: |
|
|
@Cake-san
I modify your codes again. This time it works. Although the execution time is a little bit lagging as compared to the action performed by the character. I'm thinking of breaking this down to 4 separate scripts to see whether the execution time can be improved.
Here is the final script:
Code: |
[ENABLE]
globalalloc(_en-element_spell,80) //allocate memory for script writing
createthread(_en-element_spell)
label(_enfire)
label(_enfrost)
label(_enthunder)
label(_enaero)
label(_end)
label(return)
registersymbol(_end)
_en-element_spell:
push ebx
mov ebx,[ffxiii2img.exe+211E5F8]
mov ebx,[ebx+410]
//mov eax,[ebx+14c] // now,eax contain the addres of next command
//mov ebx,[ebx+2aa] // now,ebx contain the addres of En-spell
cmp [ebx+14c],31307461
jne return
cmp [ebx+150],30315F30
je _enfire
cmp [ebx+150],30325F30
je _enfrost
cmp [ebx+150],30335F30
je _enthunder
cmp [ebx+150],30355F30
je _enaero
jmp return
_enfire:
mov [ebx+2aa],20
jmp return
_enfrost:
mov [ebx+2aa],30
jmp return
_enthunder:
mov [ebx+2aa],40
jmp return
_enaero:
mov [ebx+2aa],60
return: //Set return point
pop ebx
push #100
call sleep
cmp [_end],01
jne _en-element_spell
ret
_end:
dd 0
[DISABLE]
_end:
dd 01
unregistersymbol(_end) |
EDIT:
Sorry, I didn't see your post for the solution. Let me try one more time to see how things go.
|
|
Back to top |
|
|
Cake-san Grandmaster Cheater Reputation: 8
Joined: 18 Dec 2014 Posts: 541 Location: Semenanjung
|
Posted: Sat Nov 14, 2015 2:23 pm Post subject: |
|
|
the one that make its lag is this:
you should increase the value to reduce lag.
it's like a timer before executing the script again.
_________________
...
Last edited by Cake-san on Sat Nov 14, 2015 2:28 pm; edited 1 time in total |
|
Back to top |
|
|
ngoyui Newbie cheater Reputation: 0
Joined: 14 Nov 2015 Posts: 12
|
Posted: Sat Nov 14, 2015 2:28 pm Post subject: |
|
|
Is it required an increase or decrease?
I don't have experience on this. Can you recommend some commonly-used and acceptable numbers?
|
|
Back to top |
|
|
|
|
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
|
|