Problem mit While Schleife

  • hi, ich habe ein Script an meine Vorhaben angepasst, aber kriege dies einfach nicht so wie ich es will zum laufen... die While schleife will einfach nicht funktionieren
    (sorry, aber ich war schon immer ein sehr schlechter C++ programmer - das zieht sich wahrscheinlich auf hier mit durch ;) )

    Das Ziel ist es, dass alle xx male der Schleife mit send("5") wieder die obere genommen wird mit send("6") - was ich mit meinen abc Kenntnissen wohl nicht mal hin kriege :(

    Spoiler anzeigen
    [autoit]

    while 1

    sleep(5000)
    send("6")
    sleep(9000)
    while 2[/b]
    WinActivate("WORLD OF WARCRAFT")
    send("5")
    sleep(3710)

    [/autoit] [autoit][/autoit] [autoit]

    $start2 = Timerinit()
    while 1

    $dif = TimerDiff($start2)
    if $dif > 21000 then
    exitloop
    endif
    sleep(500)
    $message = "Searching for feather..."
    $height = 60
    update_splash()
    $feather_cord = PixelSearch ($left, $top, $right, $bottom, $feather, $colourVariance, $step)
    if NOT @error = 1 then
    seterror(2)
    $message = "Found Something."
    update_splash()
    $featherx = $feather_cord[0]
    $feathery = $feather_cord[1]
    mousemove($featherx, $feathery)
    exitloop
    endif
    WEnd

    $start = Timerinit()
    While 1
    sleep(100)
    $message = "Waiting for bite..."
    $height = 100
    update_splash()

    ;calc area of probable splash
    $s_left = ($featherx - $s_offset)
    $s_top = ($feathery - $s_offset)
    $s_right = ($featherx + $s_offset)
    $s_bottom = ($feathery + $s_offset)

    $sp = Pixelsearch($s_left, $s_top, $s_right, $s_bottom, $day, $splashvariance)
    $sp = Pixelsearch($s_left, $s_top, $s_right, $s_bottom, $night, $splashvariance)

    $dif = TimerDiff($start)
    if $dif > 25000 then
    exitloop
    endif

    if ubound($sp) > 1 then
    ;if NOT @error = 1 then
    seterror(2)
    $message = "Fish!"
    $height = 60
    update_splash()
    send("{shiftdown}")
    mouseclick("right", $featherx, $feathery, 1, 1)
    send("{shiftup}")
    exitloop
    endif
    WEnd


    WEnd
    WEnd

    [/autoit]

    Edit BugFix: Tags gesetzt
    Edit GtaSpider: [04.10.2007 20:15]
    Hab ich übrigens auch gemacht, nur ca 2 Sekunden vor BugFix^^

    Einmal editiert, zuletzt von CeeJay (4. Oktober 2007 um 19:43)

    • Offizieller Beitrag

    Hallo

    Meinst du so?

    Spoiler anzeigen
    [autoit]

    $xx = 5 ;Wie oft er die 2. Schleife durchlaufen soll bis er wieder mit der 1. anfängt
    $i = 0 ;Zähler

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(5000)
    Send("6")
    Sleep(9000)
    $i = 0
    While 2 ;btw: Hier kannst du auch While 1 machen!
    $i += 1
    If $i > $xx Then ExitLoop
    WinActivate("WORLD OF WARCRAFT")
    Send("5")
    Sleep(3710)

    [/autoit] [autoit][/autoit] [autoit]

    $start2 = TimerInit()
    While 1

    [/autoit] [autoit][/autoit] [autoit]

    $dif = TimerDiff($start2)
    If $dif > 21000 Then
    ExitLoop
    EndIf
    Sleep(500)
    $message = "Searching for feather..."
    $height = 60
    update_splash ()
    $feather_cord = PixelSearch($left, $top, $right, $bottom, $feather, $colourVariance, $step)
    If Not @error = 1 Then
    SetError(2)
    $message = "Found Something."
    update_splash ()
    $featherx = $feather_cord[0]
    $feathery = $feather_cord[1]
    MouseMove($featherx, $feathery)
    ExitLoop
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    $start = TimerInit()
    While 1
    Sleep(100)
    $message = "Waiting for bite..."
    $height = 100
    update_splash ()

    [/autoit] [autoit][/autoit] [autoit]

    ;calc area of probable splash
    $s_left = ($featherx - $s_offset)
    $s_top = ($feathery - $s_offset)
    $s_right = ($featherx + $s_offset)
    $s_bottom = ($feathery + $s_offset)

    [/autoit] [autoit][/autoit] [autoit]

    $sp = PixelSearch($s_left, $s_top, $s_right, $s_bottom, $day, $splashvariance)
    $sp = PixelSearch($s_left, $s_top, $s_right, $s_bottom, $night, $splashvariance)

    [/autoit] [autoit][/autoit] [autoit]

    $dif = TimerDiff($start)
    If $dif > 25000 Then
    ExitLoop
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If UBound($sp) > 1 Then
    ;if NOT @error = 1 then
    SetError(2)
    $message = "Fish!"
    $height = 60
    update_splash ()
    Send("{shiftdown}")
    MouseClick("right", $featherx, $feathery, 1, 1)
    Send("{shiftup}")
    ExitLoop
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    WEnd
    WEnd

    [/autoit]

    Mfg Spider

  • Dickes danke - funktioniert :)


    es gibt doch nix über Leute, die auch programmieren können und sich nicht nur ne 4 in der Schule beim C++ proggen geholt haben *hust* :)