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 


incrementing an integer with non-integer value

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
fishcorpse
How do I cheat?
Reputation: 0

Joined: 06 May 2015
Posts: 4

PostPosted: Wed May 06, 2015 7:42 pm    Post subject: incrementing an integer with non-integer value Reply with quote

Hi, newbie here.

there is a value that is incrementing with 1 in every loop.
that opcode:
inc [ebx+00000020]

i can easily change it to this
add [ebx+00000020],02 //doubles the speed of process

adding 1 in each loop is default and slow but adding 2 is way too much.

Since i cant add 1.5 to an integer, i thought another solution but i couldnt write it. because dont know how to write it in assembly Very Happy

MyCode:
inc [ebx+00000020]
inc [X] //My Defined Register
if X is even
jump to [it_is_even] //if last bit is 1, do another inc. if it is 0, jump to end.
inc [ebx+00000020]
it_is_even:

This pseudo code will add 3 in every 2 loops. So it will be like adding 1.5

1) How to write this in asm?
2) what can i do if want to increment with 1.1?[/b]
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed May 06, 2015 8:07 pm    Post subject: Reply with quote

Code:
alloc(x,4)
inc [ebx+00000020]
inc [x]
cmp [x],#1 // compare your value to 1 (starts at 0)
jg return // if it is greater than 1, jump to the return block
inc [ebx+00000020] // otherwise, increment your variable again
mov [x],0 // reset x to 0 so this logic is skipped next go around

Simply increase the compare if you want to increment every third, fourth, fifth, etc. occurrence.
1.1 would increment every 10th? so set the compare to:
Code:
cmp [x],#9
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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