View previous topic :: View next topic |
Author |
Message |
ta_trainer Advanced Cheater Reputation: 0
Joined: 24 Dec 2006 Posts: 76
|
Posted: Mon Mar 23, 2015 8:07 pm Post subject: (solved) doKeyPress pauses/freezes the game for few seconds! |
|
|
Hi
I had this cool idea for my trainer to "speak out" the in game hack events.
example, if enemy upgraded his weapon. a voice says "enemy is upgrading weapons"
I am using "VoiceAttack" program for text to speech, each voice event is triggered by a hotkey.
this is were doKeyPress come into picture. Lua will do doKeyPress("K") and VoiceAttack will capture it and speak out the event associated with "K"
unfortunately, doKeyPress seems to pause the game for few seconds every time is being executed.
when I remove it, my programs runs flawlessly.
note: these events are not aggressive, one every minute or so
does anyone have any idea why the freeze?
or a better question.
do you have a better way to make Lua do text to speech?
thanks
Last edited by ta_trainer on Mon Mar 23, 2015 9:01 pm; edited 1 time in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Mar 23, 2015 8:23 pm Post subject: |
|
|
Is it pausing just long enough to finish speaking? Is this task not asynchronous?
|
|
Back to top |
|
|
ta_trainer Advanced Cheater Reputation: 0
Joined: 24 Dec 2006 Posts: 76
|
Posted: Mon Mar 23, 2015 8:31 pm Post subject: |
|
|
Zanzer wrote: | Is it pausing just long enough to finish speaking? Is this task not asynchronous? |
This does not apply here because the voice comes out from VoiceAttack software which is a separate process from CE
CE simulates key press and VoiceAttack captures it
SOLVED:
take out the doKeyPress in a seperate thread then terminate it
so, in Lua, call doKeyPress_thread instead of doKeyPress
Code: | function doKeyPress_thread(key)
globalkey = key
tk=createTimer(nil);
timer_setInterval(tk,100)
timer_onTimer(tk,keythread)
end
function keythread(tk)
doKeyPress(globalkey)
object_destroy(tk)
end |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Mar 24, 2015 2:41 am Post subject: |
|
|
that shouldn't solve it as a timer is not a thread. it still runs inside the main thread, and destroying tk won't stop the current thread. It just stops it from calling it again
perhaps your issue is somewhere else (e. g a loop inside the main thread)
_________________
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 |
|
|
ta_trainer Advanced Cheater Reputation: 0
Joined: 24 Dec 2006 Posts: 76
|
Posted: Tue Mar 24, 2015 12:12 pm Post subject: |
|
|
Dark Byte wrote: | that shouldn't solve it as a timer is not a thread. it still runs inside the main thread, and destroying tk won't stop the current thread. It just stops it from calling it again
perhaps your issue is somewhere else (e. g a loop inside the main thread) |
thanks for the input, actually, the script has no loops but breakpoints like this:
Code: | BuildingUpgrade = 0x12345678
debug_setBreakpoint(BuildingUpgrade)
function debugger_onBreakpoint()
if (EIP == BuildingUpgrade) then
if (the enemy is upgrading ...etc) then
doKeyPress("D") --this key will invoke VoiceAttach to do text to speech "Warning, enemy is upgrading...etc"
end
return 1
end
end |
The doPressKey being in BP inline with the code flow is slowing it down, even through it is not frequently matched up.
I see your point about not being in a separate thread, but the proposed solution seemed to work.
|
|
Back to top |
|
|
|