Jump to content

Script Crashes on _Timer_KillTimer


Recommended Posts

hi.

The script runs fine if I execute it in SciTE editor provided by going tools -> Go. When I execute the script by clicking on the .au3 file or going into runscript -> timersscript.au3, it crashes whenever I execute a _Timer_KillTimer command.

#Include <Timers.au3>
#include <misc.au3>
Global $sapi = ObjCreate("sapi.SpVoice")
global $ray_1 = 0 , $ray_2 = 0 , $ray_3 = 0, $ray_4 = 0 , $ray_5 = 0 , $ray_6 = 0 , $F3_1 = 0, $F4_1 = 0, $ray = 0, $end = 0 , $ray_wait = 0
global $ray_1_1, $ray_2_1, $ray_3_1, $ray_4_1, $ray_5_1, $ray_6_1
global $ray_1_2 = "{NUMPADDIV}" , $ray_2_2 = "{HOME}" , $ray_3_2 = "{PGUP}" , $ray_4_2 = "{DEL}" , $ray_5_2 = "{END}" , $ray_6_2 = "{PGDN}"
$dll = DllOpen("user32.dll")
HotKeySet("v" , "_grave")
WinActivate ("Darkfall Online")

    
    while 1
        sleep(100)                  
    WEnd

        func _grave()                       
    HotKeySet("v")                                                                                  
    while 1
    If $ray_1 == 1 And $ray_2 == 1 And $ray_3 == 1 And $ray_4 == 1 And $ray_5 == 1 And $ray_6 == 1 Then
        $sapi.speak("No rays")
        $ray_wait = 1
        HotKeySet("v" , "_grave")
        ExitLoop
            ElseIf  $ray_1 == 0 Then
                send($ray_1_2)
                $ray = 1
            ElseIf $ray_2 == 0 Then
                    Send($ray_2_2)
                    
                    $ray = 2
                ElseIf $ray_3 == 0 Then
                    Send($ray_3_2)
                    
                    $ray = 3
                ElseIf  $ray_4 == 0 Then
                    Send($ray_4_2)
                    
                    $ray = 4
                ElseIf $ray_5 == 0 Then
                    Send($ray_5_2)
                    
                    $ray = 5
                ElseIf $ray_6 == 0 Then
                    Send($ray_6_2)
                    
                    $ray = 6
                Else
                    $ray = 7
                EndIf
                
        If (_IsPressed("56", $DLL) And _IsPressed("10", $DLL)) Or _IsPressed("34", $DLL) Or _IsPressed("52", $DLL) Or _IsPressed("35", $DLL) Then
            DllClose("user32.dll")
            HotKeySet("v" , "_grave")
            ExitLoop
            EndIf
        If _IsPressed("01", $DLL) And $ray_wait == 0 Then
            DllClose("user32.dll")
            
                Switch $ray
                case 1
                    $ray_1_1 = _Timer_SetTimer("Darkfall Online", 15000, "_ray1")
                    $ray_1 = 1
                    Sleep(725)
                Case 2
            
                    $ray_2_1 = _Timer_SetTimer("Darkfall Online", 15000, "_ray2")
                    $ray_2 = 1
                    Sleep(725)
                Case 3
                    $ray_3_1 = _Timer_SetTimer("Darkfall Online", 15000, "_ray3")
                    $ray_3 = 1
                    Sleep(725)
                Case 4
                    $ray_4_1 = _Timer_SetTimer("Darkfall Online", 15000, "_ray4")
                    $ray_4 = 1
                    Sleep(725)
                Case 5
                    $ray_5_1 = _Timer_SetTimer("Darkfall Online", 9000, "_ray5")
                    $ray_5 = 1
                    Sleep(725)
                Case 6
                    $ray_6_1 = _Timer_SetTimer("Darkfall Online", 15000, "_ray6")
                    $ray_6 = 1
                    Sleep(725)
                Case 7
                    HotKeySet("v" , "_grave")
                    ExitLoop
                EndSwitch
                EndIf
                DllClose("user32.dll")
                        WEnd
    HotKeySet("v" , "_grave")
EndFunc

Func _ray1($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_1_1)
    $ray_1 = 0  
    
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
    
    Func _ray2($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_2_1)
    $ray_2 = 0
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
    
    Func _ray3($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_3_1)
    $ray_3 = 0
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
    
    Func _ray4($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_4_1)
    $ray_4 = 0
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
    
    Func _ray5($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_5_1)
    $ray_5 = 0
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
    
    Func _ray6($a,$b,$c,$d)
    _Timer_KillTimer("Darkfall Online", $ray_6_1)
    $ray_6 = 0
    If $ray_wait == 1 Then
        $sapi.speak("ray ready")
        $ray_wait = 0
        EndIf
    EndFunc
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...