LUA Timer to read changing values in memory

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Hereisme
Noobzor
Noobzor
Posts: 9
Joined: Thu Jan 02, 2020 5:55 am
Reputation: 0

Re: LUA Timer to read changing values in memory

Post by Hereisme » Sat Jan 04, 2020 1:26 pm

TheyCallMeTim13 wrote:
Fri Jan 03, 2020 11:03 am
Hereisme wrote:
Fri Jan 03, 2020 8:18 am
TheyCallMeTim13 wrote:
Fri Jan 03, 2020 12:06 am
You can use a script with a hotkey that toggles the script then in that script set the fonmap's "Visible" property to false if true and true if false (or a simple "fm.Visible = not fm.Visible") in the main section of the script so it runs when enabled and disabled. Not really sure thought, never messed with the D3D mutch.
Thank you so much for helping me with everything so far, i tried

Code: Select all

function keydown(virtualkey,char)
  if (virtualkey==VK_UP) then
  fontmap.destroy=true
  else
  fontmap=d3dhook_createFontmap(font)
end
end
as i can't find fontmap function in any cheat engine wiki page and even this sadly doesn't work..
Yeah, sometimes it's best to look in the "celua.txt" file in the CE folder, it has a list of functions and classes. Then I hit ctrl-f and enter what I'm looking for. The return from "createD3DHook" has a "OnKeyDown" property as well. And see if toggling the fontmap's "Visible" property works, you could create the fontmap then set visible to false and only show the text after the key is pressed. And in the code above you'll be creating a new fontmap every time a key is pressed except when it's the up key, so you'll want to move where you create the fontmap, or at least check for nil and create a font map only if it hasn't been created yet.
Thank you again. Can you explain to me that why using 2 D3D LUA scripts makes the virtual keys keydown function not working? on script A i have

Code: Select all

function keydown(virtualkey,char)
if (virtualkey==49) then
  hiddenbyusera=not hiddenbyusera
    ShowMenu1()
    return true
  end
  end
d3dhook_onKey(keydown)
on LUA script B i have

Code: Select all

function keydown1(virtualkey,char)
if (virtualkey==200) then
   hiddenbyuser=not hiddenbyuser
    ShowMenu()
    return true
  end


  setHighlighterToSelectedOption()

  return true
end
d3dhook_onKey(keydown1)
The scripts work fine when executed individually, but when same time then either one of those work or neither.

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1674
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 643

Re: LUA Timer to read changing values in memory

Post by TheyCallMeTim13 » Sat Jan 04, 2020 2:17 pm

Hereisme wrote:
Sat Jan 04, 2020 1:26 pm
...
Thank you again. Can you explain to me that why using 2 D3D LUA scripts makes the virtual keys keydown function not working? on script A i have

Code: Select all

function keydown(virtualkey,char)
if (virtualkey==49) then
  hiddenbyusera=not hiddenbyusera
    ShowMenu1()
    return true
  end
  end
d3dhook_onKey(keydown)
on LUA script B i have

Code: Select all

function keydown1(virtualkey,char)
if (virtualkey==200) then
   hiddenbyuser=not hiddenbyuser
    ShowMenu()
    return true
  end


  setHighlighterToSelectedOption()

  return true
end
d3dhook_onKey(keydown1)
The scripts work fine when executed individually, but when same time then either one of those work or neither.
Not sure why both would stop working, but I can say when you set the "OnKeyDown" function it only takes one function. So whatever one you set last will be the only one that gets called. Best I can say is maybe setting it twice causes it to call neither function. Try running the same code twice and see if it stops work then too. But ultimately you'll need to combine the two functions and check for the different keys, and you can add a check to see if a memory record is active to have one or the other only work if a memory record has been enabled.
CE wiki - Tutorials CE wiki - Auto Assembler Basics - CE wiki - Lua Basics If it's not a Personal Message don't PM me, use the forum. I ignore PMs that should be asked on the forum.

Post Reply

Who is online

Users browsing this forum: No registered users