|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Thu Jul 07, 2022 2:15 pm Post subject: Loop timer |
|
|
Im looking for simple script to automatic loop timer
Timer working in seconds from 60 to 0
Details:
address: 701527F8
Type: Float
Value (example display form) : 48.84574654 (8 symbols after dot)
How it should work:
When timer down to value 1, set it to 60
operated on hotkeys to turn ON & OFF script
_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Thu Jul 07, 2022 4:37 pm Post subject: |
|
|
Code: | if secTim1 then secTim1.Destroy() secTim1=nil end
secTim1=createTimer() secTim1.Interval=1000 secTim1.Enabled=false
local sec = 60
function createAddr(addr,val)
print("before: "..readFloat(addr))
writeFloat(addr,val)
print("after: "..readFloat(addr))
end
secTim1.OnTimer=function()
sec = tonumber(sec) - 1
print(sec)
if sec==0 then
createAddr("701527F8","48.84574654")
secTim1.Enabled=false
end
end
function timerHotkey()
sleep(120)
if secTim1.Enabled==false then
sec = 60
secTim1.Enabled=true
else
secTim1.Enabled=false
end
end
if actKey then actKey.Destroy() actKey=nil end
actKey=createHotkey(timerHotkey, VK_F8)
|
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Fri Jul 08, 2022 6:16 am Post subject: |
|
|
You may try following, but it use no lua timer (I assume the value countdown is in game) and needs 2 hot keys for on/off , ie. not toggle
1. select 2 set of hotkey, as example, ON use ctrl-shift+[ (K1) and off use ctrl+shift+] (K2)
2. right click your memory record, [set/change hotkeys] and create following hotkey IN ORDER:
2.1 (K1), FREEZE
2.2 (K2), UNFREEZE
2.3 (K1), SET_VALUE_TO, value field input
"tonumber(value)and(tonumber(value)<=1 and 60 or value)"(no quotes)
The order matter because "value" will stay only if the memory record is already froze.
In case, you need some timer counter effect, try use this slightly modified value:
"tonumber(value)and(tonumber(value)<=1 and 60 or tonumber(value) - 0.1 )" (no quote)
This make the value count down toward zero, and if <=1 flip to 60.
This is because memory record has its own activate/update timer, it has the equivalent logic as:
Code: | update_timer.OnTimer = function()
local value = memory_record.Value
value = tonumber(value)and(tonumber(value)<=1 and 60 or tonumber(value) - 0.1 ) -- the expression in hotkey[set_value_to]field
memory_record.Value = value
end |
ADDED:
directly/manually set value will clear the "value" expression set by hotkey, it need apply the ON-hotkey again to have the effect.
_________________
- Retarded. |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Fri Jul 08, 2022 9:51 am Post subject: |
|
|
Copy the code below and paste it into the address list.
(In the original language of the page if possible)
Options:
1) When the group is activated, ON-OFF switch is created. (Default F8 key)
2) Each time you click the F8 key, the timer script will run or be stopped.
3) When the timer script is active; When 60 seconds becomes 1, the loop goes back to 60 and continues.
4) When the timer is 1, the default address value is changed to the given value.
This is just an example and you can edit them.
Code: | <?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>4</ID>
<Description>"StartHack (HotKey)"</Description>
<Options moHideChildren="1"/>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$Lua}
if syntaxcheck then return end
local set = 1
function TIMER_ON_OFF()
sleep(120)
al=getAddressList()
local memrec1=addresslist_getMemoryRecordByDescription(al,"secTmr")
if memrec1~=nil then
if set==1 then
memrec1.Active = true
set = 2
else
memrec1.Active = false
set = 1
end
else
print("memrec not found")
end
end
if TimKey then TimKey.Destroy() TimKey=nil end --kill key
TimKey=createHotkey(TIMER_ON_OFF,VK_F8)
{$asm}
[DISABLE]
{$Lua}
if TimKey then TimKey.Destroy() TimKey=nil end --kill key
</AssemblerScript>
<CheatEntries>
<CheatEntry>
<ID>1</ID>
<Description>"secTmr"</Description>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$Lua}
if syntaxcheck then return end
if secTim1 then secTim1.Destroy() secTim1=nil end
secTim1=createTimer() secTim1.Interval=1000 secTim1.Enabled=true
local sec = 60
secTim1.OnTimer=function()
sec = tonumber(sec) - 1
--print(sec)
if sec==1 then
al=getAddressList()
local mem=addresslist_getMemoryRecordByDescription(al,"Hack")
mem.Value = "48.84574654"
sec = 60
end
end
{$asm}
[DISABLE]
{$Lua}
secTim1.Destroy()
</AssemblerScript>
</CheatEntry>
<CheatEntry>
<ID>2</ID>
<Description>"Hack"</Description>
<ShowAsSigned>0</ShowAsSigned>
<VariableType>Float</VariableType>
<Address>701527F8</Address>
</CheatEntry>
</CheatEntries>
</CheatEntry>
</CheatEntries>
</CheatTable>
|
_________________
|
|
Back to top |
|
|
|
|
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
|
|