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 


attach process on hotkey

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

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 3:45 pm    Post subject: attach process on hotkey Reply with quote

Sorry guys, but I'm really bad at scripting, but I was wondering if someone could help me with a LUA script that when i press f.ex. F11 then attaches the specified process?

Thanks in advance
Nick F. C.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 4:02 pm    Post subject: Reply with quote

Code:

function ProcOnHotkey()
 openProcess("example.exe") -- rename to your game/thing processor, or PID.
end
createHotkey(ProcOnHotkey, VK_F11)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 4:08 pm    Post subject: Reply with quote

Fast and working! Thanks ^^
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 4:12 pm    Post subject: Reply with quote

Could be faster but I had an to make this trainer work perfectly, and replace all the AoBs that I put in (only LUA Razz).
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 4:47 pm    Post subject: Reply with quote

you seem to get the hang of LUA then perhabs you can help me again.

I'm working on this little project where I'm trying to use speedhack on 3dmark, well, i use a script that descreases the speed of the process by 0.5x but the problem I'm having is that when it changes tests, it closes and opens the process which is causing my script to not function

The script I use is this:
Code:
function checkKeys(timer)
  local oldpid=getOpenedProcessID()
  openProcess( "3DMarkICFDemo.exe" )

  if getOpenedProcessID()~=oldpid then
    local mf=getMainForm()
    local cbSpeedhack=component_findComponentByName(mf, "cbSpeedhack")
    checkbox_setState(cbSpeedhack, cbUnchecked)
    speedhack_setSpeed(0.5)
  end
end

t=createTimer(nil)
timer_setInterval(t, 1500)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)


that was when I tried the F11 hotkey script you supplied, but in the meantime (when the process restarts) I get the speedhack could not inject error.

Maybe you could give me some tips on what I have to do?

again, thanks in advance!


Mother of hack wrote:
...and replace all the AoBs that I put in (only LUA Razz).


and i got absolutely nothing of that XD
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 5:06 pm    Post subject: Reply with quote

Can you set speedhack without Cheat Engine without it to give speedhack could not inject?
Well,
About the checking old PID and new PID.
Its not really easy to do.
Since everytime the function is being called, it gets the PID, and the opens the same processor again, and gets its PID again....
Unless it has like an X timer that Auto Closes it and Auto Open it.
like every seconds.
Then it would be possible.
Like setting another timer...that would get the PID after each for example 10 seconds +1 (it might take some time to open it..)
And then in the function compare between the new opened processor to the one that it has taken, and if it matches then return end, but if it don't then set speedhack to 0.5.

Well you can always let it keep open the processor constantly and set the speedhack to 0.5.
Checking PID aren't necessary unless it has multi processors.
And it just few more lines Smile

Code:
t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, check)
timer_setEnabled(t, true)
--
Opened = 0
--
oldpid=getOpenedProcessID()
function check()
openProcess( "calc.exe" )
local newPID=getOpenedProcessID()
 if oldPID~=newPID then
  opened = 1
  else
  opened = 0
  end
 end
 if (opened==1) then
 speedhack_setSpeed(0.5)
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 5:18 pm    Post subject: Reply with quote

I thank you for the tips and advice ^^ and as said I'm still a complete newbie to LUA

I have just tested the supplied script, but it doesn't attach the process :/
and I'm still to newb to figure out why not Smile

where you see the process name i get:
Code:
000017f0-???
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 5:21 pm    Post subject: Reply with quote

My bad tested it on calc xD
Code:
t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, check)
timer_setEnabled(t, true)
--
Opened = 0
--
oldpid=getOpenedProcessID()
function check()
openProcess( "3DMarkICFDemo.exe" )
local newPID=getOpenedProcessID()
 if oldPID~=newPID then
  opened = 1
  else
  opened = 0
  end
 end
 if (opened==1) then
 speedhack_setSpeed(0.5)
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 5:30 pm    Post subject: Reply with quote

lol thanks ^^ I spotted that and corrected it,

second and third run revealed a bummer.

i have now been trying a lot of things the last few days, basically with the same result, it is possible to set speedhack at the intro thing, but when it comes to the actual benchmark it gives me the dll inject error -_-

the script didn't activate speedhack but with speedhack binded to F1 at 0.5 it worked (at the intro).
as soon as the process restarted i got the dll inject error.

I gave it two runs, one where I enabled it during the intro and one where i waited till the benchmark and then enabled it.

oh well. but thanks ALOT with your help!!!
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 5:45 pm    Post subject: Reply with quote

Try this
Code:
t=createTimer(nil)
timer_setInterval(t, 1500)
timer_onTimer(t, check)
timer_setEnabled(t, true)

Opened = 0
--Well you can try this..
oldpid=getOpenedProcessID()
function check()
openProcess( "3DMarkICFDemo.exe" )
local newPID=getOpenedProcessID()
 if oldPID~=newPID then
  opened = 1
  else
  opened = 0
  end
 end
 if (opened==1) then
 mf=getMainForm()
 cbSpeedhack=component_findComponentByName(mf, "cbSpeedhack")
 setProperty(cbSpeedhack, "Checked", 0)
 speedhack_setSpeed(0.5)
end

This 'disables' speedhack.
and then setting speedhack to 0.5

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 5:57 pm    Post subject: Reply with quote

I'm getting the longest balls from this ^^

okay, It's not starting the speedhack automatically, okay i can use the hotkey.
BUT... second run, the actual benchmark, I'm either having no luck using the hotkey for setting speedhack, and when enabeling it (another hotkey) it gives me the inject speedhhack dll error once again.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 5:59 pm    Post subject: Reply with quote

Well if u got an address we might use it as a checker?
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 6:02 pm    Post subject: Reply with quote

Mother of hack wrote:
Well if u got an address we might use it as a checker?


Sorry for me being ignorant, but what address? I can't really start the scanner since the window looses focus and terminates the process :/
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Mar 25, 2013 6:13 pm    Post subject: Reply with quote

Oh...
Well we could use alternative.
Can u give me download url?

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
nickfc
How do I cheat?
Reputation: 0

Joined: 25 Mar 2013
Posts: 8

PostPosted: Mon Mar 25, 2013 6:17 pm    Post subject: Reply with quote

futuremark com/support/downloads
(cant post urls yet, so removed dot before dotcom)
I use the steam version, but there shouldn't be any difference ^^
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