Jump to content

Using While to add...


Recommended Posts

So Ive just about got a nice little autobattler working, but for some reason, it wont work if I try to ue a while loop to add to the coordinate depending on the attack to use, can anyone spot why? it just stops, not exiting, but just stops.

Please an thank you!

P.S. Happy Thanksgiving! (If you live in US..)

$mage=InputBox("Player","Please type in what attack to use (attack/spell)","attack")
If $mage = "spell" Then ;PROBLEM STARTS HERE (maybe)
    $spell=InputBox("Player","Which is your default spell? (!NUMBER ONLY!)(1 - 8)","1")
    If Number($spell) = 1 Then
    $coor=285
        Else
    $coor=285
    While $spell
    $coor=$coor+20
    WEnd
    EndIf
EndIf ;END
WinActivate("AdventureQuest RPG")
While 1
    If (PixelGetColor(826,459) = 8135958) Then
        MouseClick("primary",466,466)
        Sleep(1000)
        MouseClick("primary",345,466)
        Sleep(1000)
        MouseClick("primary",563,297)
        Sleep(500)
        MouseClick("primary",826,459)
    EndIf
    If (PixelGetColor(489,220) = 0) Then
        If $mage = "spell" Then
        MouseClick("primary",489,285)
        Sleep(1000)
        MouseClick("primary",675,$coor)
        Else
        MouseClick("primary",489,240)
        EndIf
    EndIf
    If (PixelGetColor(293,522) = 592137) Then
        MouseClick("primary",489,330)
        Sleep(1000)
        MouseClick("primary",620,280)
    EndIf
    If (PixelGetColor(530,400) = 16777215) Then
        MouseClick("primary",530,400)
    EndIf
WEnd
Edited by P a R a D o X

If I hadn't said thank you yet, and you deserve it, than thank you...

Link to comment
Share on other sites

$coor += 20 better syntax

True, but doesn't address the problem. The While loop continues until $spell = 0, and there is no indication of anything setting $spell to 0. In fact the user is prompted to set it to 1-8.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

umm its magical -= 1 subtracts 1 from something hmm now if spell is set to a number and you subtract 1 each loop its eventually going to equal 0 hmmmm....

Umm... I'm confused on how that helps. :lmao:

The loop from the original post is:

While $spell
    $coor=$coor+20
WEnd

The loop is controlled by $spell, but only modifies $coor. How does that ever lead to $spell = 0?

By... magic? ;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...