Originally Posted by
zys924
There is only one defects for endscene hook. When the game window is minimized, the tick will be freezed so your bot logic is also stopped.
You should not use EndScene for keeping your bot updated. Instead, you should use the main thread's looped function or a function inside this loop. This applies for all games for the reason above. In WoW, the looped function is named SchedulerThreadProcProcess (0x004701E0 16357 x86 non-rebased), and it is called like so:
Code:
while ( !SchedulerThreadProcProcess(v3, v1, (int)&a1) )
;
WoW also has some nice timer event functions you can work with. Try EventSetTimer. You specify a __cdecl callback function and interval (milliseconds). The function will be executed from the main thread, when the interval is hit. This is a good way to loop your bot's "refresh" code in the main thread, however the first call to EventSetTimer must also be from the main thread (NOT from a SchedulerThreadProcProcess hook, it does not work).
Code:
typedef BOOL( __cdecl *EventSetTimer_t )( UINT uInterval, void( __cdecl *pCallbackFunction )( void ), UINT unk1 );
For example:
Code:
void __cdecl Pulse()
{
Delegates::EventSetTimer( 10, Pulse, 0 );
}
It is nice not having to maintain function call intervals like you normally would, I would strongly recommend using this function as you can.