evilelf Posted December 12, 2009 Share Posted December 12, 2009 It's my first time using mod() & AdlibEnable(), so please be nice but to the point. My Code works but I just cant figure out the timing. _EP should be called ever 1sec (Right?) $FirstAttack = true $time =0 Func WeWait() WinActivate($Game) While $Settings1 = 1 Sleep(10) WEnd AdlibEnable("_EP", 1000) ; - Dont worry we get here! ~ I guess the Start ~ EndFunc Func _EP() if($FirstAttack = true) Then ; ControlSend($Game, "", "", "{1}") ;Skill ControlSend($Game, "", "", "{2}") ;Skill Sleep(Random(2000,2100)) ControlSend($Game, "", "", "{3}") ;Skill Sleep(Random(1000,1100)) $FirstAttack = False EndIf ; If Mod($time, 24) = 0 Then DisableStopCheck() ControlSend($Game, "", "", "{1}") ; Recharge 24 For This! EndIf ; - Dont worry about this $Settings1 = 1 $time = $time +1 if($time =40) Then $time =0 EndIf EndFunc Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 12, 2009 Share Posted December 12, 2009 it should be called every one second, I believe, but only one second after it finishes? I don't use adlib to much, but I think that it has to complete before it'll start the timer again. I'm just guessing. Try it without the sleeps in _EP() We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
evilelf Posted December 12, 2009 Author Share Posted December 12, 2009 (edited) Really its this part im stuck at. If Mod($time, 24) = 0 Then DisableStopCheck() ControlSend($Game, "", "", "{1}") ; Recharge 24 For This! EndIf With Adlib Im calling it every 1second, but with my $time = $time +1 I thought of maybe a timer/counter. so after key 1 is pressed it would wait then press that key again after recharge or temp wait is over. I cant seem to get this part to work. Keep in mind i want to add onto this, more skills maybe 24 at once... Edited December 12, 2009 by evilelf Link to comment Share on other sites More sharing options...
Richard Robertson Posted December 12, 2009 Share Posted December 12, 2009 You shouldn't have sleep in the Adlib functions. That's just going to screw it up because now the function is taking longer than the timer. This means that AutoIt wants to call the function again before the first one finished. You'll end up with a stack of unfinished functions. Change it to a loop instead. $FirstAttack = true $time =0 WinActivate($Game) While True ; fix this so the script can actually end Sleep(1000) if($FirstAttack = true) Then ControlSend($Game, "", "", "{1}") ;Skill ControlSend($Game, "", "", "{2}") ;Skill Sleep(Random(2000,2100)) ControlSend($Game, "", "", "{3}") ;Skill Sleep(Random(1000,1100)) $FirstAttack = False EndIf If Mod($time, 24) = 0 Then DisableStopCheck() ControlSend($Game, "", "", "{1}") ; Recharge 24 For This! EndIf $time = $time +1 if($time =40) Then $time =0 EndIf WEnd Link to comment Share on other sites More sharing options...
evilelf Posted December 12, 2009 Author Share Posted December 12, 2009 (edited) Heres what im going off of,im trying to learn this but there some i just dont understand.This code works but I want to understand all of it, and make my own expandcollapse popupAdlibEnable("cast",1000) ;casting engine Func cast() if NOT $Paused Then If $tick = 30 OR $tick = 56 OR $tick = 69 Then EnableStopCheck() ; try to finish if blocked EndIf If Mod($tick, 24) = 0 Then ControlSend($client, "", "", "{1}") EndIf If Mod($tick -2, 24) = 0 Then ControlSend($client, "", "", "{2}") EndIf If Mod($tick -4, 18) = 0 Then ControlSend($client, "", "", "{3}") EndIf If $tick = 8 OR $tick = 44 Then ControlSend($client, "", "", "{5}") EndIf If $tick = 9 OR $tick = 45 Then ControlSend($client, "", "", "{4}") EndIf If $tick = 12 OR $tick = 42 OR $tick = 62 Then ControlSend($client, "", "", "{6}") EndIf if($startAttack = true) AND ($tick = 13 OR $tick = 52)Then $startAttack = False ;start matching Attacks $Attack = True EndIf if $Attack Then If ($tick = 16) OR ($tick = 52) Then ControlSend($client, "", "", "{7}") EndIf If ($tick = 13) Then ControlSend($client, "", "", "{8}") EndIf If ($tick = 31) Then ControlSend($client, "", "", "{8}") EndIf EndIf $tick = $tick +1 if($tick =72) Then $tick =0 EndIf EndIf EndFuncEdit:I just did it my way, Ill just find the highest number& have it reset to zero. Take for example:" If $time = 20 OR 40 Then "expandcollapse popupHotKeySet("{Delete}","_ok") SmartBehavior() Func SmartBehavior() While 1 ;Checks for user-input $msg = GUIGetMsg() If $msg = -3 Then Exit If $msg = $Button_Start Then WeWait() If $msg = $Button_Exit Then WeStop() WEnd EndFunc Func WeWait() WinActivate($Game) While $Settings1 = 1 Sleep(10) WEnd AdlibEnable("_EP", 1000) ;_EchoPerma() EndFunc Func _EP() if($FirstAttack = true) Then ControlSend($Game, "", "", "{1}") ;Skill ControlSend($Game, "", "", "{2}") ;Skill Sleep(Random(2000,2100)) ControlSend($Game, "", "", "{3}") ;Skill Sleep(Random(1000,1100)) $FirstAttack = False EndIf If $time = 20 Then ControlSend($Game, "", "", "{2}") EndIf $time = $time + 1 if($time =40) Then $time =0 EndIf EndFunc Func _ok() $Settings1 = 2 EndFuncMy work n the end, It works butI know theres something better.Func _EP() if($FirstAttack = true) Then ControlSend($Game, "", "", "{1}") ;Skill Sleep(Random(10,30)) ControlSend($Game, "", "", "{2}") ;Skill Sleep(Random(2000,2100)) ControlSend($Game, "", "", "{3}") ;Skill Sleep(Random(1000,1100)) $FirstAttack = False EndIf If ($time = 19) Then ControlSend($Game, "", "", "{2}") ; Recharge 20 For This! EndIf If ($time = 42) Then ControlSend($Game, "", "", "{1}") ; Recharge 20 For This! Sleep(Random(10,30)) ControlSend($Game, "", "", "{2}") ; Recharge 20 For This! Sleep(Random(2000,2100)) ControlSend($Game, "", "", "{3}") ;Skill Sleep(Random(1000,1100)) EndIf $time = $time + 1 ToolTip($time) if($time =43) Then ; Works 43 90% $time =0 EndIf EndFunc Edited December 13, 2009 by evilelf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now