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 automatically change value via timer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
plagiator
Newbie cheater
Reputation: 0

Joined: 16 Oct 2013
Posts: 14

PostPosted: Thu Oct 17, 2013 12:43 pm    Post subject: how to automatically change value via timer Reply with quote

Hello,

I have found the pointer to a value (double). I have defined a hotkey "time1". now whenever I press it the value becomes 1 as I "set Value to: 1". I have also created a trainer which works fine.

Now I would like to have this done automatically when the value becomes 100 it should be changed automatically without any interaction by me to 1.

How is this exactly done? I assume I need a timer control?

Thank You for helping me out.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Oct 17, 2013 1:02 pm    Post subject: Reply with quote

Code:
cmp [time1],(double)100
jl originalcode
mov [time1],(double)1
Back to top
View user's profile Send private message
plagiator
Newbie cheater
Reputation: 0

Joined: 16 Oct 2013
Posts: 14

PostPosted: Fri Oct 18, 2013 12:43 pm    Post subject: Reply with quote

thank you for you help.
unfortunately I don't understand how to use the code.

my idea was to create a timer control to execute every 100 secs
my defined hotkey. How would I do that?

meanwhile I found an intricate work-around myself via a batch file and nircmd. to avoid such endeavor I'd be happy to learn how to do this in CE.
anyway here is my work-around, maybe it's of interest to someone else:

Code:
@echo off

REM start game
start "" "D:\game.exe"
REM wait 3 sec
ping 192.0.2.2 -n 1 -w 3000 > nul
REM start trainer
START /MIN "" "d:\trainer.exe"


REM Loop
:loop
REM check if game is running
tasklist /FI "IMAGENAME eq game.exe" 2>NUL | find /I /N "game.exe">NUL
if "%ERRORLEVEL%"=="0" (
REM then wait for 100 sec
ping 192.0.2.2 -n 1 -w 100000 > nul
REM auto execute hotkey in CE trainer, press "t"
START /MIN "" "D:\nircmdc.exe" sendkeypress 0x54
REM Goto Loop Start
GOTO loop)
REM game is not running
ELSE (
REM kill trainer
taskkill /f /im trainer.EXE
REM Quit loop
GOTO quit
)
GOTO loop

:quit
exit
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Fri Oct 18, 2013 1:13 pm    Post subject: Reply with quote

Code:
t = createTimer(nil,false);
t.Interval = 100; -- 100 ms
t.onTimer = function () if readInteger(0x400000,100) then writeInteger(0x400000, 1); end end;
t.Enabled = true;

Sets value back to 1 after every check (checks intervals are 100ms which is 0.1 second)

Here's an bit FASTER way, that sets the value to 1, remove the readinteger, and the value will be like 'permanently' set to 1.
Code:
function SetValue()
   while 1==1 do
      if readInteger(0x03BB5BA8,100) then
         writeInteger(0x03BB5BA8, 1);
      end
   end
end
createNativeThread(SetValue);


Edit:
Ran a testing how many times the operation is being repeated every 0.5 seconds.

Results:
Quote:
602382
1202405
1794120
2414634
3029669
3651795
4192094
4802502
5411333
6026395
6643624
7262650
7882146
8497946


Using
Code:
i = 0
function SetValue()
   while 1==1 do
      i = i + 1;
      writeInteger(0x0E0A9E58, 100);
   end
end
createNativeThread(SetValue);

t = createTimer(nil,false);
t.onTimer = function () print(i); end;
t.Inteval = 500;
t.Enabled = true;

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Oct 19, 2013 10:33 am    Post subject: Reply with quote

Paste your script here, and I can show you how to do it in assembly.

The general idea:

Code:

newmem:
cmp [enabled],1
jne originalcode
cmp [timer],0
je set
sub [timer],1
jmp originalcode

set:
mov [time1],(double)1
mov [timer],100000
jmp originalcode


Simply set a hotkey that will enable the cheat (and) set the value for [timer] as 100000.
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