View previous topic :: View next topic |
Author |
Message |
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Fri Sep 16, 2016 11:23 am Post subject: writing a conditional/ if statement in asm? |
|
|
Hey guys, so basically I'm asking this generally, because once I understand how it's written I can expand on it on my own. I'll write it out in laymans terms, I've tried dissecting some other scripts I've seen things like this done in, but it's usually done in huge scripts with allocations and all sorts of other things so I get a bit lost in which information is related to which.
so here's what I'd like to do, how might you script this?
thanks very much!
if
00BF3CC0 = 0
then
004C9FB7:
db 0f 83
otherwise
004C9FB7:
db 0f 86
|
|
Back to top |
|
|
STN I post too much Reputation: 42
Joined: 09 Nov 2005 Posts: 2672
|
Posted: Fri Sep 16, 2016 11:34 am Post subject: |
|
|
cmp [00BF3CC0], 0
jne @F
mov word ptr [004C9FB7], 830f // Little Indians
jmp originalcode // jmp away anywhere to not execute the below code
@@:
mov word ptr [004C9FB7], 860f // Little Indians
_________________
|
|
Back to top |
|
|
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Fri Sep 16, 2016 12:59 pm Post subject: |
|
|
okay so first let me say thanks for the quick reply! i saw it right away and have been playing with it since, wanted to get it working before i responded back.
so i added the originalcode, threw an [enable] and [disable] in the script, but for some reason am unable to check the box.
any idea why this might be? thanks!
again thanks for the help, hopefully once i understand this ill be able to expand on this new technique haha
|
|
Back to top |
|
|
STN I post too much Reputation: 42
Joined: 09 Nov 2005 Posts: 2672
|
Posted: Fri Sep 16, 2016 5:36 pm Post subject: |
|
|
Post your full code. I simply responded with what you were asking, no idea if you are doing it correctly though or what you are doing at all
_________________
|
|
Back to top |
|
|
catfood Cheater Reputation: 0
Joined: 22 Jun 2015 Posts: 34
|
Posted: Fri Sep 16, 2016 9:12 pm Post subject: |
|
|
theres nothing else to the code, the entirety of what i want to acomplish is
if the db at 00BF3CC0 is db 00
then at address 004C9FB7, change the db to db 0f 83
otherwise
if the db at 00BF3CC0 is NOT db 00
then at address 004C9FB7, change the db to db 0f 86
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sat Sep 17, 2016 8:12 am Post subject: |
|
|
You need to create a thread if you want the game to run that code once. If you want it to run periodically, find a suitable spot for a code injection.
Code: | [ENABLE]
alloc(newmem,1024)
label(endIf)
createthread(newmem)
newmem:
cmp [00BF3CC0],0
jne @f
mov word ptr [004C9FB7],830f
jmp endIf
@@:
mov word ptr [004C9FB7],860f
endIf:
ret
[DISABLE]
dealloc(newmem) |
Note that it is very bad practice to deallocate memory a thread is using. This particular thread won't spend even a millisecond executing this code, however, so no user should be able to deallocate the memory before the thread dies.
IMO Lua is a better alternative for automatically modifying values outside of a code injection.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|