View previous topic :: View next topic |
Author |
Message |
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Tue Feb 18, 2014 12:06 pm Post subject: LUA: please help me, maybe I'm only sleeping :oops: |
|
|
Hi!!
I have "stolen" some code here in the forum...... ehm.....
My purpose is:
INSIDE a game I press an hotkey performing the follows:
-open the process of the game in CE
-immediately pause it
-auto popup in CE.
I have found this LUA code:
Code: |
function func(sender)
print("Hello")
return true
end
hkey=createHotkey("func",VK_A)
generichotkey_onHotkey(hkey,func)
|
who executing perform his job.....
So I have think: OK, only a few modifications and I'll be ready:
Code: |
function func(sender)
print("Hello")
mygame=getForegroundProcess()
openProcess(mygame)
pause()
return true
end
hkey=createHotkey("func",VK_A)
generichotkey_onHotkey(hkey,func)
|
But it does NOT works
Maybe someone may be so kind to:
a) completing the code for me so it is immediatelly working
b) let me know why I'm so stupid that after many hours of research I'm still not able in fixing by myself?
Please.......
Danrevella
p.s. I have many problems in reading in english, and maybe I still don't understand what LUA exactelly is: a language,a script propcessor,or what.[/code] |
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Tue Feb 18, 2014 7:28 pm Post subject: Re: LUA: please help me, maybe I'm only sleeping :oops: |
|
|
danrevella wrote: | a) completing the code for me so it is immediatelly working | Closest thing I could get: CE is drawn over my test application, but does NOT have window focus. Code: | function ShowCE(sender)
print("Hello");
local mygame=getForegroundProcess();
openProcess(mygame);
pause();
getMainForm().setFocus();
return true;
end
if (hkey==nil) then
hkey.destroy();
end
hkey=createHotkey(ShowCE,VK_F2);
hkey.setOnHotkey(ShowCE); |
danrevella wrote: | b) let me know why I'm so stupid that after many hours of research I'm still not able in fixing by myself? | Look at main.lua (text file) if that's not already done.
danrevella wrote: | I still don't understand what LUA exactelly is: a language,a script propcessor,or what. | LUA is a language. The script processor is called...... the lua interpreter/engine/VM (virtual machine). On other words it doesn't really have a name afaik. _________________
DO NOT PM me if you want help on making/fixing/using a hack. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Wed Feb 19, 2014 5:07 am Post subject: |
|
|
Many thanks, now I'll go and study better,
BTW the script still does not work for me:
Code: | Error:[string "function ShowCE(sender)..."]:14: attempt to index global 'hkey' (a nil value) |
Where is my mistake? |
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Wed Feb 19, 2014 5:15 am Post subject: |
|
|
It's just me being a complete retard: Code: | if (hkey==nil) then
hkey.destroy();
end |
should be: Code: | if (hkey~=nil) then
hkey.destroy();
hkey=nil;
end |
...That's what you get for making post-time changes. _________________
DO NOT PM me if you want help on making/fixing/using a hack. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Wed Feb 19, 2014 6:16 am Post subject: |
|
|
Now the code works with no error, BTW does not get his goal: in fact i run it, go to my game and inside the game i press F2, but what i get is that CE now have open "cheatengine_x86_64exe" .
The code now appears as follows:
Code: | function ShowCE(sender)
print("Hello");
local mygame=getForegroundProcess();
openProcess(mygame);
pause();
getMainForm().setFocus();
return true;
end
if (hkey~=nil) then
hkey.destroy();
hkey=nil;
end
hkey=createHotkey(ShowCE,VK_F2);
hkey.setOnHotkey(ShowCE); |
Thanks! |
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Wed Feb 19, 2014 6:31 am Post subject: |
|
|
I couldn't reproduce your problem.
The only possible cause I can think of is that you hold the hotkey for too long, activating it twice. First activation gives focus to CE (doesn't happen on my end), second activation targets CE.
Try to increase CE settings->hotkeys->delay betweens reactivating hotkeys. _________________
DO NOT PM me if you want help on making/fixing/using a hack. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Wed Feb 19, 2014 7:36 am Post subject: |
|
|
Gniarf wrote: | I couldn't reproduce your problem.
The only possible cause I can think of is that you hold the hotkey for too long, activating it twice. First activation gives focus to CE (doesn't happen on my end), second activation targets CE.
Try to increase CE settings->hotkeys->delay betweens reactivating hotkeys. |
You were right...
Many thanks now I have a good base to start my study...
Unfortunelly seems to be the doesn't exist LUA documentation in italian...
But still a question: is it possible inside LUA call the standard win32api in any mode? |
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Thu Feb 20, 2014 5:24 am Post subject: |
|
|
Thanks for your suggestion, now finally I have got a working script really usefull (for me at least..)
Code: | first_time=true;
function togglePause()
if first_time then
local mygame=getForegroundProcess();
--print(mygame);
openProcess(mygame);
pause()
first_time=nil
end
if processPaused then unpause()
else pause()
getMainForm().setFocus();
end
processPaused = not processPaused
end
if pauseHotkey~=nil then
pauseHotkey.destroy();
pauseHotkey=nil
end
pauseHotkey = createHotkey(togglePause,VK_F12)
|
It performs the follow:
-)the very first time that hotkey is invocated, it get the pid of the game actually in foreground, then open it in CE and immediatelly pause it.
-)passing control to CE
-)from this moment hotkey is now a toggle pause/unpause the game.
The only way still does not works very well is when I try to bring back CE.
Does exist a better (hard) way to bring back to foremost CE?
Thanks for all the help. |
|
Back to top |
|
|
|