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 


Press key in a condition.

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

Joined: 12 Mar 2016
Posts: 7

PostPosted: Mon Apr 04, 2016 12:36 pm    Post subject: Press key in a condition. Reply with quote

Hello, can you guys help me to port this code to run in cheat engine?

$memvalue=memvalue (value in a specific address)
if $memvalue == "xyz" {
press somekey};


I'll put manually the memory location in the var. I just need CE press a key when the address get a specific value
Back to top
View user's profile Send private message
Derpicus
Newbie cheater
Reputation: 1

Joined: 30 Mar 2016
Posts: 15

PostPosted: Mon Apr 04, 2016 12:38 pm    Post subject: Re: Press key in a condition. Reply with quote

astromite wrote:
Hello, can you guys help me to port this code to run in cheat engine?

$memvalue=memvalue (value in a specific address)
if $memvalue == "xyz" {
press somekey};


I'll put manually the memory location in the var. I just need CE press a key when the address get a specific value

Are you looking to send keys with focus, no focus, or? Also, is it an application that uses direct-x, or is it something else?
Back to top
View user's profile Send private message
astromite
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 7

PostPosted: Mon Apr 04, 2016 12:40 pm    Post subject: Reply with quote

No focus, I want to disable the "function key" of my keyboard. (It's like a caps lock key).
Back to top
View user's profile Send private message
astromite
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 7

PostPosted: Mon Apr 04, 2016 11:32 pm    Post subject: Reply with quote

Well, searching in the forum, I found some codes that can help me.

The last and definitive question is:
how to keypress?

I need a combination of lctrl lshit and esc. Only this now.
I want to send this to Windows, not a specific window/application.
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Tue Apr 05, 2016 4:57 am    Post subject: Reply with quote

astromite wrote:
Well, searching in the forum, I found some codes that can help me.

The last and definitive question is:
how to keypress?

I need a combination of lctrl lshit and esc. Only this now.
I want to send this to Windows, not a specific window/application.


Maybe this?
Code:
doKeyPress(key)
Back to top
View user's profile Send private message
astromite
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 7

PostPosted: Tue Apr 05, 2016 9:59 am    Post subject: Reply with quote

Works here! Thank you guys!
Back to top
View user's profile Send private message
astromite
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 7

PostPosted: Thu Apr 07, 2016 11:32 pm    Post subject: Reply with quote

Sup guys.
I had another question, my code works and all but I run it with:
table>show cheat table>execute script.

There is a hotkey or a way to set a key to run it?
Also, it's possible to stop the execution of the script instead of waiting all the proccess end?

Thanks in advance.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Fri Apr 08, 2016 9:58 am    Post subject: Reply with quote

Code:
local derp = function()
  -- your script you want to run
end
derpHK = createHotkey(derp, VK_F2)  -- see defines.lua for all keycodes
derpHK.DelayBetweenActivate = 1000  -- optional

-- to destroy the hotkey:
derpHK.destroy()
derpHK = nil


In what context is the script running? If you have a timer, you can set the Enabled property to false to temporarily disable it. If you don't plan on enabling it ever again, you should call its destroy() function to clean up the memory.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
astromite
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 7

PostPosted: Fri Apr 08, 2016 12:04 pm    Post subject: Reply with quote

Thank you for your response.
The context is: spamming skills/attacks and auto heal in certains enemys. , but when the potz is over, I need to stop to get more. But I only die, because this is the condition to stop running the script (while hp => 1)

Also, I tried what you said here but it doesn't work, I'm dumb or something like?

I made this ways:

local rpt = function()
//code//
end
rptHK = createHotkey(rpt,VK_F10)
rptHK.destroy()
rptHK = nil

I executed it in that way I said (table>show cheat table>execute script).
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Fri Apr 08, 2016 12:57 pm    Post subject: Reply with quote

astromite wrote:
spamming skills/attacks and auto heal in certains enemys. , but when the potz is over, I need to stop to get more. But I only die, because this is the condition to stop running the script (while hp => 1)

This makes no sense. What is your script even suppose to do? It seems significantly different from what you said in your first post.


If you destroy the timer right after you make it, then it's not going to exist when you want to use it. The only reason why I had those last two lines of code in there is to show you how to destroy it. That's why I put "to destroy the hotkey:" above it.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Apr 08, 2016 6:09 pm    Post subject: Reply with quote

Code:
mytimer=createTimer(nil, false)
mytimer.Interval=1
mytimer.OnTimer=function(timer)
  if hp >= 1 then
    -- do whatever
  else
    timer.Enabled = false
  end
end
createHotkey(function()
  mytimer.Enabled = not mytimer.Enabled
end, VK_F10)
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 Lua Scripting 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