Jump to content

Subscript used on non-accessible variable. Help?


Skistus
 Share

Recommended Posts

hi guys  my script  give me  this Subscript used on non-accessible variable.: , but i dont understund  

Only give the error when is compiled 

#include <NomadMemory.au3>
#include <ImageSearch.au3>
#include <Array.au3>
#include <WinAPIEx.au3>
SetPrivilege("SeDebugPrivilege", 1)
AutoItSetOption ( "SendKeyDownDelay", 250)
HotKeySet("{F1}", "_Start")
HotKeySet("{F4}", "_exit")
HotKeySet("{F2}", "_reset")
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Global $x, $y, $sprite, $Sx, $Sy, $State

Global $paused = True
Global $runing = True
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Func _Start()
    $paused = not $paused
EndFunc

Func _Exit()
    $runing = False
EndFunc

Func _reset()
    $sprite = 0
EndFunc

_Main()

Func _Main()

While $runing
    if Not $paused Then
        if $sprite = 1 Then
            _Sprite()
            ToolTip("Working",0,0)
        Else
            if _ImageSearch('Res/Ok1.png',1,$Sx,$Sy,10) = 1 Then
                $sprite = 1
                $State = 1
                Sleep(250)
                MouseClick("Left",$Sx,$Sy,1,3)
                Sleep(1500)

            Else
                ToolTip("Waiting",0,0)
                Sleep(2000)
            EndIf
        EndIf
    Else
    ToolTip("PAUSED",0,0)
    Sleep(500)
    EndIf
WEnd
EndFunc



Func _Sprite()
        $x = 0
        $y = 0

Switch $State

    Case 1
    ToolTip("1",0,0)
    Sleep(500)
    If _ImageSearch('Res/Chat1.png',1,$x,$y,10) = 1 Then
        Sleep (1500)
    MouseClick("Left",$Sx,$Sy,1,3)
    EndIf
$State = 2

    Case 2
        ToolTip("2",0,0)
        Sleep(500)
        MouseClick("Left",$Sx-120,$Sy+125,1,3)
        Sleep(500)
        MouseClick("Left",$Sx-120,$Sy+125,1,3)
        Sleep(500)
        MouseClick("Left",$Sx-120,$Sy+125,1,3)
$State = 3

    Case 3
        ToolTip("3",0,0)
        Sleep(250)
        If _ImageSearch('Res/Hap.png',1,$x,$y,10) = 1 Then
            $State = 4
        Else
            If _ImageSearch('Res/Ref.png',1,$x,$y,10) = 1 Then
            Send("2")
            MouseClick("Left",$Sx,$Sy-100,1,3)
            Else
            Sleep(2000)
            EndIf
        EndIf
    Case 4
        MouseClick("Left",$Sx-83,$Sy-169,1,3)
        Sleep(500)
        If _ImageSearch('Res/Vit1.png',1,$x,$y,10) = 1 Then
            $State = 5
        Else
        MouseClick("Left",$Sx-140,$Sy-169,1,3)
        Send(1)
        MouseClick("Left",$Sx,$Sy-100,1,3)
        EndIf
    Case 5
        ToolTip("4",0,0)
        Sleep(250)
        MouseClick("Left",$Sx-72,$Sy+125,1,3)
        Sleep(500)
        If _ImageSearch('Res/Clos1.png',1,$x,$y,10) = 1 Then
        MouseClick("Left",$x-70,$y,1,3)
        $sprite = 0
        EndIf
EndSwitch
EndFunc

 

Link to comment
Share on other sites

1 hour ago, Skistus said:

if _ImageSearch('Res/Ok1.png',1,$Sx,$Sy,10) = 1 Then

I don't use Imagesearch, but at least the filename is wrong.

Characters in range 1-31 (0x01-0x1F) and characters " * / : < > ? \ | are not allowed for filenames.

I recommend you to read the thread imagesearch-usage-explanation . Many errors but also solutions are described there.

P.S. : Please also post the error message that appears in the message box.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

5 minutes ago, Musashi said:

I don't use Imagesearch, but at least the filename is wrong.

Characters in range 1-31 (0x01-0x1F) and characters " * / : < > ? \ | are not allowed for Filenames.

where u say? name of the file is Ok1.png 

Link to comment
Share on other sites

1 hour ago, Skistus said:

where u say? name of the file is Ok1.png 

My fault - I should have a cup of coffee first ;).

Anyway : Please post the error message that appears in the message box.

EDIT : @Skistus -> I have just discovered the following thread from you :

https://www.autoitscript.com/forum/topic/190565-imagesearch-how-to-search-multiple-pictures-on-different-maps/?do=findComment&comment=1367455

This topic was closed.   

Since <ImageSearch.au3> and <NomadMemory.au3> are often used for game automation, I'm out of here.

If required, a moderator will make further decisions.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

  • Developers

@Skistus,
I see you did not read or remember those forum rules, which you were pointed to in 2017, very carefully - you missed the part that says:

"
Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above
"

Do NOT start another thread on this - our patience has limits. :naughty:
Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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