Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


help with pointers in lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
johnny_m90
How do I cheat?
Reputation: 0

Joined: 06 Oct 2017
Posts: 8

PostPosted: Tue Oct 10, 2017 10:21 am    Post subject: help with pointers in lua Reply with quote

Hey!

Been trying to get a pointer to work in lua and it simply isnt working for me. This is the code i'm using to get the value of the pointer:

local value = readInteger("[[[[trove.exe+00D3B680] +1C] +3C] +1F4] +134")
print(value)

It prints nothing back, i've tried lots of things so i would really appreciate the help.

I made it work, but now i've come to another problem! So i'm trying to make the script press Q when the hp goes below 6k. It does write Q when i'm in the script itself but when i change to the game it does nothing.

Here's the lua code:

Code:
function HPcheck()
hp = readInteger("[[[[trove.exe+00D3B680] +1C] +3C] +1F4] +134")
         if hp < 6000 then
            doKeyPress(VK_KEY_Q)
         end
end

timer1 = createTimer()
timer_setInterval(timer1, 100)
timer_onTimer(timer1, HPcheck)
timer_setEnabled(timer1, true)
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Tue Oct 10, 2017 1:01 pm    Post subject: Reply with quote

Try VK_Q I don't believe VK_KEY_Q is defined (VK stands for Virtual Key after all so VK_KEY would be Virtual Key Key...).
Back to top
View user's profile Send private message
johnny_m90
How do I cheat?
Reputation: 0

Joined: 06 Oct 2017
Posts: 8

PostPosted: Tue Oct 10, 2017 1:05 pm    Post subject: Reply with quote

FreeER wrote:
Try VK_Q I don't believe VK_KEY_Q is defined (VK stands for Virtual Key after all so VK_KEY would be Virtual Key Key...).


It does the exact same thing, thanks for the answer though

I also tried doPressKey("Q") with the same result
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Tue Oct 10, 2017 1:19 pm    Post subject: Reply with quote

This code prints Q's constantly, so that works
Code:

function HPcheck()
hp = 5999
         if hp < 6000 then
            doKeyPress(VK_Q)
         end
end

timer1 = createTimer()
timer1.Interval=100
timer1.Timer=HPcheck
timer1.Enabled=true


Perhaps the game doesn't handle the keyboard input like this.

Or the hp pointer is never < 6000

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
johnny_m90
How do I cheat?
Reputation: 0

Joined: 06 Oct 2017
Posts: 8

PostPosted: Tue Oct 10, 2017 1:22 pm    Post subject: Reply with quote

Dark Byte wrote:
This code prints Q's constantly, so that works
Code:

function HPcheck()
hp = 5999
         if hp < 6000 then
            doKeyPress(VK_Q)
         end
end

timer1 = createTimer()
timer1.Interval=100
timer1.Timer=HPcheck
timer1.Enabled=true


Perhaps the game doesn't handle the keyboard input like this.

Or the hp pointer is never < 6000


It only writes Q's when the hp is under 6k but it does not use the potion which is on the Q button in-game. I've tried it in windowed and fullscreen in case it made any difference, but it didnt.

is there any way to trigger the event of using a potion using the assembly?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Tue Oct 10, 2017 2:01 pm    Post subject: Reply with quote

try
Code:

keyDown(VK_Q)
sleep(1000)
keyUp(VK_Q)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
johnny_m90
How do I cheat?
Reputation: 0

Joined: 06 Oct 2017
Posts: 8

PostPosted: Wed Oct 11, 2017 8:09 am    Post subject: Reply with quote

Dark Byte wrote:
try
Code:

keyDown(VK_Q)
sleep(1000)
keyUp(VK_Q)

Havent tried it, but i noticed the pointer isnt trustworthy. Gonna go back to getting a stable pointer for now.

Thanks for the help! Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites