Quote:
Originally Posted by n0futur3
I would add a timer function via AdLibRegister(calls a method in a certain time interval), which sets a bool to false when a certain time is reached. Before any action, always check the bool. So in case the time limit is reached, the bot 'drops' through the main loop and starts again.
Code:
Global $stuck = 0
Global $timer
Func CheckStuck()
If TimerDiff($timer) > 1500000 Then $stuck = 1
EndFunc
Func Mainloop()
AdLibRegister("CheckStuck")
$stuck = 0
Local $timer = TimerInit()
...
If $stuck = 0 Then FightGroup1()
If $stuck = 0 Then FightGroup2()
...
If $stuck = 0 Then OpenChest()
AdLibUnRegister("CheckStuck")
EndFunc
|
A Better solution would be not to have the timer globally and checks via "adlibregister", instead use it in your "fightgroup" function, so every fight has its own timer.
when the timeout is hit, set $stuck =1 and the other fights shouldnt be performed, at least thats what i think it does (dont know the source-code)
That would be the way i try to solve the issue (overall i dont like functions that get called every xxx MilliSeconds, this is just a way to solve a bad programming, IMO)
Adlibregister can make problems on low spec pc, espacially when you have multiple clients / bots running
_
Greetings
mhaendler