Page 1 of 1

Hold Key Press Hotkey Script

Posted: Thu Feb 10, 2022 2:35 pm
by Evoked100
im found this value

Code: Select all

GameAssembly.dll+641AB4C
in float

Code: Select all

-1
im need script for Hold keypress "SHIFT" the value -1 come to 5

im found this on google

Code: Select all

function _Key()
         keyDown(VK_SHIFT) -- Pressed Key SHIFT
end
how im complete script? thanks very much

Re: Hold Key Press Hotkey Script

Posted: Thu Feb 10, 2022 4:58 pm
by LeFiXER
Without more information it's hard to say if this will work exactly as intended. The code provided creates a hotkey and assigns a function that writes a float value of 5 to the address upon pressing the hotkey.

Code: Select all

hk = createHotkey(function()
  writeFloat(GameAssembly.dll+641AB4C, 5)
end, VK_SHIFT)

Re: Hold Key Press Hotkey Script

Posted: Thu Feb 10, 2022 11:57 pm
by Evoked100
LeFiXER wrote:
Thu Feb 10, 2022 4:58 pm
Without more information it's hard to say if this will work exactly as intended. The code provided creates a hotkey and assigns a function that writes a float value of 5 to the address upon pressing the hotkey.

Code: Select all

hk = creatHotkey(function()
  writeFloat(GameAssembly.dll+641AB4C, 5)
end, VK_SHIFT)
not working im try

Image

Re: Hold Key Press Hotkey Script

Posted: Fri Feb 11, 2022 1:13 pm
by LeFiXER
Evoked100 wrote:
Thu Feb 10, 2022 11:57 pm
not working im try

Image
I noticed a typo. I missed the "e" in "createHotkey".

Re: Hold Key Press Hotkey Script

Posted: Fri Feb 11, 2022 3:00 pm
by Evoked100
LeFiXER wrote:
Thu Feb 10, 2022 4:58 pm
Without more information it's hard to say if this will work exactly as intended. The code provided creates a hotkey and assigns a function that writes a float value of 5 to the address upon pressing the hotkey.

Code: Select all

hk = createHotkey(function()
  writeFloat(GameAssembly.dll+641AB4C, 5)
end, VK_SHIFT)
im have tryed this...

no have effect. value no change to 5

Code: Select all

function speed() --boosts speed for superspeed
   if main.speed.checked==true then
   writeFloat("GameAssembly.dll+641AB4C",5)
  end
end

function float() --superspeed without the speed
    writeFloat("GameAssembly.dll+641AB4C",5)
end

speedkey = createHotkey("speed",VK_SHIFT) --superspeed hotkey

function close() --on close for form
closeCE()
return caFree
end

main=createForm(true)
main.borderstyle=bsToolWindow
main.height=70
main.width=156
main.left=342
main.top=115
main.caption="Speed"
main.OnClose = close
main.speedtext=createLabel(main)
main.speedtext.caption="Super Speed"
main.speedtext.left=28
main.speedtext.top=5
main.speed=createCheckBox(main)
main.speed.caption=nil
main.speed.checked=false
main.speed.left=95
main.speed.top=5
main.OnClose = close

Re: Hold Key Press Hotkey Script

Posted: Fri Feb 11, 2022 5:27 pm
by LeFiXER
Here:

Code: Select all

frmSpeed = createForm(true)
frmSpeed.borderstyle = bsToolWindow
frmSpeed.height = 70
frmSpeed.width = 156
frmSpeed.left = 342
frmSpeed.top = 115
frmSpeed.caption = "Speed"
frmSpeed.OnClose = disableSpeed()

cbSpeed = createCheckBox(frmSpeed)
cbSpeed.caption = "Super Speed"
cbSpeed.OnClick = checkState
cbSpeed.left = 10
cbSpeed.top = 15

function disableSpeed()
  -- Here you will want to write the original speed value
  local original_speed = 0

  if hk then
    hk.destroy()
    hk = nil
    print('Hotkey destroyed')
  end

  if original_speed ~= nil then
     writeFloat("GameAssembly.dll+641AB4C", original_speed)
  else
     return nil
  end
end

function setSpeed(speedToSet, nkey)
  if frmSpeed == nil then
    return
  end
  local hk = createHotkey(
             function()
               if nkey ~= nil then
                 writeFloat("GameAssembly.dll+641AB4C", tonumber(speedToSet))
               end
             end, nkey)
     --print('Created hotkey: ' .. string.format("0x%X", nkey) .. '\nSpeed set to : ' .. tostring(speedToSet))
     return hk
end


function checkState(cb)
   if cb.State == cbChecked then
      setSpeed(5, VK_SHIFT)
   else
      disableSpeed()
   end
end
This will create the hotkey when the checkbox is enabled. Make sure the address is correct.

Re: Hold Key Press Hotkey Script

Posted: Fri Feb 11, 2022 11:14 pm
by Evoked100
LeFiXER wrote:
Fri Feb 11, 2022 5:27 pm
Here:

Code: Select all

frmSpeed = createForm(true)
frmSpeed.borderstyle = bsToolWindow
frmSpeed.height = 70
frmSpeed.width = 156
frmSpeed.left = 342
frmSpeed.top = 115
frmSpeed.caption = "Speed"
frmSpeed.OnClose = disableSpeed()

cbSpeed = createCheckBox(frmSpeed)
cbSpeed.caption = "Super Speed"
cbSpeed.OnClick = checkState
cbSpeed.left = 10
cbSpeed.top = 15

function disableSpeed()
  -- Here you will want to write the original speed value
  local original_speed = 0

  if hk then
    hk.destroy()
    hk = nil
    print('Hotkey destroyed')
  end

  if original_speed ~= nil then
     writeFloat("GameAssembly.dll+641AB4C", original_speed)
  else
     return nil
  end
end

function setSpeed(speedToSet, nkey)
  if frmSpeed == nil then
    return
  end
  local hk = createHotkey(
             function()
               if nkey ~= nil then
                 writeFloat("GameAssembly.dll+641AB4C", tonumber(speedToSet))
               end
             end, nkey)
     --print('Created hotkey: ' .. string.format("0x%X", nkey) .. '\nSpeed set to : ' .. tostring(speedToSet))
     return hk
end


function checkState(cb)
   if cb.State == cbChecked then
      setSpeed(5, VK_SHIFT)
   else
      disableSpeed()
   end
end
This will create the hotkey when the checkbox is enabled. Make sure the address is correct.
Address is correct check:
Image

thanks for help-me

on line 8 says this error:

Code: Select all

Error:[string "frmSpeed = createForm(true)
..."]:8: attempt to call a nil value (global 'disableSpeed')
im deleted line 8 and execute this (only changed original speed 0 to -1:

Code: Select all

frmSpeed = createForm(true)
frmSpeed.borderstyle = bsToolWindow
frmSpeed.height = 70
frmSpeed.width = 156
frmSpeed.left = 342
frmSpeed.top = 115
frmSpeed.caption = "Speed"

cbSpeed = createCheckBox(frmSpeed)
cbSpeed.caption = "Super Speed"
cbSpeed.OnClick = checkState
cbSpeed.left = 10
cbSpeed.top = 15

function disableSpeed()
  -- Here you will want to write the original speed value
  local original_speed = -1

  if hk then
    hk.destroy()
    hk = nil
    print('Hotkey destroyed')
  end

  if original_speed ~= nil then
     writeFloat("GameAssembly.dll+641AB4C", original_speed)
  else
     return nil
  end
end

function setSpeed(speedToSet, nkey)
  if frmSpeed == nil then
    return
  end
  local hk = createHotkey(
             function()
               if nkey ~= nil then
                 writeFloat("GameAssembly.dll+641AB4C", tonumber(speedToSet))
               end
             end, nkey)
     --print('Created hotkey: ' .. string.format("0x%X", nkey) .. '\nSpeed set to : ' .. tostring(speedToSet))
     return hk
end


function checkState(cb)
   if cb.State == cbChecked then
      setSpeed(5, VK_SHIFT)
   else
      disableSpeed()
   end
end
open window, im enable Box and use "SHIFT" value not move to 5

Re: Hold Key Press Hotkey Script

Posted: Sat Feb 12, 2022 10:55 am
by LeFiXER
Evoked100 wrote:
Fri Feb 11, 2022 11:14 pm
...
It might be better to use the built-in feature.
See: [Link]

Re: Hold Key Press Hotkey Script

Posted: Sat Feb 12, 2022 1:54 pm
by Evoked100
im have created this now :

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>293</ID>
      <Description>"Speed Hack"</Description>
      <LastState Activated="1"/>
      <Color>408000</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
aobscan(speed, 00 00 80 BF 92 0A 86 BF 00)

label(speed1)
registersymbol(speed1)

speed:
speed1:


[DISABLE]

unregistersymbol(speed1)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>294</ID>
          <Description>"speed"</Description>
          <LastState Value="-1" RealAddress="7FFAE9E8AB4C"/>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>Float</VariableType>
          <Address>speed1</Address>
          <Hotkeys>
            <Hotkey>
              <Action>Set Value</Action>
              <Keys>
                <Key>16</Key>
              </Keys>
              <Value>5</Value>
              <ID>0</ID>
            </Hotkey>
          </Hotkeys>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
How im add auto anddress come back to -1 after unpress the shift button?

Re: Hold Key Press Hotkey Script

Posted: Sat Feb 12, 2022 3:18 pm
by LeFiXER
I wish I could help more, but I simply don't have the time. Perhaps setting another hotkey to set the value to -1 instead is a happy compromise.

Re: Hold Key Press Hotkey Script

Posted: Sat Feb 12, 2022 5:10 pm
by Evoked100
any have solution for this?

@SunBeam
@ShyTwig16
@tfigment
@Akira
@cedricvdg
@GreenHouse
@Insterluda
@TheByteSize
@Rysefox
@MBRKiNG
@DarkByte

thanks LeFiXER for help at here

Re: Hold Key Press Hotkey Script

Posted: Mon Feb 14, 2022 6:58 pm
by YoucefHam
Evoked100 wrote:
Sat Feb 12, 2022 5:10 pm
any have solution for this?
...
Hi there :D ,
try this, paste the code in cheat engine Address list

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>2441</ID>
      <Description>"While Key Pressed Down Do"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript Async="1">{$lua}
if syntaxcheck then return end
memrec.Async = true
[ENABLE]
-- Tutorial Step 4 Float Value
-- local AddressString = '["Tutorial-x86_64.exe"+0x325AA0]+0x818'
local AddressString = 'GameAssembly.dll+641AB4C'
local Address = getAddress( AddressString )
local key = VK_SHIFT  -- see for more https://wiki.cheatengine.org/index.php?title=Virtual-Key_Code
local DownValue = 5  -- Value while Key is Pressed Down
local UpValue = -1  -- Value while Key is Not Pressed

hk = createHotkey( function()
   while isKeyPressed( key ) do
     writeFloat( Address, DownValue ) -- Value while Key is Pressed Down
     sleep(10)
     if not isKeyPressed( key ) then
         writeFloat( Address, UpValue ) -- Value while Key is Not Pressed
     end
   end
   if not isKeyPressed( key ) then
         writeFloat( Address, UpValue ) -- Value while Key is Not Pressed
   end
end, key )

[DISABLE]
key = nil
AddressString = nil
Address = nil
if hk then
  hk.destroy()
  hk = nil
end

</AssemblerScript>
    </CheatEntry>
  </CheatEntries>
</CheatTable>

Re: Hold Key Press Hotkey Script

Posted: Tue Feb 15, 2022 5:26 pm
by Evoked100
YoucefHam wrote:
Mon Feb 14, 2022 6:58 pm
Evoked100 wrote:
Sat Feb 12, 2022 5:10 pm
any have solution for this?
...
Hi there :D ,
try this, paste the code in cheat engine Address list

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>2441</ID>
      <Description>"While Key Pressed Down Do"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript Async="1">{$lua}
if syntaxcheck then return end
memrec.Async = true
[ENABLE]
-- Tutorial Step 4 Float Value
-- local AddressString = '["Tutorial-x86_64.exe"+0x325AA0]+0x818'
local AddressString = 'GameAssembly.dll+641AB4C'
local Address = getAddress( AddressString )
local key = VK_SHIFT  -- see for more https://wiki.cheatengine.org/index.php?title=Virtual-Key_Code
local DownValue = 5  -- Value while Key is Pressed Down
local UpValue = -1  -- Value while Key is Not Pressed

hk = createHotkey( function()
   while isKeyPressed( key ) do
     writeFloat( Address, DownValue ) -- Value while Key is Pressed Down
     sleep(10)
     if not isKeyPressed( key ) then
         writeFloat( Address, UpValue ) -- Value while Key is Not Pressed
     end
   end
   if not isKeyPressed( key ) then
         writeFloat( Address, UpValue ) -- Value while Key is Not Pressed
   end
end, key )

[DISABLE]
key = nil
AddressString = nil
Address = nil
if hk then
  hk.destroy()
  hk = nil
end

</AssemblerScript>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
thanks for help, im try test on night.
:wub: ^_^