Sign in to follow this  
Followers 0
BitByteBit

A plea

3 posts in this topic

Thank you to all on this forum who have helped me to date, really I thoroughly appreciate it.

I noticed a while back my friends started playing a game called FarmVille , I never cared much for the game, knowing that if I really wanted to I would be able to win ,however I liked the challenge it posed to code for, I taught myself many new things, and was shown a few things by the kind people of this forum.

Originally I hard coded in each mouse click, I spent 16 hours on the first day of this project, I wrote 900 lines. When I woke up I found out about PixelSearch and re-wrote the whole thing, bringing it down to about 300. Since then almost every other day I have taught myself something new, overall I have enjoyed this project.

However now I am well and truly stuck, I've been tearing myself to pieces the past 2 days trying to get this to work, it's actually driving me crazy, I ask that somebody PLEASE show me where I have gone wrong.

All of my other functions work, just not "Harvest", this is what I would like help with.

Believe me when I say that I have no intention of releasing this to the public, as a true gamer I believe games are made to be played, not "hacked".

Yours sincerely,

TriBe

Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 1)
Opt("TrayIconDebug", 1)
Opt("PixelCoordMode",1)
HotKeySet("^!s", "Plant")
HotKeySet("^!o", "Login")
HotKeySet("^!c", "CheckX")
HotKeySet("^!h", "Harvest")
HotKeySet("^!p", "Plow")
HotKeySet("^!1", "Play")
HotKeySet("^{F1}", "StopTheBoat")
;HotKeySet("^1", "HayBaleHack")
HotKeySet("^!b", "HayBaleHack")
HotKeySet("^2", "ImSoSick") ;http://www.youtube.com/watch?v=L7kUk67h3s8 I coded 50% to this
HotKeySet("!{Esc}", "Exit1")
;$ACTIVE = False
#include <Misc.au3>
Global $ACCEPTDELAY
Global $DELAY
Global $DELAYSET
Global $Done
Global $HBNUM
Global $MARKETDELAY
Global $NotDone
Global $Posi[2]
Global $POS[2]
Global $POS1[2]
Global $POS2[2]
Global $POS3[2]
Global $POS4[2]
Global $POS5[2]
Global $POS6[2]
Global $POS7[2]
Global $POS8[2]
Global $POS9[2]
Global $POS10[2]
Global $POS11[2]
Global $POS12[2]
Global $POS13[2]
Global $POS14[2]
Global $POS15[2]
Global $POS16[2]
Global $DUMMYPOS[1]
Global $Search
Global $CropColour
Global $Name
$DELAYSET = False
$DLL = DllOpen("user32.dll")
$Done = False
$NotDone = False
$SELECTED = False
$Found = False
$COUNT = 1
$WaitForIt = 0
$DUMMYPOS[0] = 1
$POS1[0] = 0
$POS2[0] = 0
$POS3[0] = 0
$POS4[0] = 0
$POS5[0] = 0
$POS6[0] = 0
$POS7[0] = 0
$POS8[0] = 0
$POS9[0] = 0
$POS10[0] = 0
$POS11[0] = 0
$POS12[0] = 0
$POS13[0] = 0
$POS14[0] = 0
$POS15[0] = 0
$POS16[0] = 0


$L1 = IniRead("C:\FV.ini", "Fruit", "Fruit 1", "Not Found")
$L2 = IniRead("C:\FV.ini", "Fruit", "Fruit 2", "Not Found")
$L3 = IniRead("C:\FV.ini", "Fruit", "Fruit 3", "Not Found")
$L4 = IniRead("C:\FV.ini", "Fruit", "Fruit 4", "Not Found")
$L5 = IniRead("C:\FV.ini", "Fruit", "Fruit 5", "Not Found")
$L6 = IniRead("C:\FV.ini", "Fruit", "Fruit 6", "Not Found")
$L7 = IniRead("C:\FV.ini", "Fruit", "Fruit 7", "Not Found")
$L8 = IniRead("C:\FV.ini", "Fruit", "Fruit 8", "Not Found")
$L9 = IniRead("C:\FV.ini", "Fruit", "Fruit 9", "Not Found")




GUICreate("FV", 150, 176, 682, 5)
$LOGIN = GUICtrlCreateButton("&Open FarmVille", 0, 0, 150, 35)
GUICtrlSetTip(-1, "Ctrl+Alt+L")
$PLANT = GUICtrlCreateButton("Plant/&Sew", 0, 35, 150, 35)
GUICtrlSetTip(-1, "Ctrl+Alt+S")
$HARVEST = GUICtrlCreateButton("&Harvest", 0, 70, 150, 35)
GUICtrlSetTip(-1, "Ctrl+Alt+H")
$PLOW = GUICtrlCreateButton("&Plow", 0, 105, 150, 35)
GUICtrlSetTip(-1, "Ctrl+Alt+P")
$HAYBALE = GUICtrlCreateButton("Hay &Bale Hack", 0, 140, 150, 35)
GUICtrlSetTip(-1, "Ctrl+B to Start recording " & @LF & "Ctrl+2 to Stop recording")

;$Laiz = GUICtrlCreateButton("Auto Everything", 0, 175, 150, 35)
GUISetState()

ToolTip("Ctrl+F1 to halt current action", 512, 384, "?", 1, 2)
Sleep(2000)

ToolTip("Alt+Esc to force exit!" & @LF & "Hover over buttons for hotkeys!", 512, 384, "!", 2, 2)
Sleep(2500)
ToolTip("")


While 1
    $MSG = GUIGetMsg()
    If $MSG = -3 Then EXIT1()
    If $MSG = $LOGIN Then LOGIN()
    If $MSG = $PLANT Then Plant()
    If $MSG = $HARVEST Then HARVEST()
    If $MSG = $PLOW Then PLOW()
    If $MSG = $HAYBALE Then HAYBALEHACK()
WEnd

Func Plant()
    MsgBox(0, "!", "Select Crop, then press OK")
    $Search = True
    While $Search = True
        $Coord2 = PixelSearch(30, 30, 900, 610, 8337165)
        If Not @error Then
            MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0)
            ;Sleep(175)
        EndIf
        If @error Then
            $Search = False
        EndIf
        ;CHECKSYNC2()
        Sleep(175)
    WEnd
    $Search = $Search = False
EndFunc   ;==>Plant


Func PLOW()
    $Search = True
    While $Search = True
        $Coord2 = PixelSearch(30, 30, 900, 610, 9731111)
        If Not @error Then
            MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0)
        EndIf
        ;Sleep(175)
        If @error Then
            $Search = False
        EndIf
        ;       CHECKSYNC2()
    WEnd
EndFunc   ;==>PLOW

Func HARVEST()
    If $Found = True Then
        $Search = True
        While $Search = True
            $Coord2 = PixelSearch(0, 0, 1024, 768, $CropColour)
            If Not @error Then
                MouseClick("Left", $Coord2[0], $Coord2[1], 2, 0)
            EndIf
            If @error Then
                $Search = False
                $Found = False
                $Question = MsgBox(4, "?", "Do you want to plow?")
                If $Question = 6 Then PLOW()
                If $Question = 7 Then
            EndIf
            EndIf
        WEnd
        ;CHECKSYNC2()
    Else
        TheQuestion()
    EndIf

EndFunc   ;==>HARVEST



Func TheQuestion()
    if $L1 <> "Not Found"  then Crop1()
;   if $L2 <> "Not Found"  then Crop2()
    $Q1 = MsgBox(4, "?", "Do you know your Crop Code?")
    If $Q1 = 6 Then Input()
    If $Q1 = 7 Then Pixel()
EndFunc   ;==>TheQuestion

Func Crop1 ()
$Q2 = MsgBox(4, "?", "Do you want to run the code for crop 1?")
If $Q2 = 6 Then
$Found =true
$CropColour = $L1
Harvest()
EndIf
If $Q2 = 7 Then Crop2()
EndFunc

Func Crop2 ()
$Q3 = MsgBox(4, "?", "Do you want to run the code for crop 2?")
If $Q3 = 6 Then
$Found =true
$CropColour = $L2
Harvest()
EndIf
;If $Q3 = 7 Then Crop2()
EndFunc



Func Input()
;   $Name = InputBox("Name", "What is the name of the crop?")
    $CropColour = InputBox("Input Code", "Please write in your Crop Code:")
    ;Hex($CropColour, 6)
    $Found = True
    HARVEST()
EndFunc   ;==>Input


Func Pixel()
    MsgBox(0, "", "Hover over the crop you want to harvest and press F1 ")
    While $Found = False
        If _IsPressed("70", $DLL) Then
            $Posi = MouseGetPos()
            $CropColour = PixelGetColor($Posi[0], $Posi[1])
            $CropColour = Hex(PixelGetColor($posi[0], $posi[1]), 6)
;$CropColour = Hex($CropColour, 6)
MsgBox(0, "", "You chose: " & $CropColour)
;$HexCropColour = Hex($CropColour, 6)
;MsgBox(0, "", "Hexed: " & $HexCropColour)
            MsgBox(0, "", "Testing your selection")
            $Coord2 = PixelSearch(0, 0, 1024, 768, "0x" & $CropColour)
            If Not @error Then
                MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0)
            EndIf
            Sleep(2000)
            $Question = MsgBox(4, "?", "Was that the right one?")
            If $Question = 6 Then
;               Input2()
            $CropColour = "0x" & $CropColour
            MsgBox(0,"", """" & $CropColour &"""")
                WriteIni()
                $Found = True
                Harvest()
            EndIf
        EndIf
    WEnd
    ;Harvest()
EndFunc   ;==>Pixel

;Func Input2()
    ;$Name = InputBox("Name", "What is the name of the crop?")
    ;Hex($CropColour, 6)
;   $Found = True
;EndFunc   ;==>Input


;         IniWrite($Gloc & $Ginfo & ".ini", "Colors", $Count, "0x" & $CHex)
;         GUICtrlSetBkColor($Label_[$Count], "0x" & $CHex)


Func WriteIni()
    If $L1 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit","Fruit 1", "0x" & $CropColour)
    Else
        Write2()
    EndIf
EndFunc   ;==>WriteIni
Func Write2()
    If $L2 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 2", $CropColour)
    Else
        Write3()
    EndIf

EndFunc   ;==>Write2
Func Write3()
    If $L3 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 3","0x" &  $CropColour)
    Else
        Write4()
    EndIf

EndFunc   ;==>Write3
Func Write4()
    If $L4 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 4","0x" &  $CropColour)
    Else
        Write5()
    EndIf
EndFunc   ;==>Write4
Func Write5()
    If $L5 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 5","0x" &  $CropColour)
    Else
        Write6()
    EndIf
EndFunc   ;==>Write5
Func Write6()
    If $L6 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 6","0x" &  $CropColour)
    Else
        Write7()
    EndIf
EndFunc   ;==>Write6
Func Write7()
    If $L7 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 7","0x" &  $CropColour)
    Else
        Write8()
    EndIf
EndFunc   ;==>Write7
Func Write8()
    If $L8 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 8","0x" &  $CropColour)
    Else
        Write9()
    EndIf
EndFunc   ;==>Write8
Func Write9()
    If $L9 = "Not Found" Then
        IniWrite("C:\FV.ini", "Fruit", "Fruit 9","0x" &  $CropColour)
    EndIf
EndFunc   ;==>Write9








Func LOGIN()
    ShellExecute("http://apps.facebook.com/onthefarm/index.php?ref=ts")
    WinWait("FarmVille on Facebook", "")
    If Not WinActive("FarmVille on Facebook", "") Then WinActivate("FarmVille on Facebook", "")
    WinWaitActive("FarmVille on Facebook", "")
    WinSetState("FarmVille on Facebook", "", @SW_MAXIMIZE)
    Sleep(15000)
    PLAY()
    MouseClickDrag("left", 1015, 250, 1015, 320)
    Sleep(15000)
    CHECKX()
    Sleep(500)
    MouseClick("left", 726, 598, 1, 0)
    WinWait("Adobe Flash Player", "")
    If Not WinActive("Adobe Flash Player", "") Then WinActivate("Adobe Flash Player", "")
    WinWaitActive("Adobe Flash Player", "")
    MouseClick("Left", 797, 632, 1, 0)
    Sleep(600)
    MouseClick("Left", 797, 632, 1, 0)
    Sleep(600)
    MouseClick("Left", 797, 632, 1, 0)
    Sleep(600)
    ProcessSetPriority("FireFox.exe", 1)
    $ZOOMEDOUT = True
EndFunc   ;==>LOGIN

Func PLAY()
    $Coord = PixelSearch(60, 230, 75, 230, 7177396)
    If Not @error Then
        Sleep(1000)
        MouseClick("left", 130, 230, 1, 0)
        Sleep(16000)
        CHECKX()
    Else
    EndIf
EndFunc   ;==>PLAY

Func CHECKX()
    ;$SearchING = 0
    ;While $SearchING <= 5
    $Coord = PixelSearch(30, 30, 900, 740, 12797498)
    If Not @error Then
        MouseClick("Left", $Coord[0], $Coord[1], 1, 0) ;Accept
    Else
    EndIf
    $Coord2 = PixelSearch(30, 30, 900, 740, 9747521) ;X
    If Not @error Then
        MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0)
    EndIf
    $Coord3 = PixelSearch(30, 30, 900, 740, 10991832) ; Publish
    If Not @error Then
        MouseClick("Left", $Coord3[0], $Coord3[1], 1, 0)
    EndIf
    ;$SearchING = $SearchING + 1
    ;WEnd
    ;$SearchING = 0
EndFunc   ;==>CHECKX

Func IMSOSICK();Not me being big headed, its a song I listened to repetitively whilst coding http://www.youtube.com/watch?v=L7kUk67h3s8
    $NotDone = True
    $Done = True
    MsgBox(0, "!", "Recorded all steps", 5)
    SETDELAY()
EndFunc   ;==>IMSOSICK

Func HAYBALEHACK()
    If $Done = False Then
        MsgBox(0, "!", "Press Scroll Click for each action" & @LF & "Press Ctrl + 2 to stop recording", 7)
        ;MsgBox(0, "!", "Press Ctrl + 2 to stop recording", 5)
        While $NotDone = False
            Sleep(50)
            If _IsPressed("4", $DLL) Then
                $POS = MouseGetPos()
                ToolTip("Recorded", 512, 384, "!", 1, 2)
                Sleep(750)
                ToolTip("")
                HB1()
            EndIf
        WEnd
    Else
        DOIT()
    EndIf
EndFunc   ;==>HAYBALEHACK

Func SETDELAY()
    $MARKETDELAY = InputBox("Input", "Please input delay for market(4)")
    $DELAY = InputBox("Input", "Please input delay between each click(1)")
    $DELAY = $DELAY * 1000
    $MARKETDELAY = $MARKETDELAY * 1000
    $DELAYSET = True
    $HBNUM = InputBox("Input", "How many times do you want to do it?")
    MsgBox(0, "!", "Activate the hack by pressing Ctrl+Alt+B")
EndFunc   ;==>SETDELAY


Func DOIT()
    If $DELAYSET = True Then
        While $HBNUM >= $COUNT
            If $POS[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS[0], $POS[1], 1, 0)
                Sleep($MARKETDELAY)
            EndIf
            If $POS1[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS1[0], $POS1[1], 1, 0)
                Sleep($MARKETDELAY)
            EndIf
            If $POS2[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS2[0], $POS2[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS3[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS3[0], $POS3[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS4[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS4[0], $POS4[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS5[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS5[0], $POS5[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS6[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS6[0], $POS6[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS7[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS7[0], $POS7[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS8[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS8[0], $POS8[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS9[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS9[0], $POS9[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS10[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS10[0], $POS10[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS11[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS11[0], $POS11[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS12[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS12[0], $POS12[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS13[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS13[0], $POS13[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS14[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS14[0], $POS14[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS15[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS15[0], $POS15[1], 1, 0)
                Sleep($DELAY)
            EndIf
            If $POS16[0] >= $DUMMYPOS[0] Then
                MouseClick("Left", $POS16[0], $POS16[1], 1, 0)
                Sleep($DELAY)
            EndIf
            $COUNT = $COUNT + 1
        WEnd
        $COUNT = 0
    Else
        SETDELAY()
    EndIf
EndFunc   ;==>DOIT
Func HB1()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS1 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB2()
        EndIf
    WEnd
EndFunc   ;==>HB1
Func HB2()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS2 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB3()
        EndIf
    WEnd
EndFunc   ;==>HB2
Func HB3()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS3 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB4()
        EndIf
    WEnd
EndFunc   ;==>HB3
Func HB4()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS4 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB5()
        EndIf
    WEnd
EndFunc   ;==>HB4
Func HB5()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS5 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB6()
        EndIf
    WEnd
EndFunc   ;==>HB5
Func HB6()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS6 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB7()
        EndIf
    WEnd
EndFunc   ;==>HB6
Func HB7()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS7 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB8()
        EndIf
    WEnd
EndFunc   ;==>HB7
Func HB8()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS8 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB9()
        EndIf
    WEnd
EndFunc   ;==>HB8
Func HB9()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS9 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB10()
        EndIf
    WEnd
EndFunc   ;==>HB9
Func HB10()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS10 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB11()
        EndIf
    WEnd
EndFunc   ;==>HB10
Func HB11()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS11 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB12()
        EndIf
    WEnd
EndFunc   ;==>HB11
Func HB12()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS12 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB13()
        EndIf
    WEnd
EndFunc   ;==>HB12
Func HB13()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS13 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB14()
        EndIf
    WEnd
EndFunc   ;==>HB13
Func HB14()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS14 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB15()
        EndIf
    WEnd
EndFunc   ;==>HB14
Func HB15()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS15 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            HB16()
        EndIf
    WEnd
EndFunc   ;==>HB15
Func HB16()
    While $NotDone = False
        Sleep(50)
        If _IsPressed("4", $DLL) Then
            $POS16 = MouseGetPos()
            ToolTip("Recorded", 512, 384, "!", 1, 2)
            Sleep(750)
            ToolTip("")
            $WaitForIt1 = True
        EndIf
    WEnd
    DllClose($DLL)
    $NotDone = True
    $Done = True
EndFunc   ;==>HB16

Func EXIT1()
    Exit
EndFunc   ;==>EXIT1


Func StopTheBoat()
    $Search = False
    $Found = False
    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>StopTheBoat

Share this post


Link to post
Share on other sites



1) Your post's subject is useless.

2) What are they symptoms of it not working?

3)

Func HARVEST()
    If $Found = True Then
        $Search = True
        While $Search = True
            $Coord2 = PixelSearch(0, 0, 1024, 768, $CropColour)
            If Not @error Then
                MouseClick("Left", $Coord2[0], $Coord2[1], 2, 0)
            Else

                $Search = False
                $Found = False
                $Question = MsgBox(4, "?", "Do you want to plow?")
                If $Question = 6 Then PLOW()
                If $Question = 7 Then
            EndIf
            EndIf
        WEnd
        ;CHECKSYNC2()
    Else
        TheQuestion()
    EndIf

EndFunc   ;==>HARVEST

I changed your if statement so the case of @error is part of the original check. Also this line "If $Question = 7 Then" doesn't do anything.

Share this post


Link to post
Share on other sites

1. Duly noted!!!

2. My sincere apologies, I wasn't specific enough.

3. "If $Question = 7 Then"; it should have a sleep at the end, I foolishly put that in to try to combat the problem I've described below.

The harvest function works on its own, however I'm having trouble with its the dependencies, "TheQuestion", "WriteIni", "Pixel", "Crop1", "Crop2", "Input", these a relatively small functions.

They seem to loop, if you click No when it asks you if you want to plow, it goes back to "TheQuestion" again, when it should exit that particular function.

Also I was having trouble with writing and loading the results of Pixel. It would not load the hex value from the .ini properly.

Thanks for your reply!

Share this post


Link to post
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
Sign in to follow this  
Followers 0