jump condition question

Kalas

Cat'n America!
Fearless Donors
Mar 3, 2017
478
4
18
#1
Hey!

I'm kinda new to jump conditions so I wanted to make sure I understand this following code correctly:
Code:
 code:
 pushf
 cmp [r12+20],esi
 jl originalcode
 popf
 jmp return

originalcode:
  popf
  mov [r12+20],esi
  jmp return
The instruction is for Health, It writes when you loose and gain health. (I saw Stephan Chapman video about this but I still don't understand how It works)
 

Bloodybone

Novice Cheater
Aug 3, 2017
103
0
16
#2
jl is jump if less that means jump if [r12+20] is smaler than esi. I watched the tutorial also so what happens is if the player gets hit esi is smaller than [r12+20] so don't jump and if it is bigger like if you use an health potion esi is bigger than [r12+20] so jump.
 

Kalas

Cat'n America!
Fearless Donors
Mar 3, 2017
478
4
18
#3
Oh I think I got it now, still have doubts.

So if I get hit jump to return which means do nothing, and if I gain health so run the instruction as normal. Thank you so much!
 

Bloodybone

Novice Cheater
Aug 3, 2017
103
0
16
#4
Kalas post_id=20734 time=1508273719 user_id=271 said:
Oh I think I got it now, still have doubts.

So if I get hit jump to return which means do nothing, and if I gain health so run the instruction as normal. Thank you so much!
What doubts do you have?
 

Kalas

Cat'n America!
Fearless Donors
Mar 3, 2017
478
4
18
#5
I don't get it, If +20 is lower then esi jump to code, shouldn't it jump to return?
 

Kalas

Cat'n America!
Fearless Donors
Mar 3, 2017
478
4
18
#6
Oh hang on, It's never going to take health but it checks if it is lower then esi it's going to jump to code and allow to gain health.
 

Bloodybone

Novice Cheater
Aug 3, 2017
103
0
16
#7
[r12+20] is the pointer to player health and esi is new player health so if new player health(esi) is smaller then current player health [r12+20] then jump to return and if esi is bigger like current player health is 40 and esi is after drinking the health potion 50 then jump to originalcode
 

Bloodybone

Novice Cheater
Aug 3, 2017
103
0
16
#8
Kalas post_id=20741 time=1508274540 user_id=271 said:
Oh hang on, It's never going to take health but it checks if it is lower then esi it's going to jump to code and allow to gain health.
yes thats it.