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 


how to Give one address 2 values with 2 intervals .

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Sat Sep 03, 2016 3:44 pm    Post subject: how to Give one address 2 values with 2 intervals . Reply with quote

This instruction access my address
Code:
fld dword ptr [esi+1C]


my address value is = .75 in float

I want to give this address 2 values :
.75 for 10 mil seconds
and
0 for 5 mil second

How can I do this : please provide any simple code
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Sep 03, 2016 4:09 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.Interval = 5
counter = 0
mytimer.OnTimer = function(timer)
  counter = counter + 1
  if counter > 2 then
    writeFloat("address", 0)
    counter = 0
  else
    writeFloat("address", 0.75)
  end
end
mytimer.Enabled = true
Back to top
View user's profile Send private message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Sat Sep 03, 2016 5:39 pm    Post subject: Reply with quote

[quote="Zanzer"]
I dont want to change the address directly

I want the instruction
Code:
fld dword ptr [esi+1C]
give me the 2 values by code injection .

and where is interval of 10 mil sec in the above script ?
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Sat Sep 03, 2016 10:06 pm    Post subject: Reply with quote

Then you need to:

Create an AOB script using the Template
Create a variable using GlobalAlloc
replace esi+1C with that variable
activate the script
Use Zanzer's script above to set the value of the variable to .75 or 0 for the timeframe you wanted.

literally what Zanzer told you to do, but now with a variable so that you can make things as complicated and convoluted as you like...

The counter code implements the 10ms and 5 ms intervals. You need to learn more about coding!
Code runs every 5ms, so if the counter counts to 2 it is 10ms.

Now i'm fairly sleepy, but the code appears to last for 15ms to me before changing. So you may want to look at it twice.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sun Sep 04, 2016 2:53 am    Post subject: Reply with quote

May I ask why need this small interval of time, 5 and 10 mil sec ?

If it is a game, and this particular part of code is executed once per frame, and fps is 30, the code should only executed once for every 33mil sec on average. During this frame, if some mechanism, eg Lua code, make the small request interval value change perfectly, the native code may not see the desired ratio, eg.
Code:

00 ms frame 1 : executing native code
05 ms -- lua timer count 0, value 0.75
10 ms -- lua timer count 1, value 0.75
15 ms -- lua timer count 2, value 0.00
20 ms -- lua timer count 0, value 0.75
25 ms -- lua timer count 1, value 0.75
30 ms -- lua timer count 2, value 0.00
33 ms frame 2 : executing native code
35 ms -- lua timer count 0, value 0.75
40 ms -- lua timer count 1, value 0.75
45 ms -- lua timer count 2, value 0.00
50 ms -- lua timer count 0, value 0.75
55 ms -- lua timer count 1, value 0.75
60 ms -- lua timer count 2, value 0.00
66 ms frame 3 : executing native code

The address may be accessed by other part of code many times during the frame, may be similar logic as Zanzer's Lua code using counter can be applied in native code form, not in exactly 5mil sec to 10 mil sec, but 1 frame to 2 frames (or n frames to 2xn frames for larger interval) duration? It may complicated the native code if exactly timing in mil sec is required.

bye~

_________________
- Retarded.
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