atom0s Moderator Reputation: 199 Joined: 25 Jan 2006 Posts: 8519 Location: 127.0.0.1
|
Posted: Fri Jan 21, 2022 3:21 am Post subject: |
|
|
Code: |
[ENABLE]
{$lua}
_G._hotkeyTimer = createTimer();
_G._hotkeyTimer.Interval = 10;
_G._hotkeyTimer.OnTimer = function (t)
if (isKeyPressed(22535)) then
writeBytes('cheatengine-i386.exe', 1);
else
writeBytes('cheatengine-i386.exe', 0);
end
end
{$asm}
[DISABLE]
{$lua}
if (_G._hotkeyTimer ~= nil) then
_G._hotkeyTimer.destroy();
_G._hotkeyTimer = nil;
end
{$asm}
|
Uses the right trigger button of an XInput gamepad to work.
If you only want to write the 0 when released once but still monitor, then you can add a previous state check like this:
Code: |
[ENABLE]
{$lua}
_G._hotkeyTimer_PreviousState = false;
_G._hotkeyTimer = createTimer();
_G._hotkeyTimer.Interval = 10;
_G._hotkeyTimer.OnTimer = function (t)
if (isKeyPressed(22535)) then
writeBytes('cheatengine-i386.exe', 1);
_G._hotkeyTimer_PreviousState = true;
else
if (_G._hotkeyTimer_PreviousState == true) then
writeBytes('cheatengine-i386.exe', 0);
_G._hotkeyTimer_PreviousState = false;
end
end
end
{$asm}
[DISABLE]
{$lua}
if (_G._hotkeyTimer ~= nil) then
_G._hotkeyTimer.destroy();
_G._hotkeyTimer = nil;
end
{$asm}
|
_________________ - Retired.
|
|