Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 19:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with TimerInit and TimerDiff

Discussion on Help with TimerInit and TimerDiff within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2014
Posts: 43
Received Thanks: 1
Help with TimerInit and TimerDiff

Hello

I have script that i can't get it to work.
My script need to do something like this :

1.Send keys
2.Cast is time for sleep
3.Now i need to setup skills to make cooldown, not cast but i need to set 1 more variable like $cooldown[7] = [23333,30000,............]

So Cast skills, wait for cooldown, when skill is ready cast it again and wait to cooldown again.

It's for bot for mmo games if that will be simpler for help.

Code:
Global $keys[7] = [3,4,5,6,7,8,9], $run = False
Global $cast[7] = [2000,1400,2999,1400,2300,3245,3040]

While 1
	Sleep(100)
WEnd

Func _startSend()
	
	While $run
		
		For $i = 0 To UBound($keys)-1
			For $a = 0 To UBound($cast)-1
			     Send($keys[$i]) ; send keys
			     Sleep($cast[$a]) ; delay between send
                             ; when fire up all skills wait for cooldown
                             ;fire them again
			Next
		Next
		
	WEnd
	
EndFunc
LiveLong23 is offline  
Old 11/15/2016, 08:15   #2


 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,495
Received Thanks: 1,769
I don't really get your problem. Do you wanna make a skill combo or cast a skill whenever it is ready?
Moneypulation is offline  
Old 11/15/2016, 14:28   #3
 
elite*gold: 0
Join Date: Jan 2014
Posts: 43
Received Thanks: 1
Quote:
Originally Posted by Moneypulation View Post
I don't really get your problem. Do you wanna make a skill combo or cast a skill whenever it is ready?
Cast skill whenewer is ready.
LiveLong23 is offline  
Old 11/15/2016, 18:35   #4


 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,495
Received Thanks: 1,769
Quote:
Originally Posted by LiveLong23 View Post
Cast skill whenewer is ready.
Then try something like this:

PHP Code:
Global $Keys[7] = [ ... ]
Global 
$Cooldowns[7] = [ ... ]
Global 
$Timers[7]
Global 
$run False

For $i 0 To UBound($Timers) - 1
    $Timers
[$i] = TimerInit()
Next

while ($run)
{
    For 
$i 0 To UBound($Timers) - 1
        
If (TimerDiff($Timers[$i] > $Cooldowns[$i]) Then
            Send
($Keys[$i])
            
$Timers[$i] = TimerInit()
            ; 
You should probably sleep the channel time of the skill here
        
EndIf
    
Next
    
add a short sleep here to reduce cpu usage

Moneypulation is offline  
Thanks
1 User
Old 11/15/2016, 22:02   #5
 
elite*gold: 0
Join Date: Jan 2014
Posts: 43
Received Thanks: 1
Quote:
Originally Posted by Moneypulation View Post
Then try something like this:

PHP Code:
Global $Keys[7] = [ ... ]
Global 
$Cooldowns[7] = [ ... ]
Global 
$Timers[7]
Global 
$run False

For $i 0 To UBound($Timers) - 1
    $Timers
[$i] = TimerInit()
Next

while ($run)
{
    For 
$i 0 To UBound($Timers) - 1
        
If (TimerDiff($Timers[$i] > $Cooldowns[$i]) Then
            Send
($Keys[$i])
            
$Timers[$i] = TimerInit()
            ; 
You should probably sleep the channel time of the skill here
        
EndIf
    
Next
    
add a short sleep here to reduce cpu usage

I got some error

LiveLong23 is offline  
Old 11/16/2016, 08:14   #6
 
WJNeeson's Avatar
 
elite*gold: 1445
Join Date: Sep 2011
Posts: 199
Received Thanks: 177
PHP Code:
If (TimerDiff($Timers[$i] > $Cooldowns[$i]) Then 
missing something? something useless there?
WJNeeson is offline  
Old 11/16/2016, 08:47   #7


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
PHP Code:
If (TimerDiff($Timers[$i] > $Cooldowns[$i])) Then 
Lawliet is offline  
Old 11/16/2016, 11:03   #8


 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,495
Received Thanks: 1,769
Quote:
Originally Posted by LiveLong23 View Post
I got some error

Oh, I meant

PHP Code:
If ( TimerDiff($Timers[$i]) > $Cooldowns[$i] ) Then 
of course^^
Moneypulation is offline  
Thanks
2 Users
Old 11/16/2016, 16:11   #9


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
ups, sorry
Lawliet is offline  
Reply


Similar Threads Similar Threads
Timerdiff TimerInit Anwendungsproblem
07/04/2011 - AutoIt - 8 Replies
Edit
TimerInit, TimerDiff
01/01/2010 - AutoIt - 7 Replies
Hallo ich brauchte mal ne kleine hilfe. Ich bin dabei einen Angelbot zu schreiben und würde gern eine Zeitbegrenzung in die Angelrauszieh Funktion machen. Ich verstehe aber das mit TimerDiff und TimerInit nicht wirklich, wäre toll wenn jemand mir meine Funktion so einstellen könnte, dass nach 15sec die Scheife verlassen wird und es mir erklähren könnte. Func _Angelraus() Do Sleep (50) $fischblase = PixelSearch(336, 52, 400, 95, 0xFcF8Fc, 5) Until Not @error Sleep (...



All times are GMT +2. The time now is 19:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.