View previous topic :: View next topic |
Author |
Message |
mece Newbie cheater Reputation: 2
Joined: 29 Jun 2014 Posts: 17
|
Posted: Sun May 01, 2022 5:42 am Post subject: |
|
|
You can use a timer:
Code: | https://wiki.cheatengine.org/index.php?title=Lua:Class:Timer |
E.g. create script with the following text (Ctrl+M → Ctrl+A → paste → File.Assign to current cheat table).
Don't forget to replace "YourRecordName".
Code: |
[ENABLE]
{$lua}
if syntaxcheck then return end
local mr = getAddressList().getMemoryRecordByDescription("YourRecordName")
if mr then
if timerFlash then
timerFlash.destroy()
timerFlash = nil
end
timerFlash = createTimer(getMainForm())
timerFlash.Interval = 500
timerFlash.OnTimer = function(timer)
mr.Value = tonumber(mr.Value)>0 and 0 or 1
end
end
{$asm}
[DISABLE]
|
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sun May 01, 2022 6:33 am Post subject: |
|
|
Thanks,but dont understand how to run this script.
Can you attach hotkey to turning on?
|
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Sun May 01, 2022 6:34 am Post subject: |
|
|
mece wrote: | You can use a timer:
Code: | https://wiki.cheatengine.org/index.php?title=Lua:Class:Timer |
E.g. create script with the following text (Ctrl+M → Ctrl+A → paste → File.Assign to current cheat table).
Don't forget to replace "YourRecordName".
Code: |
[ENABLE]
{$lua}
if syntaxcheck then return end
local mr = getAddressList().getMemoryRecordByDescription("YourRecordName")
if mr then
if timerFlash then
timerFlash.destroy()
timerFlash = nil
end
timerFlash = createTimer(getMainForm())
timerFlash.Interval = 500
timerFlash.OnTimer = function(timer)
mr.Value = tonumber(mr.Value)>0 and 0 or 1
end
end
{$asm}
[DISABLE]
|
|
that's timer that will always change value
Code: | {$lua}
if syntaxcheck then return end
[ENABLE]
local active
local address = --your address
flashlightHotkey = createHotkey(function()
active = not active
writeByte(address,active and 1 or 0)
end,VK_H) --H isn't hotkey in game right?
flashlightHotkey.delayBetweenActivate = 99999 --we must to press it once
[DISABLE]
flashlightHotkey.destroy()
flashlightHotkey = nil
{$asm} |
create a new memrec and put it in there
_________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sun May 01, 2022 6:50 am Post subject: |
|
|
Maybe i explain how it should work.
Adress: 700F8954
Lights off: 0
Lights on: 2 (its not 1, sorry my bad)
Hitting button "L" will start flashing, hit again make it off
Light flashing with intervals. I mean flashing for 10 seconds, then 3 seconds break and repeat whole process
When is 3 seconds break, value must be "2"
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Sun May 01, 2022 8:37 am Post subject: |
|
|
1) It will flash every half second.
2) After 10 seconds it will wait for 3 seconds. While waiting, the flash will be in the "0" position.
3) It will repeat Cycles 1 and 2.
4) Start and stop are set with the L key. The address value for stop is "0".
5) Put the address in the address list and make sure you write the description in the code below. ("YourRecordName")
6) The code is set for Lua Script. Paste it into CE main menu >> Table >> Show Cheat Table Lua Script and click the "Execute Script" button to activate it.
7) Your request caused some complicated coding. If you don't know what you're doing, don't edit it. Keep looking for a solution from here.
good games.
Code: | if tFlash then tFlash.destroy() tFlash = nil end
tFlash=createTimer(MainForm) tFlash.Interval=500 tFlash.Enabled=false
local stop1 = 1
local stop2 = 0
local start = 0
local tTick1 = 0
local tTick2 = 0
function flashLight()
local mr = getAddressList().getMemoryRecordByDescription("YourRecordName")
if stop1==1 then
if tTick2==6 then tTick2=0 end --6 = 3 sec
if tTick1<21 then
if stop2==0 then --flash value: 0..2..0..2
mr.Value=0
stop2=1
print("\nturned on!\ntTick1: "..tTick1)
else
mr.Value=2
stop2=0
print("\nturned off!\ntTick1: "..tTick1)
end
tTick1 = tonumber(tTick1) + 1
else
tTick2 = tonumber(tTick2) + 1
mr.Value=0
print("tTick2: "..tTick2)
if tTick2==6 then tTick2=0 tTick1=1 end
end
else
mr.Value=0
tFlash.Enabled=false
end
--print("\nmr.Value: "..mr.Value.."\ntTick1: "..tTick1.."\ntTick2: "..tTick2.."\nstop1: "..stop1.."\nstop2: "..stop2.."\nstart: "..start)
end
function flashStart()
sleep(200)
if start==0 then
stop1=1
tTick1 = 1
tTick2 = 0
tFlash.Enabled=true
start=1
else
stop1=0
tFlash.Enabled=true
start=0
end
end
if fKey then fKey.destroy() fKey = nil end
fKey=createHotkey(flashStart, VK_L)
tFlash.OnTimer=flashLight |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sun May 01, 2022 12:59 pm Post subject: |
|
|
Thank you <3
I tested it already a bit and working very well.
But while using i noticed one problem and two lack of function.
1.
Quote: | 2) After 10 seconds it will wait for 3 seconds. While waiting, the flash will be in the "0" position. |
While 3 seconds waiting, value should be set "2"
2.
Needed separated hotkey to turn off
"L" key only to turn on
"K" key only to turn off
3.
I would add auto attacher.
I found this, will be good?
If yes, please implement it into your script. I dont wanna make mess.
Code: | PROCESS_NAME = 'Game.exe'
--------
-------- Auto Attach
--------
local autoAttachTimer = nil
local autoAttachTimerInterval = 1000 ---- Timer intervals are in milliseconds
local autoAttachTimerTicks = 0
local autoAttachTimerTickMax = 5000 ---- Set to zero to disable ticks max
local function autoAttachTimer_tick(timer) ---- Timer tick call back
if autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
timer.destroy() ---- Destroy timer if max ticks is reached
end
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then ---- Check if process is running
timer.destroy() ---- Destroy timer
openProcess(PROCESS_NAME) ---- Open the process
end
autoAttachTimerTicks = autoAttachTimerTicks + 1 ---- Increase ticks
end |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Sun May 01, 2022 1:34 pm Post subject: |
|
|
You should check this out.
Code: | if tFlash then tFlash.destroy() tFlash = nil end
tFlash=createTimer(MainForm) tFlash.Interval=500 tFlash.Enabled=false
local stop1 = 1
local stop2 = 0
local start1 = 0
local start2 = 0
local tTick1 = 0
local tTick2 = 0
--attach process
PROCESS_NAME = 'Game.exe' -- >> your game name.exe ?
openProcess(PROCESS_NAME)
function autoAttachTimer_tick()
local proc
if getOpenedProcessID()~=getProcessIDFromProcessName(PROCESS_NAME) then
openProcess(PROCESS_NAME)
end
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
proc = 1
else
proc = 0
end
return proc
end
function flashLight()
procCheck = autoAttachTimer_tick()
if procCheck==1 then
local mr = getAddressList().getMemoryRecordByDescription("YourRecordName")
if stop1==1 then
if tTick2==6 then tTick2=0 end --6 = 3 sec
if tTick1<21 then
if stop2==0 then --flash value: 0..2..0..2
mr.Value=0
stop2=1
print("\nturned on!\ntTick1: "..tTick1)
else
mr.Value=2
stop2=0
print("\nturned off!\ntTick1: "..tTick1)
end
tTick1 = tonumber(tTick1) + 1
else
tTick2 = tonumber(tTick2) + 1
mr.Value=2
print("tTick2: "..tTick2)
if tTick2==6 then tTick2=0 tTick1=1 end
end
else
mr.Value=0
tFlash.Enabled=false
end
else
start1 = 0
start2 = 0
tFlash.Enabled=false
showMessage("Error! Make sure the game is open!")
end
end
function flashStart()
sleep(200)
if start1==0 then
stop1=1
tTick1 = 1
tTick2 = 0
tFlash.Enabled=true
start1=1
start2=0
else
showMessage("The loop code is already active!")
end
end
function flashStop()
sleep(200)
if start2==0 then
stop1=0
tFlash.Enabled=true
start2=1
start1=0
else
showMessage("The loop code is already deactive!")
end
end
if fKey1 then fKey1.destroy() fKey1 = nil end
fKey1=createHotkey(flashStart, VK_L)
if fKey2 then fKey2.destroy() fKey2 = nil end
fKey2=createHotkey(flashStop, VK_K)
tFlash.OnTimer=flashLight |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sun May 01, 2022 2:59 pm Post subject: |
|
|
Almost perfect. Just only edit previous post and disable messages "The loop code is already deactive!" & "The loop code is already active!"
I had to shut them down, because when appear they paralyzing script.
Hotkeys stop working and must minimize game to close this window.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Sun May 01, 2022 3:23 pm Post subject: |
|
|
I added this just to warn that the already active key is being pressed again.
Editing it shouldn't be difficult.
message active;
Code: | showMessage("The loop code is already active!") |
message deactive;
Code: | -- showMessage("The loop code is already active!") |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sun May 01, 2022 3:45 pm Post subject: |
|
|
AylinCE wrote: | I added this just to warn that the already active key is being |
I know.
Anyway, thank so much for your help. Now everything work fine and I can enjoy
|
|
Back to top |
|
|
|