| View previous topic :: View next topic |
| Author |
Message |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun May 18, 2014 5:01 am Post subject: Need To learn this Help Guys :D |
|
|
| Code: | fstp dword ptr [esi+04] //original code which is changing the health
pushfd //save flags
pushad //save registers
cmp [esi],0 //check if ESI=0
jne +6 //if ESI is not 0, the code will jump over the next 2 lines, jumping to the "popad" instruction
mov eax,[esi+08] //copy the max health on eax
mov [esi+04],eax //copy eax to the health, so max health = health
popad //load registers
popfd //load flags |
jne +6 // how does it jump over the next 2 lines when it says +6 what if i wanted to jump over 1 line would it be 3 then?
why is it not +2 since it jumps over 2 lines?
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun May 18, 2014 5:15 am Post subject: |
|
|
mov eax,[esi+08] - three bytes \
mov [esi+04],eax - three bytes / six bytes
TIP:
better use "unlabeled labels":
| Code: | fstp dword ptr [esi+04]
pushfd
pushad
cmp [esi],0
jne @f
mov eax,[esi+08]
mov [esi+04],eax
@@:
popad
popfd |
_________________
|
|
| Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun May 18, 2014 5:24 am Post subject: |
|
|
| Code: | fstp dword ptr [esi+04]
pushfd
pushad
cmp [esi],0
jne @f
mov eax,[esi+08]
mov [esi+04],eax
@@:
popad
popfd |
how would this work if i had multiply jumps
jne @f //@f ?
line 1
line 2
@@1
bla
bla
jg @f
line 1
line 2
line 3
@@2
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun May 18, 2014 5:38 am Post subject: |
|
|
jm* @f will jump to the nearest @@, when moving down. (forward)
jm* @b will jump to the nearest @@, when moving up. (backward)
_________________
|
|
| Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun May 18, 2014 5:43 am Post subject: |
|
|
Ohh Nice
Thanks Alot mate, you are the best
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun May 18, 2014 5:59 am Post subject: |
|
|
Try not to code scripts like that. The scripts with only @@ will look like crap, and are hard to read.
| Code: | @@:
line1
line2
line3
...
line16
je @f
line17
line18
line19
jne @b
@@
line20
line21
line22
line23
jne @f
line24
line25
@@:
line26
line27
jmp returnhere |
The example above, assume that line1-line19 is for searching through some kind of list. (it is a loop)
When it finds the object we want, jump (the jump after line 16) is taken.
Line20-line23 checks current state of object. If object state is "enabled" (this is just an example), then line24 and line25 and the rest of code are executed. If not, it jumps straight to line26.
So, use @@ only when you want to skip few lines only.
_________________
|
|
| Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun May 18, 2014 6:10 am Post subject: |
|
|
This will make scripting so much easier Thanks aloot Mate
Loving the CE community
|
|
| Back to top |
|
 |
Xblade Of Heaven Master Cheater
Reputation: 0
Joined: 16 Oct 2005 Posts: 395 Location: DEAD
|
Posted: Sun May 18, 2014 7:50 am Post subject: |
|
|
why save the flags and registers here?
| Code: |
label(_test)
fstp dword ptr [esi+04]
pushfd
pushad
cmp [esi],0
jne _test
mov eax,[esi+08]
mov [esi+04],eax
_test:
popad
popfd |
you do not need to save anything here is a simple comparison without more, or only eax.
| Code: |
label(_test)
push eax
cmp [esi],0
jne _test
mov eax,[esi+08]
mov [esi+04],eax
pop eax
_test: |
regards
PD: Thanks for the tip mgr.inz.Player (unlabeled labels) ^^ I had no idea this.
_________________
Welcome to the Hell.
 |
|
| Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun May 18, 2014 7:59 am Post subject: |
|
|
Thanks for the answere but thats not my script i just saw it and wanted to learn ways to jump around code without having to make a millions labels, im just too lazy
|
|
| Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5627
|
Posted: Sun May 18, 2014 2:23 pm Post subject: |
|
|
It's a damn old script from one of my tutorials, to show how to save flags, register, make a compare etc to create a god mode.
_________________
|
|
| Back to top |
|
 |
|