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 


Comparing double values

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Oct 18, 2014 3:58 pm    Post subject: Comparing double values Reply with quote

Hey guys,
I'm trying to find which enemy is the closest, to create a bot that will travel to mobs that are near and will try to kill them.
So my script goes like this

Code:
(...)
newmem:
// this scripts works only as long as player has map opens, if he closes it, object will be destroyed, so this will update player cords,
push eax
mov eax,[ecx+18]
cmp eax,0 // 0 for playes, 1 for enemies
   jne calculate
mov [flag],1
mov eax,[ecx+58]
cmp eax,(double)1.0
   je calculate
mov [flag],2
mov eax,[ecx+24]
cmp eax,0
   je calculate
mov eax,[eax+8]
cmp eax,0
   je calculate
mov eax,[eax]
cmp eax,0
   je calculate
cmp eax,'auto'
   jne calculate
mov [autoFlag],1
lea eax,[ecx+38]
mov [playerAddress],eax
mov eax,[ecx+38]
mov [playerX],eax
mov eax,[ecx+3c]
mov [playerX+4],eax
mov eax,[ecx+40]
mov [playerY],eax
mov eax,[ecx+44]
mov [playerY+4],eax
jmp clean
(...)



ecx+38 holds player x
ecx+40 holds player y

Since I'm not very familiar with assembler, how could I get absolute value, and how could I compare double type registrars

Basically right now, the only thing comes to my mind.
Code:
calculate:
movq xmm0, [playerX]
movq xmm1, [ecx+38]
// not sure how to compare cords in double, compare xmm0 with xmm1
jb @F
subsd xmm0,xmm1
// compare again but this time compare xmm0 with value of (double)50
ja notvalid
movq xmm1,[ecx+38]
movq [enemyX],xmm1
jmp original

@@:
subsd xmm1,xmm0
// compare again but this time compare xmm1 with value of (double)50
ja notvalid
movq xmm1,[ecx+38]
movq [enemyX],xmm1
jmp original

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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 All times are GMT - 6 Hours
Page 1 of 1

 
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