verry nice work! to improve it you could add a solution what happens when the character is dead!
Func InitLoading($deadLock = 15000, $anyFunc = "", $delay = 10) $t = TimerInit() While GetControlledCharacter() <> 0 If $anyFunc <> "" Then Call($anyFunc) If TimerDiff($t) > $deadLock Then Return -1 Sleep($delay) WEnd Return 1 EndFunc ;==>InitLoading Func WaitLoading($deadLock = 15000) $t = TimerInit() While GetControlledCharacter() == 0 If TimerDiff($t) > $deadLock Then Return -1 Sleep(10) WEnd Return 1 EndFunc ;==>WaitLoading Func GetControlledCharacter() $x = _MemoryRead($cliContext, $hProcess, 'dword') + 0x38 Return _MemoryRead($x, $hProcess, 'dword') EndFunc ;==>GetControlledCharacter
Figured you would have to read memory. Thanks alot. This will help me immensely.Quote:
the cliContext can be grabbed from my autoupdater sample.Code:Func InitLoading($deadLock = 15000, $anyFunc = "", $delay = 10) $t = TimerInit() While GetControlledCharacter() <> 0 If $anyFunc <> "" Then Call($anyFunc) If TimerDiff($t) > $deadLock Then Return -1 Sleep($delay) WEnd Return 1 EndFunc ;==>InitLoading Func WaitLoading($deadLock = 15000) $t = TimerInit() While GetControlledCharacter() == 0 If TimerDiff($t) > $deadLock Then Return -1 Sleep(10) WEnd Return 1 EndFunc ;==>WaitLoading Func GetControlledCharacter() $x = _MemoryRead($cliContext, $hProcess, 'dword') + 0x38 Return _MemoryRead($x, $hProcess, 'dword') EndFunc ;==>GetControlledCharacter