Jump to content

I can use your expertise for an automated clicking program error


BBock727
 Share

Recommended Posts

This is the error that im getting :

Line 197 (File "C\...\Clicker.au3"):

$MHP2 = $MHP[$MHP7]

$MHP2 = $MHP[^ ERROR

Error: Array variable subscript badly formatted.

I'm not sure what this error means. If i knew, I would attempt to fix it. This program is for a online game Ladderslasher where you must click constantly to kill things. My script "chickens" when my character gets too low on health and therefore clicks the link run away. After that happens i get this error.

Other than this error, the script has been running flawless. Not sure the problem.

Let me know what other info you may need.

Thanks in advance

Link to comment
Share on other sites

this seems to be the relevant area

$sHTML = _IEBodyReadHTML($oIE)
        $MHP = StringSplit($sHTML, @CR)
        
        $MHP6 = Number(_ArraySearch($MHP, "monHP", 0, 0, 0, True))
        If @error Then
            MsgBox(0, "", "Bad Bad Bad")
            Exit
        EndIf
        
        $MHP7 = Number($MHP6)
        
        $MHP2 = $MHP[$MHP7]
        
    ;MsgBox(0, "", $MHP2 & " :*:*:*: " & $MHP7)
        
        $MHP3 = StringTrimLeft($MHP2, 42)
        $MHP4 = StringTrimRight($MHP3, 21)
        $MHP5 = Number($MHP4)
        Global $MHP6 = $MHP5
            
    ;_ArrayDisplay($MHP)
    ;Exit
            
        If $MHP5 = 0 Then
            Do
                _IELinkClickByText($oIE, "Attack w/  " & $Weapon, 0, 0)
            Until @error
            $MonsterDead = 1
        EndIf
    EndIf
EndFunc

Func _NextMonster()
    $Levels = StringSplit(_IEBodyReadText($oIE), @CR)
    $Levels2 = StringSplit($Levels[2], "(")
    $Levels3 = StringSplit($Levels2[3], ")")
    $Levels4 = StringSplit($Levels[2], ":")
    $Levels5 = StringTrimRight($Levels4[2], 1)
    $Levels6 = Number($Levels5)
    
;MsgBox(0, "", "Fight Another Level " & $Levels6 & " Monster")
    
    _IELinkClickByText($oIE, "Fight Another Level " & $Levels6 & " Monster")
    
    
;_ArrayDisplay($Levels)
;Exit
    
    If @error Then
        _MainMenu()
        _IELinkClickByText($oIE, "Enter Combat Arena")
        _IELinkClickByText($oIE, "Fight This Opponent")
        If @error Then
            _LogEvent(1, "GUI seems dead, exiting")
            Exit
        EndIf
    EndIf
EndFunc

Func _Chicken()
;MsgBox(0, "", "Chicken !")
    _MainMenu()
    $Wait = 1
    $Chicken = 0
    $Chickens = $Chickens + 1
;Exit
EndFunc
Edited by BBock727
Link to comment
Share on other sites

wow, you are lost

you show this ( 1st post) as the problem

Line 197 (File "C\...\Clicker.au3"):

$MHP2 = $MHP[$MHP7]

$MHP2 = $MHP[^ ERROR

I show this to help you get info

MsgBox(0, "$MHP7 =" & $MHP7, "Array Max $MHP =" & $MHP[0] & @CRLF & "Return $MHP6=" & $MHP6)

$MHP2 = $MHP[$MHP7]

and if you dont know where to put it, sorry, i cant help you

8)

NEWHeader1.png

Link to comment
Share on other sites

wow, you are lost

you show this ( 1st post) as the problem

Line 197 (File "C\...\Clicker.au3"):

$MHP2 = $MHP[$MHP7]

$MHP2 = $MHP[^ ERROR

I show this to help you get info

MsgBox(0, "$MHP7 =" & $MHP7, "Array Max $MHP =" & $MHP[0] & @CRLF & "Return $MHP6=" & $MHP6)

$MHP2 = $MHP[$MHP7]

and if you dont know where to put it, sorry, i cant help you

8)

oh come on! im a rookie at this. The most i scripted w/ autoit is Ultima Online Videogame scripts. I am trying my best. This is where i put the code you gave me but obviously i didnt think it would work and it didnt work. All it did was make a msgbox pop up constantly throughout the running of the script. Maybe i put it in the wrong place

$sHTML = _IEBodyReadHTML($oIE)
        $MHP = StringSplit($sHTML, @CR)
        
        $MHP6 = Number(_ArraySearch($MHP, "monHP", 0, 0, 0, True))
        If @error Then
            MsgBox(0, "", "Fucked")
            Exit
        EndIf
        
        $MHP7 = Number($MHP6)
        
        MsgBox(0, "$MHP7 =" & $MHP7, "Array Max $MHP =" & $MHP[0] & @CRLF & "Return $MHP6=" & $MHP6)
        $MHP2 = $MHP[$MHP7]
        
        
        
        $MHP3 = StringTrimLeft($MHP2, 42)
        $MHP4 = StringTrimRight($MHP3, 21)
        $MHP5 = Number($MHP4)
        Global $MHP6 = $MHP5
            
    ;_ArrayDisplay($MHP)
    ;Exit

Any help would be greatly appreciated. I probably spent 12 hours on this script already. Thanks in advance!!

Link to comment
Share on other sites

ok, right spot, replace that "pop-up" box with this

ToolTip( "$MHP7 =" & $MHP7, "Array Max $MHP =" & $MHP[0] & @CRLF & "Return $MHP6=" & $MHP6, 20, 20)
Sleep(500)

the idea is to find when/where the array goes bad... you need info to get it, and that is what this line above is for

8)

Ok when im fighting a mob it says

array max $mhp =48

return $mhp6=41

when i chicken it says :

array max $mhp =44

return $mhp6= -1

and then i get the error... i hope this helps b/c im stumped

over and over

Edited by BBock727
Link to comment
Share on other sites

Ok when im fighting a mob it says

array max $mhp =48

return $mhp6=41

when i chicken it says :

array max $mhp =44

return $mhp6= -1

and then i get the error... i hope this helps b/c im stumped

over and over

bump, any help would be greatly appreciated!

Link to comment
Share on other sites

Without seeing your entire script, (making a guess here) it may be when creating your array, and I suspect you are having it made over and over in a loop, the array fails for the data isn't there to be collected. Just a guess for I can't see all the code.

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...