Help with TimerInit and TimerDiff

11/14/2016 18:33 LiveLong23#1
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
11/15/2016 08:15 Moneypulation#2
I don't really get your problem. Do you wanna make a skill combo or cast a skill whenever it is ready?
11/15/2016 14:28 LiveLong23#3
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.
11/15/2016 18:35 Moneypulation#4
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

11/15/2016 22:02 LiveLong23#5
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

[Only registered and activated users can see links. Click Here To Register...]
11/16/2016 08:14 WJNeeson#6
PHP Code:
If (TimerDiff($Timers[$i] > $Cooldowns[$i]) Then 
missing something? something useless there?
11/16/2016 08:47 Lawliet#7
PHP Code:
If (TimerDiff($Timers[$i] > $Cooldowns[$i])) Then 
11/16/2016 11:03 Moneypulation#8
Quote:
Originally Posted by LiveLong23 View Post
I got some error

[Only registered and activated users can see links. Click Here To Register...]
Oh, I meant

PHP Code:
If ( TimerDiff($Timers[$i]) > $Cooldowns[$i] ) Then 
of course^^
11/16/2016 16:11 Lawliet#9
ups, sorry :D