الموقع العربي الاول للعبة Silkroad Online

الموقع العربي الاول للعبة Silkroad Online (https://silkroad4arab.com/vb/index.php)
-   قـسـم الـبـرامـج الـمـسـاعـدة (https://silkroad4arab.com/vb/forumdisplay.php?f=15)
-   -   [مساعده] Autoit وطريقة التعديل على اوبن سورس (https://silkroad4arab.com/vb/showthread.php?t=476287)

SweetyAppel 16-01-2013 07:04 AM

[مساعده] Autoit وطريقة التعديل على اوبن سورس
 
انا عاوز اعمل بوت لسيرفر برايفت فا حسب ما تنقلت فى الموضيع لاقيت انى ممكن اعدل على اوبن سورس جاهز والبوت هيشتغل فا انا عاوز اعرف ازى هعدل انا ميح فى الكلام دا بس لو حد حاول يفهمنى بتسقبل بسرعه وهفهم بسهوله يعنى مش هتعب الى هيساعدنى الاوبن سورس دا autoit ودا رابط ليه

كود:

#include <GUIListView.au3>
#include <GUIConstants.au3>
#include <GuiListbox.au3>


Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
;-------------HotKeys-----------------------------------------------------------------------------------------------------
HotKeySet("{Home}", "Start")
HotKeySet("{END}", "stop")
HotKeySet("{PAUSE}", "Pause")
HotKeySet("{F11}", "SaveCoords")
HotKeySet("{F8}", "WalkPath")
;----------------------------------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------------------------------
Global $MonsterLightNotFound
Global $MonsterNotFound
Global $MonsterDead
Global $mobFind
Global $PartyLeader
Global $autoParty
Global $Wait
Global $Paused
Global $Coordsystem
Global $east
Global $west
Global $south
Global $north
Global $SavedX
Global $SavedY
Global $CurrentCoord
Global $DestinationY
Global $DestinationX
Global $WalkToY
Global $WalkToX
Global $walktoSystem
Global $walkback
Global $CastSkill
Global $Buff1Timer
Global $Buff2Timer
Global $Buff3Timer
Global $Buff4Timer
Global $Buff5Timer
Global $ChatTimer
Global $GetStuckCoords
Global $Timer1
Dim $BotName = "SRO BOT"
Global $BotAccount
Global $BotPass
Global $ProcessID = WinGetProcess("SRO_Client","");
Global $XAddress
Global $YAddress
Global $YC
Global $XC
Global $Name
Global $result
Global $ItemText
Global $Wait
Global $pos
Global $poscoord
Dim $Sensitivity = 8
Global $SellingItem
Dim $SpamMessage1 = "SRO BOT"
Dim $SpamDelay = 50000


#Include <GuiConstants.au3>

GUISetState()
;;This is the UDP Client
;;Start the server first

; Start The UDP Services
;==============================================

; Open a "SOCKET"
;==============================================

While 1
        $msg = GUIGetMsg()
        GUISetState(@SW_HIDE)
                        MainGUI()

        If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func MainGUI()
        #include <GUIConstants.au3>
        Global $Name

        #include <GUIConstants.au3>

       
        $Form1_1 = GUICreate("SRO BOT    Beta  Version 1.0", 549, 276, -1, -1)
        $Group1 = GUICtrlCreateGroup("Auto Login", 8, 8, 193, 97)
        GUICtrlSetColor(-1, 0x0000FF)
        $Label1 = GUICtrlCreateLabel("UserName", 16, 24, 54, 17)
        $Label2 = GUICtrlCreateLabel("PassWord", 16, 48, 53, 17)
        $UserName = GUICtrlCreateInput("", 72, 24, 121, 21)
        GUICtrlSetColor(-1, 0x0000FF)
        $PassWord = GUICtrlCreateInput("", 72, 48, 121, 21)
        GUICtrlSetFont(-1, 8, 800, 0, "WP MultinationalB Helve")
        GUICtrlSetColor(-1, 0x0000FF)
        $Label3 = GUICtrlCreateLabel("Char", 24, 72, 26, 17)
        $char = GUICtrlCreateCombo("1", 72, 72, 41, 25)
        GUICtrlSetData(-1, "1|2|3")
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Tab1 = GUICtrlCreateTab(208, 8, 337, 233)
        $TabSheet1 = GUICtrlCreateTabItem("Skills")
        $UseSkill1 = GUICtrlCreateCheckbox("Skill 1 Belt", 220, 48, 73, 17)
        $Label4 = GUICtrlCreateLabel("Key", 340, 48, 22, 17)
        $Skill1Key = GUICtrlCreateInput("3", 364, 48, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseSkill2 = GUICtrlCreateCheckbox("Skill 2 Belt", 220, 80, 73, 17)
        $Skill1Belt = GUICtrlCreateCombo("1", 294, 48, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Skill2Belt = GUICtrlCreateCombo("1", 294, 80, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label5 = GUICtrlCreateLabel("Key", 340, 80, 22, 17)
        $Skill2Key = GUICtrlCreateInput("4", 364, 80, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseSkill3 = GUICtrlCreateCheckbox("Skill 3 Belt", 220, 112, 73, 17)
        $Skill3Belt = GUICtrlCreateCombo("1", 294, 112, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label6 = GUICtrlCreateLabel("Key", 340, 112, 22, 17)
        $Skill3Key = GUICtrlCreateInput("5", 364, 112, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseSkill4 = GUICtrlCreateCheckbox("Skill 4 Belt", 220, 144, 73, 17)
        $Skill4Belt = GUICtrlCreateCombo("1", 294, 144, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label7 = GUICtrlCreateLabel("Key", 340, 144, 22, 17)
        $Skill4Key = GUICtrlCreateInput("6", 364, 144, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseSkill5 = GUICtrlCreateCheckbox("Skill 5 Belt", 220, 176, 73, 17)
        $Skill5Belt = GUICtrlCreateCombo("1", 294, 176, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label8 = GUICtrlCreateLabel("Key", 340, 176, 22, 17)
        $Skill5Key = GUICtrlCreateInput("7", 364, 176, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $TabSheet2 = GUICtrlCreateTabItem("Buffs")
        $UseBuff1 = GUICtrlCreateCheckbox("Buff 1 Belt", 220, 48, 73, 17)
        $Buff1Belt = GUICtrlCreateCombo("2", 294, 48, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label9 = GUICtrlCreateLabel("Key", 340, 48, 22, 17)
        $Buff1key = GUICtrlCreateInput("1", 364, 48, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseBuff2 = GUICtrlCreateCheckbox("Buff 2 Belt", 220, 80, 73, 17)
        $Buff2Belt = GUICtrlCreateCombo("2", 294, 80, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label10 = GUICtrlCreateLabel("Key", 340, 80, 22, 17)
        $Buff2Key = GUICtrlCreateInput("2", 364, 80, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseBuff3 = GUICtrlCreateCheckbox("Buff 3 Belt", 220, 112, 73, 17)
        $Buff3Belt = GUICtrlCreateCombo("2", 294, 112, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label11 = GUICtrlCreateLabel("Key", 340, 112, 22, 17)
        $Buff3Key = GUICtrlCreateInput("3", 364, 112, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $UseBuff4 = GUICtrlCreateCheckbox("Buff 4 Belt", 220, 144, 73, 17)
        $UseBuff5 = GUICtrlCreateCheckbox("Buff 5 Belt", 220, 176, 73, 17)
        $Buff4Belt = GUICtrlCreateCombo("2", 294, 144, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Buff5Belt = GUICtrlCreateCombo("2", 294, 176, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label12 = GUICtrlCreateLabel("Key", 340, 144, 22, 17)
        $Label13 = GUICtrlCreateLabel("Key", 340, 176, 22, 17)
        $Buff4Key = GUICtrlCreateInput("4", 364, 144, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Buff5Key = GUICtrlCreateInput("5", 364, 176, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label14 = GUICtrlCreateLabel("Delay", 408, 48, 31, 17)
        $Buff1Delay = GUICtrlCreateInput("", 440, 48, 65, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label15 = GUICtrlCreateLabel("ms", 512, 48, 17, 17)
        $Label16 = GUICtrlCreateLabel("Delay", 408, 80, 31, 17)
        $Buff2Delay = GUICtrlCreateInput("", 440, 80, 65, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label17 = GUICtrlCreateLabel("ms", 512, 80, 17, 17)
        $Label18 = GUICtrlCreateLabel("Delay", 408, 112, 31, 17)
        $Label19 = GUICtrlCreateLabel("Delay", 408, 144, 31, 17)
        $Label20 = GUICtrlCreateLabel("Delay", 408, 176, 31, 17)
        $Buff3Delay = GUICtrlCreateInput("", 440, 112, 65, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Buff4Delay = GUICtrlCreateInput("", 440, 144, 65, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Buff5Delay = GUICtrlCreateInput("", 440, 176, 65, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label21 = GUICtrlCreateLabel("ms", 512, 112, 17, 17)
        $Label22 = GUICtrlCreateLabel("ms", 512, 144, 17, 17)
        $Label23 = GUICtrlCreateLabel("ms", 512, 176, 17, 17)
        $TabSheet3 = GUICtrlCreateTabItem("Options")
        $PickUpItems = GUICtrlCreateCheckbox("Pick up Items", 220, 48, 89, 17)
        GUICtrlSetState(-1, $GUI_CHECKED)
        $UseBeserk = GUICtrlCreateCheckbox("Use Beserk When", 220, 72, 105, 17)
        GUICtrlSetState(-1, $GUI_CHECKED)
        $TownHP = GUICtrlCreateCheckbox("Return to town when out of HP Pots(Slot 9)", 220, 96, 225, 17)
        $TownMP = GUICtrlCreateCheckbox("Return to town when out of MP Pots(Slot 0)", 220, 120, 225, 17)
        $TownRepair = GUICtrlCreateCheckbox("Return to town to repair when", 220, 144, 161, 17)
        $LogHP = GUICtrlCreateCheckbox("Log Out when out of HP Pots", 220, 168, 161, 17)
        $LogMP = GUICtrlCreateCheckbox("Log Out when out of MP Pots", 220, 192, 161, 17)
        $LogDurability = GUICtrlCreateCheckbox("Log Out when ", 220, 215, 89, 17)
        $SitHeal = GUICtrlCreateCheckbox("Use Sit at", 392, 48, 65, 17)
        $SitAt = GUICtrlCreateCombo("50%", 464, 48, 73, 25)
        GUICtrlSetData(-1, "75%|50%|25%")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $DurItems = GUICtrlCreateCombo("1", 312, 214, 33, 25)
        GUICtrlSetData(-1, "1|2|3|4|5")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label56 = GUICtrlCreateLabel("items are low durability", 352, 216, 109, 17)
        $DuraItems = GUICtrlCreateCombo("1", 383, 142, 33, 25)
        GUICtrlSetData(-1, "1|2|3|4|5")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label57 = GUICtrlCreateLabel("items are low durability", 423, 144, 109, 17)
        $UseBeserkWhen = GUICtrlCreateCombo("Ready", 328, 72, 57, 25)
        GUICtrlSetData(-1, "Ready|Champ|Giant")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $TabSheet4 = GUICtrlCreateTabItem("Fighting")
        $Group2 = GUICtrlCreateGroup("Blue Mob", 232, 40, 137, 41)
        $Label28 = GUICtrlCreateLabel("Cast Skills", 240, 56, 52, 17)
        $BlueSkills = GUICtrlCreateInput("0", 296, 56, 25, 21)
        $Label29 = GUICtrlCreateLabel("Times", 328, 56, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Group3 = GUICtrlCreateGroup("Green Mob", 399, 40, 137, 41)
        $Label30 = GUICtrlCreateLabel("Cast Skills", 407, 56, 52, 17)
        $GreenSkills = GUICtrlCreateInput("0", 463, 56, 25, 21)
        $Label31 = GUICtrlCreateLabel("Times", 495, 56, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Group4 = GUICtrlCreateGroup("White Mob", 233, 87, 137, 41)
        $Label32 = GUICtrlCreateLabel("Cast Skills", 241, 103, 52, 17)
        $WhiteSkills = GUICtrlCreateInput("0", 297, 103, 25, 21)
        $Label33 = GUICtrlCreateLabel("Times", 329, 103, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Group5 = GUICtrlCreateGroup("Orange Mob", 399, 87, 137, 41)
        $Label34 = GUICtrlCreateLabel("Cast Skills", 407, 103, 52, 17)
        $OrangeSkills = GUICtrlCreateInput("0", 463, 103, 25, 21)
        $Label35 = GUICtrlCreateLabel("Times", 495, 103, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Group6 = GUICtrlCreateGroup("Red Mob", 233, 136, 137, 41)
        $Label36 = GUICtrlCreateLabel("Cast Skills", 241, 152, 52, 17)
        $RedSkills = GUICtrlCreateInput("0", 297, 152, 25, 21)
        $Label37 = GUICtrlCreateLabel("Times", 329, 152, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $RunFromRed = GUICtrlCreateCheckbox("Run From Red Mob", 400, 128, 113, 17)
        $WhenDead = GUICtrlCreateCombo("Return To Town", 384, 160, 121, 25)
        GUICtrlSetData(-1, "Log Out|Return To Town|Ask For Res")
        $Label50 = GUICtrlCreateLabel("When Dead", 432, 144, 62, 17)
        $Group7 = GUICtrlCreateGroup("Training Area", 216, 184, 321, 49)
        $Label51 = GUICtrlCreateLabel("X", 224, 208, 11, 17)
        $AreaX = GUICtrlCreateInput("", 240, 206, 57, 21)
        $Label52 = GUICtrlCreateLabel("Y", 304, 208, 11, 17)
        $AreaY = GUICtrlCreateInput("", 317, 206, 57, 21)
        $Label53 = GUICtrlCreateLabel("Area", 392, 208, 26, 17)
        $Area = GUICtrlCreateInput("", 420, 206, 57, 21)
        $SetArea = GUICtrlCreateButton("Set", 480, 203, 51, 25, 0)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $TabSheet5 = GUICtrlCreateTabItem("Wolf")
        $UseWolf = GUICtrlCreateCheckbox("Use Wolf  Belt", 224, 40, 89, 17)
        $Label38 = GUICtrlCreateLabel("HGP  Belt", 256, 72, 51, 17)
        $HGPBelt = GUICtrlCreateCombo("2", 316, 72, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $HGPKey = GUICtrlCreateInput("7", 393, 72, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label39 = GUICtrlCreateLabel("Key", 364, 72, 22, 17)
        $WolfBelt = GUICtrlCreateCombo("2", 316, 40, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label40 = GUICtrlCreateLabel("Key", 364, 40, 22, 17)
        $WolfKey = GUICtrlCreateInput("6", 393, 40, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label41 = GUICtrlCreateLabel("Wolf Pot  Belt", 240, 104, 69, 17)
        $WolfHPBelt = GUICtrlCreateCombo("2", 316, 104, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        GUICtrlSetState(-1, $GUI_DISABLE)
        $Label42 = GUICtrlCreateLabel("Key", 365, 104, 22, 17)
        $WolfHPKey = GUICtrlCreateInput("8", 393, 104, 25, 21)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $TabSheet6 = GUICtrlCreateTabItem("Shop")
        $Label46 = GUICtrlCreateLabel("Buy", 216, 40, 22, 17)
        $BuyHP = GUICtrlCreateInput("1", 240, 40, 25, 21)
        $Label47 = GUICtrlCreateLabel("Stacks of 50", 280, 40, 64, 17)
        $HPType = GUICtrlCreateCombo("HP Small", 352, 40, 97, 25)
        GUICtrlSetData(-1, "HP Herb|HP Small|HP Med|HP Large")
        $Label48 = GUICtrlCreateLabel("Buy", 216, 71, 22, 17)
        $BuyMP = GUICtrlCreateInput("1", 240, 71, 25, 21)
        $Label49 = GUICtrlCreateLabel("Stacks of 50", 280, 71, 64, 17)
        $MPType = GUICtrlCreateCombo("MP Small", 352, 71, 97, 25)
        GUICtrlSetData(-1, "MP Herb|MP Small|MP Med|MP Large")
        $Label58 = GUICtrlCreateLabel("Buy", 216, 104, 22, 17)
        $BuyArrow = GUICtrlCreateInput("0", 240, 104, 25, 21)
        $Label59 = GUICtrlCreateLabel("Stacks of 250 arrows", 280, 104, 104, 17)
        $TabSheet7 = GUICtrlCreateTabItem("Other")
        $NuBotPickup = GUICtrlCreateCheckbox("Use nuBot for pickup", 216, 40, 129, 17)
        $NuBotSearch = GUICtrlCreateCheckbox("Use nuBot for monster search", 216, 64, 161, 17)
        $AlertGM = GUICtrlCreateCheckbox("Alert on GM messages ", 216, 88, 129, 17)
        $AlertPM = GUICtrlCreateCheckbox("Alert on PM", 216, 112, 81, 17)
        $Group8 = GUICtrlCreateGroup("Giant And Champ Options", 216, 128, 321, 65)
        $Label54 = GUICtrlCreateLabel("Giant: Cast Skills An Extra", 224, 144, 126, 17)
        $GiantSkills = GUICtrlCreateInput("0", 352, 142, 25, 21)
        $Label55 = GUICtrlCreateLabel("Times", 384, 144, 32, 17)
        $Label60 = GUICtrlCreateLabel("Champ: Cast Skills An Extra", 224, 168, 134, 17)
        $ChampSkills = GUICtrlCreateInput("0", 364, 164, 25, 21)
        $Label61 = GUICtrlCreateLabel("Times", 394, 165, 32, 17)
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $Label62 = GUICtrlCreateLabel("If you need help go to :", 232, 208, 113, 17)
        $Label63 = GUICtrlCreateLabel("http://Blade..Blade..", 344, 205, 180, 24)
        GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
        GUICtrlSetColor(-1, 0x008000)
        GUICtrlCreateTabItem("")
        $Label24 = GUICtrlCreateLabel("Attack Belt", 8, 120, 56, 17)
        $AttackBelt = GUICtrlCreateCombo("1", 69, 120, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        $Label25 = GUICtrlCreateLabel("Key", 120, 120, 22, 17)
        $AttackKey = GUICtrlCreateInput("1", 144, 120, 25, 21)
        $Label26 = GUICtrlCreateLabel("Imbue Belt", 8, 144, 54, 17)
        $ImbueBelt = GUICtrlCreateCombo("1", 69, 144, 41, 25)
        GUICtrlSetData(-1, "1|2|3|4")
        $Label27 = GUICtrlCreateLabel("Key", 120, 144, 22, 17)
        $ImbueKey = GUICtrlCreateInput("2", 144, 144, 25, 21)
        $Load = GUICtrlCreateButton("Load", 80, 248, 75, 25, 0)
        $Save = GUICtrlCreateButton("Save", 223, 246, 75, 25, 0)
        $Start = GUICtrlCreateButton("AutoTrain", 375, 247, 75, 25, 0)
        $Label43 = GUICtrlCreateLabel("SRO BOT  Version 1.0", 40, 192, 118, 17)
        GUICtrlSetColor(-1, 0x000080)
        $Label44 = GUICtrlCreateLabel("Made By  ProJect Cracks Team", 40, 208, 131, 17)
        GUICtrlSetColor(-1, 0x000080)
        $Label45 = GUICtrlCreateLabel("Camera Zoom", 8, 168, 70, 17)
        $Camera = GUICtrlCreateInput("12", 80, 168, 33, 21)
        TraySetClick("9")
        $MenuItem1 = TrayCreateItem("Show Menu")
        $MenuItem2 = TrayCreateItem("Start SRO")
        $MenuItem3 = TrayCreateItem("Exit")
        GUISetState(@SW_SHOW)
        #EndRegion ### END Koda GUI section ###


        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                Exit

                        Case $SetArea
                                If $AreaX = "" Then
                                        MsgBox(64, $BotName, "You need to imput X")
                                ElseIf $AreaY = "" Then
                                        MsgBox(64, $BotName, "You need to imput Y")
                                ElseIf $Area = "" Then
                                        MsgBox(64, $BotName, "You need to imput Y")

                                Else
                                        $Coordsystem = 1
                                        $SavedX = GUICtrlRead($AreaX)
                                        $SavedY = GUICtrlRead($AreaY)
                                        $walkback = GUICtrlRead($Area)
                                        GUICtrlSetState($AreaX, $GUI_DISABLE)
                                        GUICtrlSetState($AreaY, $GUI_DISABLE)
                                        GUICtrlSetState($Area, $GUI_DISABLE)
                                EndIf

                        Case $UseBeserk
                                If GUICtrlRead($UseBeserk) = 1 Then
                                        GUICtrlSetState($UseBeserkWhen, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($UseBeserkWhen, $GUI_DISABLE)
                                EndIf

                        Case $UseBuff1
                                If GUICtrlRead($UseBuff1) = 1 Then
                                        GUICtrlSetState($Buff1Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Buff1key, $GUI_ENABLE)
                                        GUICtrlSetState($Buff1Delay, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Buff1Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Buff1key, $GUI_DISABLE)
                                        GUICtrlSetState($Buff1Delay, $GUI_DISABLE)
                                EndIf
                        Case $UseBuff2
                                If GUICtrlRead($UseBuff2) = 1 Then
                                        GUICtrlSetState($Buff2Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Buff2Key, $GUI_ENABLE)
                                        GUICtrlSetState($Buff2Delay, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Buff2Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Buff2Key, $GUI_DISABLE)
                                        GUICtrlSetState($Buff2Delay, $GUI_DISABLE)
                                EndIf
                        Case $UseBuff3
                                If GUICtrlRead($UseBuff3) = 1 Then
                                        GUICtrlSetState($Buff3Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Buff3Key, $GUI_ENABLE)
                                        GUICtrlSetState($Buff3Delay, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Buff3Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Buff3Key, $GUI_DISABLE)
                                        GUICtrlSetState($Buff3Delay, $GUI_DISABLE)
                                EndIf
                        Case $UseBuff4
                                If GUICtrlRead($UseBuff4) = 1 Then
                                        GUICtrlSetState($Buff4Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Buff4Key, $GUI_ENABLE)
                                        GUICtrlSetState($Buff4Delay, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Buff4Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Buff4Key, $GUI_DISABLE)
                                        GUICtrlSetState($Buff4Delay, $GUI_DISABLE)
                                EndIf
                        Case $UseBuff5
                                If GUICtrlRead($UseBuff5) = 1 Then
                                        GUICtrlSetState($Buff5Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Buff5Key, $GUI_ENABLE)
                                        GUICtrlSetState($Buff5Delay, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Buff5Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Buff5Key, $GUI_DISABLE)
                                        GUICtrlSetState($Buff5Delay, $GUI_DISABLE)
                                EndIf
                        Case $UseSkill1
                                If GUICtrlRead($UseSkill1) = 1 Then
                                        GUICtrlSetState($Skill1Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Skill1Key, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Skill1Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Skill1Key, $GUI_DISABLE)
                                EndIf
                        Case $UseSkill2
                                If GUICtrlRead($UseSkill2) = 1 Then
                                        GUICtrlSetState($Skill2Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Skill2Key, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Skill2Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Skill2Key, $GUI_DISABLE)
                                EndIf
                        Case $UseSkill3
                                If GUICtrlRead($UseSkill3) = 1 Then
                                        GUICtrlSetState($Skill3Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Skill3Key, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Skill3Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Skill3Key, $GUI_DISABLE)
                                EndIf
                        Case $UseSkill4
                                If GUICtrlRead($UseSkill4) = 1 Then
                                        GUICtrlSetState($Skill4Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Skill4Key, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Skill4Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Skill4Key, $GUI_DISABLE)
                                EndIf
                        Case $UseSkill5
                                If GUICtrlRead($UseSkill5) = 1 Then
                                        GUICtrlSetState($Skill5Belt, $GUI_ENABLE)
                                        GUICtrlSetState($Skill5Key, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($Skill5Belt, $GUI_DISABLE)
                                        GUICtrlSetState($Skill5Key, $GUI_DISABLE)
                                EndIf
                        Case $SitHeal
                                If GUICtrlRead($SitHeal) = 1 Then
                                        GUICtrlSetState($SitAt, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($SitAt, $GUI_DISABLE)
                                EndIf
                        Case $TownRepair
                                If GUICtrlRead($TownRepair) = 1 Then
                                        GUICtrlSetState($DuraItems, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($DuraItems, $GUI_DISABLE)
                                EndIf
                        Case $LogDurability
                                If GUICtrlRead($LogDurability) = 1 Then
                                        GUICtrlSetState($DurItems, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($DurItems, $GUI_DISABLE)
                                EndIf
                        Case $UseWolf
                                If GUICtrlRead($UseWolf) = 1 Then
                                        GUICtrlSetState($WolfBelt, $GUI_ENABLE)
                                        GUICtrlSetState($WolfKey, $GUI_ENABLE)
                                        GUICtrlSetState($HGPBelt, $GUI_ENABLE)
                                        GUICtrlSetState($HGPKey, $GUI_ENABLE)
                                        GUICtrlSetState($WolfHPBelt, $GUI_ENABLE)
                                        GUICtrlSetState($WolfHPKey, $GUI_ENABLE)
                                Else
                                        GUICtrlSetState($WolfBelt, $GUI_DISABLE)
                                        GUICtrlSetState($WolfKey, $GUI_DISABLE)
                                        GUICtrlSetState($HGPBelt, $GUI_DISABLE)
                                        GUICtrlSetState($HGPKey, $GUI_DISABLE)
                                        GUICtrlSetState($WolfHPBelt, $GUI_DISABLE)
                                        GUICtrlSetState($WolfHPKey, $GUI_DISABLE)
                                EndIf
                        Case $Save
                                $UserName1 = GUICtrlRead($UserName)
                                $Name = $UserName1 & ".ini"

                                IniWrite($Name, "login", "UserName", GUICtrlRead($UserName))
                                IniWrite($Name, "login", "PassWord", GUICtrlRead($PassWord))
                                IniWrite($Name, "login", "Char", GUICtrlRead($char))
                                IniWrite($Name, "Skills", "Skill1Belt", GUICtrlRead($Skill1Belt))
                                IniWrite($Name, "Skills", "Skill2Belt", GUICtrlRead($Skill2Belt))
                                IniWrite($Name, "Skills", "Skill3Belt", GUICtrlRead($Skill3Belt))
                                IniWrite($Name, "Skills", "Skill4Belt", GUICtrlRead($Skill4Belt))
                                IniWrite($Name, "Skills", "Skill5Belt", GUICtrlRead($Skill5Belt))
                                IniWrite($Name, "Skills", "Skill1Key", GUICtrlRead($Skill1Key))
                                IniWrite($Name, "Skills", "Skill2Key", GUICtrlRead($Skill2Key))
                                IniWrite($Name, "Skills", "Skill3Key", GUICtrlRead($Skill3Key))
                                IniWrite($Name, "Skills", "Skill4Key", GUICtrlRead($Skill4Key))
                                IniWrite($Name, "Skills", "Skill5Key", GUICtrlRead($Skill5Key))
                                IniWrite($Name, "Skills", "UseSkill1", GUICtrlRead($UseSkill1))
                                IniWrite($Name, "Skills", "UseSkill2", GUICtrlRead($UseSkill2))
                                IniWrite($Name, "Skills", "UseSkill3", GUICtrlRead($UseSkill3))
                                IniWrite($Name, "Skills", "UseSkill4", GUICtrlRead($UseSkill4))
                                IniWrite($Name, "Skills", "UseSkill5", GUICtrlRead($UseSkill5))
                                IniWrite($Name, "Buffs", "UseBuff1", GUICtrlRead($UseBuff1))
                                IniWrite($Name, "Buffs", "UseBuff2", GUICtrlRead($UseBuff2))
                                IniWrite($Name, "Buffs", "UseBuff3", GUICtrlRead($UseBuff3))
                                IniWrite($Name, "Buffs", "UseBuff4", GUICtrlRead($UseBuff4))
                                IniWrite($Name, "Buffs", "UseBuff5", GUICtrlRead($UseBuff5))
                                IniWrite($Name, "Buffs", "Buff1Belt", GUICtrlRead($Buff1Belt))
                                IniWrite($Name, "Buffs", "Buff2Belt", GUICtrlRead($Buff2Belt))
                                IniWrite($Name, "Buffs", "Buff3Belt", GUICtrlRead($Buff3Belt))
                                IniWrite($Name, "Buffs", "Buff4Belt", GUICtrlRead($Buff4Belt))
                                IniWrite($Name, "Buffs", "Buff5Belt", GUICtrlRead($Buff5Belt))
                                IniWrite($Name, "Buffs", "Buff1Delay", GUICtrlRead($Buff1Delay))
                                IniWrite($Name, "Buffs", "Buff2Delay", GUICtrlRead($Buff2Delay))
                                IniWrite($Name, "Buffs", "Buff3Delay", GUICtrlRead($Buff3Delay))
                                IniWrite($Name, "Buffs", "Buff4Delay", GUICtrlRead($Buff4Delay))
                                IniWrite($Name, "Buffs", "Buff5Delay", GUICtrlRead($Buff5Delay))
                                IniWrite($Name, "Options", "AttackBelt", GUICtrlRead($AttackBelt))
                                IniWrite($Name, "Options", "AttackKey", GUICtrlRead($AttackKey))
                                IniWrite($Name, "Options", "ImbueKey", GUICtrlRead($ImbueKey))
                                IniWrite($Name, "Options", "ImbueBelt", GUICtrlRead($ImbueBelt))
                                IniWrite($Name, "Options", "PickUpItems", GUICtrlRead($PickUpItems))
                                IniWrite($Name, "Options", "UseBeserk", GUICtrlRead($UseBeserk))
                                IniWrite($Name, "Options", "UseBeserkWhen", GUICtrlRead($UseBeserkWhen))
                                IniWrite($Name, "Options", "TownHP", GUICtrlRead($TownHP))
                                IniWrite($Name, "Options", "TownMP", GUICtrlRead($TownMP))
                                IniWrite($Name, "Options", "SitHeal", GUICtrlRead($SitHeal))
                                IniWrite($Name, "Options", "SitAt", GUICtrlRead($SitAt))
                                IniWrite($Name, "Options", "DurItems", GUICtrlRead($DurItems))
                                IniWrite($Name, "Options", "DuraItems", GUICtrlRead($DuraItems))
                                IniWrite($Name, "Options", "TownRepair", GUICtrlRead($TownRepair))
                                IniWrite($Name, "Options", "LogHP", GUICtrlRead($LogHP))
                                IniWrite($Name, "Options", "LogMP", GUICtrlRead($LogMP))
                                IniWrite($Name, "Options", "Camera", GUICtrlRead($Camera))
                                IniWrite($Name, "Options", "LogDurability", GUICtrlRead($LogDurability))
                                IniWrite($Name, "Fighting", "BlueSkills", GUICtrlRead($BlueSkills))
                                IniWrite($Name, "Fighting", "GreenSkills", GUICtrlRead($GreenSkills))
                                IniWrite($Name, "Fighting", "WhiteSkills", GUICtrlRead($WhiteSkills))
                                IniWrite($Name, "Fighting", "OrangeSkills", GUICtrlRead($OrangeSkills))
                                IniWrite($Name, "Fighting", "RedSkills", GUICtrlRead($RedSkills))
                                IniWrite($Name, "Fighting", "RunFromRed", GUICtrlRead($RunFromRed))
                                IniWrite($Name, "Fighting", "WhenDead", GUICtrlRead($WhenDead))
                                IniWrite($Name, "Fighting", "AreaX", GUICtrlRead($AreaX))
                                IniWrite($Name, "Fighting", "AreaY", GUICtrlRead($AreaY))
                                IniWrite($Name, "Fighting", "Area", GUICtrlRead($Area))
                                IniWrite($Name, "Wolf", "UseWolf", GUICtrlRead($UseWolf))
                                IniWrite($Name, "Wolf", "WolfBelt", GUICtrlRead($WolfBelt))
                                IniWrite($Name, "Wolf", "WolfKey", GUICtrlRead($WolfKey))
                                IniWrite($Name, "Wolf", "HGPBelt", GUICtrlRead($HGPBelt))
                                IniWrite($Name, "Wolf", "HGPKey", GUICtrlRead($HGPKey))
                                IniWrite($Name, "Wolf", "WolfHPBelt", GUICtrlRead($WolfHPBelt))
                                IniWrite($Name, "Wolf", "WolfHPKey", GUICtrlRead($WolfHPKey))
                                IniWrite($Name, "Other", "NuBotPickup", GUICtrlRead($NuBotPickup))
                                IniWrite($Name, "Other", "NuBotSearch", GUICtrlRead($NuBotSearch))
                                IniWrite($Name, "Other", "AlertGM", GUICtrlRead($AlertGM))
                                IniWrite($Name, "Other", "AlertPM", GUICtrlRead($AlertPM))
                                IniWrite($Name, "Other", "GiantSkills", GUICtrlRead($GiantSkills))
                                IniWrite($Name, "Other", "ChampSkills", GUICtrlRead($ChampSkills))
                                MsgBox(64, "SROBOT", "Settings Saved")
                        Case $Load
                                $Name = FileOpenDialog("Open a File", @ScriptDir, "(*.ini)", 1 + 2)
                                If @error Then
                                        MsgBox(4096, "", "No File(s) chosen")
                                Else
                                        $Name = StringReplace($Name, "|", @CRLF)
                                EndIf

                                ;$Name = InputBox("SRO BOT","Enter The Name of the ini file")

                                If @error <> 1 And $Name <> "" Then
                                        $_UserName = IniRead($Name, "login", "UserName", "")
                                        $_PassWord = IniRead($Name, "login", "PassWord", "")
                                        $_Char = IniRead($Name, "login", "Char", "")
                                        $_Skill1Belt = IniRead($Name, "Skills", "Skill1Belt", "")
                                        $_Skill2Belt = IniRead($Name, "Skills", "Skill2Belt", "")
                                        $_Skill3Belt = IniRead($Name, "Skills", "Skill3Belt", "")
                                        $_Skill4Belt = IniRead($Name, "Skills", "Skill4Belt", "")
                                        $_Skill5Belt = IniRead($Name, "Skills", "Skill5Belt", "")
                                        $_Skill1Key = IniRead($Name, "Skills", "Skill1Key", "")
                                        $_Skill2Key = IniRead($Name, "Skills", "Skill2Key", "")
                                        $_Skill3Key = IniRead($Name, "Skills", "Skill3Key", "")
                                        $_Skill4Key = IniRead($Name, "Skills", "Skill4Key", "")
                                        $_Skill5Key = IniRead($Name, "Skills", "Skill5Key", "")
                                        $_UseSkill1 = IniRead($Name, "Skills", "UseSkill1", "")
                                        $_UseSkill2 = IniRead($Name, "Skills", "UseSkill2", "")
                                        $_UseSkill3 = IniRead($Name, "Skills", "UseSkill3", "")
                                        $_UseSkill4 = IniRead($Name, "Skills", "UseSkill4", "")
                                        $_UseSkill5 = IniRead($Name, "Skills", "UseSkill5", "")
                                        $_UseBuff1 = IniRead($Name, "Buffs", "UseBuff1", "")
                                        $_UseBuff2 = IniRead($Name, "Buffs", "UseBuff2", "")
                                        $_UseBuff3 = IniRead($Name, "Buffs", "UseBuff3", "")
                                        $_UseBuff4 = IniRead($Name, "Buffs", "UseBuff4", "")
                                        $_UseBuff5 = IniRead($Name, "Buffs", "UseBuff5", "")
                                        $_Buff1Belt = IniRead($Name, "Buffs", "Buff1Belt", "")
                                        $_Buff2Belt = IniRead($Name, "Buffs", "Buff2Belt", "")
                                        $_Buff3Belt = IniRead($Name, "Buffs", "Buff3Belt", "")
                                        $_Buff4Belt = IniRead($Name, "Buffs", "Buff4Belt", "")
                                        $_Buff5Belt = IniRead($Name, "Buffs", "Buff5Belt", "")
                                        $_Buff1Delay = IniRead($Name, "Buffs", "Buff1Delay", "")
                                        $_Buff2Delay = IniRead($Name, "Buffs", "Buff2Delay", "")
                                        $_Buff3Delay = IniRead($Name, "Buffs", "Buff3Delay", "")
                                        $_Buff4Delay = IniRead($Name, "Buffs", "Buff4Delay", "")
                                        $_Buff5Delay = IniRead($Name, "Buffs", "Buff5Delay", "")
                                        $_AttackBelt = IniRead($Name, "Options", "AttackBelt", "")
                                        $_AttackKey = IniRead($Name, "Options", "AttackKey", "")
                                        $_ImbueKey = IniRead($Name, "Options", "ImbueKey", "")
                                        $_ImbueBelt = IniRead($Name, "Options", "ImbueBelt", "")
                                        $_Camera = IniRead($Name, "Options", "Camera", "")
                                        $_PickUpItems = IniRead($Name, "Options", "PickUpItems", "")
                                        $_UseBeserk = IniRead($Name, "Options", "UseBeserk", "")
                                        $_UseBeserkWhen = IniRead($Name, "Options", "UseBeserkWhen", "")
                                        $_TownHP = IniRead($Name, "Options", "TownHP", "")
                                        $_TownMP = IniRead($Name, "Options", "TownMP", "")
                                        $_TownRepair = IniRead($Name, "Options", "TownRepair", "")
                                        $_LogHP = IniRead($Name, "Options", "LogHP", "")
                                        $_LogMP = IniRead($Name, "Options", "LogMP", "")
                                        $_SitHeal = IniRead($Name, "Options", "SitHeal", "")
                                        $_SitAt = IniRead($Name, "Options", "SitAt", "")
                                        $_DurItems = IniRead($Name, "Options", "DurItems", "")
                                        $_DuraItems = IniRead($Name, "Options", "DuraItems", "")
                                        $_LogDurability = IniRead($Name, "Options", "LogDurability", "")
                                        $_BlueSkills = IniRead($Name, "Fighting", "BlueSkills", "")
                                        $_GreenSkills = IniRead($Name, "Fighting", "GreenSkills", "")
                                        $_WhiteSkills = IniRead($Name, "Fighting", "WhiteSkills", "")
                                        $_OrangeSkills = IniRead($Name, "Fighting", "OrangeSkills", "")
                                        $_RedSkills = IniRead($Name, "Fighting", "RedSkills", "")
                                        $_RunFromRed = IniRead($Name, "Fighting", "RunFromRed", "")
                                        $_WhenDead = IniRead($Name, "Fighting", "WhenDead", "")
                                        $_AreaX = IniRead($Name, "Fighting", "AreaX", "")
                                        $_AreaY = IniRead($Name, "Fighting", "AreaY", "")
                                        $_Area = IniRead($Name, "Fighting", "Area", "")
                                        $_UseWolf = IniRead($Name, "Wolf", "UseWolf", "")
                                        $_WolfBelt = IniRead($Name, "Wolf", "WolfBelt", "")
                                        $_WolfKey = IniRead($Name, "Wolf", "WolfKey", "")
                                        $_HGPBelt = IniRead($Name, "Wolf", "HGPBelt", "")
                                        $_HGPKey = IniRead($Name, "Wolf", "HGPKey", "")
                                        $_WolfHPBelt = IniRead($Name, "Wolf", "WolfHPBelt", "")
                                        $_WolfHPKey = IniRead($Name, "Wolf", "WolfHPKey", "")
                                        $_ChampSkills = IniRead($Name, "Other", "ChampSkills", "")
                                        $_GiantSkills = IniRead($Name, "Other", "GiantSkills", "")
                                        $_NuBotPickup = IniRead($Name, "Other", "NuBotPickup", "")
                                        $_NuBotSearch = IniRead($Name, "Other", "NuBotSearch", "")
                                        $_AlertGM = IniRead($Name, "Other", "AlertGM", "")
                                        $_AlertPM = IniRead($Name, "Other", "AlertPM", "")
                                        GUICtrlSetData($UserName, $_UserName)
                                        GUICtrlSetData($PassWord, $_PassWord)
                                        GUICtrlSetData($char, $_Char)
                                        GUICtrlSetData($Camera, $_Camera)
                                        GUICtrlSetData($Skill1Belt, $_Skill1Belt)
                                        GUICtrlSetData($Skill2Belt, $_Skill2Belt)
                                        GUICtrlSetData($Skill3Belt, $_Skill3Belt)
                                        GUICtrlSetData($Skill4Belt, $_Skill4Belt)
                                        GUICtrlSetData($Skill5Belt, $_Skill5Belt)
                                        GUICtrlSetData($Skill1Key, $_Skill1Key)
                                        GUICtrlSetData($Skill2Key, $_Skill2Key)
                                        GUICtrlSetData($Skill3Key, $_Skill3Key)
                                        GUICtrlSetData($Skill4Key, $_Skill4Key)
                                        GUICtrlSetData($Skill5Key, $_Skill5Key)
                                        If $_UseSkill1 = 1 Then
                                                GUICtrlSetState($UseSkill1, $GUI_CHECKED)
                                                GUICtrlSetState($Skill1Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Skill1Key, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseSkill1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Skill1Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Skill1Key, $GUI_DISABLE)
                                        EndIf
                                        If $_UseSkill2 = 1 Then
                                                GUICtrlSetState($UseSkill2, $GUI_CHECKED)
                                                GUICtrlSetState($Skill2Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Skill2Key, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseSkill1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Skill2Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Skill2Key, $GUI_DISABLE)
                                        EndIf
                                        If $_UseSkill3 = 1 Then
                                                GUICtrlSetState($UseSkill3, $GUI_CHECKED)
                                                GUICtrlSetState($Skill3Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Skill3Key, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseSkill3, $GUI_UNCHECKED)
                                                GUICtrlSetState($Skill3Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Skill3Key, $GUI_DISABLE)
                                        EndIf
                                        If $_UseSkill4 = 1 Then
                                                GUICtrlSetState($UseSkill4, $GUI_CHECKED)
                                                GUICtrlSetState($Skill4Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Skill4Key, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseSkill1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Skill4Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Skill4Key, $GUI_DISABLE)
                                        EndIf
                                        If $_UseSkill5 = 1 Then
                                                GUICtrlSetState($UseSkill5, $GUI_CHECKED)
                                                GUICtrlSetState($Skill5Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Skill5Key, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseSkill5, $GUI_UNCHECKED)
                                                GUICtrlSetState($Skill5Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Skill5Key, $GUI_DISABLE)
                                        EndIf
                                        If $_UseBuff1 = 1 Then
                                                GUICtrlSetState($UseBuff1, $GUI_CHECKED)
                                                GUICtrlSetState($Buff1Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Buff1key, $GUI_ENABLE)
                                                GUICtrlSetState($Buff1Delay, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBuff1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Buff1Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Buff1key, $GUI_DISABLE)
                                                GUICtrlSetState($Buff1Delay, $GUI_DISABLE)
                                        EndIf
                                        If $_UseBuff2 = 1 Then
                                                GUICtrlSetState($UseBuff2, $GUI_CHECKED)
                                                GUICtrlSetState($Buff2Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Buff2Key, $GUI_ENABLE)
                                                GUICtrlSetState($Buff2Delay, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBuff1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Buff2Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Buff2Key, $GUI_DISABLE)
                                                GUICtrlSetState($Buff2Delay, $GUI_DISABLE)
                                        EndIf
                                        If $_UseBuff3 = 1 Then
                                                GUICtrlSetState($UseBuff3, $GUI_CHECKED)
                                                GUICtrlSetState($Buff3Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Buff3Key, $GUI_ENABLE)
                                                GUICtrlSetState($Buff3Delay, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBuff3, $GUI_UNCHECKED)
                                                GUICtrlSetState($Buff3Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Buff3Key, $GUI_DISABLE)
                                                GUICtrlSetState($Buff3Delay, $GUI_DISABLE)
                                        EndIf
                                        If $_UseBuff4 = 1 Then
                                                GUICtrlSetState($UseBuff4, $GUI_CHECKED)
                                                GUICtrlSetState($Buff4Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Buff4Key, $GUI_ENABLE)
                                                GUICtrlSetState($Buff4Delay, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBuff1, $GUI_UNCHECKED)
                                                GUICtrlSetState($Buff4Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Buff4Key, $GUI_DISABLE)
                                                GUICtrlSetState($Buff4Delay, $GUI_DISABLE)
                                        EndIf
                                        If $_UseBuff5 = 1 Then
                                                GUICtrlSetState($UseBuff5, $GUI_CHECKED)
                                                GUICtrlSetState($Buff5Belt, $GUI_ENABLE)
                                                GUICtrlSetState($Buff5Key, $GUI_ENABLE)
                                                GUICtrlSetState($Buff5Delay, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBuff5, $GUI_UNCHECKED)
                                                GUICtrlSetState($Buff5Belt, $GUI_DISABLE)
                                                GUICtrlSetState($Buff5Key, $GUI_DISABLE)
                                                GUICtrlSetState($Buff5Delay, $GUI_DISABLE)
                                        EndIf
                                        GUICtrlSetData($Buff1Belt, $_Buff1Belt)
                                        GUICtrlSetData($Buff2Belt, $_Buff2Belt)
                                        GUICtrlSetData($Buff3Belt, $_Buff3Belt)
                                        GUICtrlSetData($Buff4Belt, $_Buff4Belt)
                                        GUICtrlSetData($Buff5Belt, $_Buff5Belt)
                                        GUICtrlSetData($Buff1Delay, $_Buff1Delay)
                                        GUICtrlSetData($Buff2Delay, $_Buff2Delay)
                                        GUICtrlSetData($Buff3Delay, $_Buff3Delay)
                                        GUICtrlSetData($Buff4Delay, $_Buff4Delay)
                                        GUICtrlSetData($Buff5Delay, $_Buff5Delay)
                                        GUICtrlSetData($AttackBelt, $_AttackBelt)
                                        GUICtrlSetData($AttackKey, $_AttackKey)
                                        GUICtrlSetData($ImbueKey, $_ImbueKey)
                                        GUICtrlSetData($ImbueBelt, $_ImbueBelt)
                                        GUICtrlSetData($UseBeserkWhen, $_UseBeserkWhen)

                                        If $_PickUpItems = 1 Then
                                                GUICtrlSetState($PickUpItems, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($PickUpItems, $GUI_UNCHECKED)
                                        EndIf
                                        If $_UseBeserk = 1 Then
                                                GUICtrlSetState($UseBeserk, $GUI_CHECKED)
                                                GUICtrlSetState($UseBeserkWhen, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseBeserk, $GUI_UNCHECKED)
                                                GUICtrlSetState($UseBeserkWhen, $GUI_DISABLE)
                                        EndIf
                                        If $_TownHP = 1 Then
                                                GUICtrlSetState($TownHP, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($TownHP, $GUI_UNCHECKED)
                                        EndIf
                                        If $_TownMP = 1 Then
                                                GUICtrlSetState($TownMP, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($TownMP, $GUI_UNCHECKED)
                                        EndIf
                                        If $_TownRepair = 1 Then
                                                GUICtrlSetState($TownRepair, $GUI_CHECKED)
                                                GUICtrlSetState($DuraItems, $GUI_ENABLE)
                                                GUICtrlSetData($DuraItems, $_DuraItems)
                                        Else
                                                GUICtrlSetState($TownRepair, $GUI_UNCHECKED)
                                                GUICtrlSetState($DuraItems, $GUI_DISABLE)
                                        EndIf
                                        If $_LogHP = 1 Then
                                                GUICtrlSetState($LogHP, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($LogHP, $GUI_UNCHECKED)
                                        EndIf
                                        If $_LogMP = 1 Then
                                                GUICtrlSetState($LogMP, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($LogMP, $GUI_UNCHECKED)
                                        EndIf
                                        If $_LogDurability = 1 Then
                                                GUICtrlSetState($LogDurability, $GUI_CHECKED)
                                                GUICtrlSetState($DurItems, $GUI_ENABLE)
                                                GUICtrlSetData($DurItems, $_DurItems)
                                        Else
                                                GUICtrlSetState($LogDurability, $GUI_UNCHECKED)
                                                GUICtrlSetState($DurItems, $GUI_ENABLE)
                                        EndIf
                                        GUICtrlSetData($BlueSkills, $_BlueSkills)
                                        GUICtrlSetData($GreenSkills, $_GreenSkills)
                                        GUICtrlSetData($WhiteSkills, $_WhiteSkills)
                                        GUICtrlSetData($OrangeSkills, $_OrangeSkills)
                                        GUICtrlSetData($RedSkills, $_RedSkills)
                                        GUICtrlSetData($AreaX, $_AreaX)
                                        GUICtrlSetData($AreaY, $_AreaY)
                                        GUICtrlSetData($Area, $_Area)
                                        GUICtrlSetData($WhenDead, $_WhenDead)
                                        If $_RunFromRed = 1 Then
                                                GUICtrlSetState($RunFromRed, $GUI_CHECKED)
                                        Else
                                                GUICtrlSetState($RunFromRed, $GUI_UNCHECKED)
                                        EndIf
                                        If $_SitHeal = 1 Then
                                                GUICtrlSetState($SitHeal, $GUI_CHECKED)
                                                GUICtrlSetState($SitAt, $GUI_ENABLE)
                                                GUICtrlSetData($SitAt, $_SitAt)
                                        Else
                                                GUICtrlSetState($SitHeal, $GUI_UNCHECKED)
                                                GUICtrlSetState($SitAt, $GUI_DISABLE)
                                        EndIf
                                        If $_UseWolf = 1 Then
                                                GUICtrlSetState($UseWolf, $GUI_CHECKED)
                                                GUICtrlSetState($WolfBelt, $GUI_ENABLE)
                                                GUICtrlSetState($WolfKey, $GUI_ENABLE)
                                                GUICtrlSetState($HGPBelt, $GUI_ENABLE)
                                                GUICtrlSetState($HGPKey, $GUI_ENABLE)
                                                GUICtrlSetState($WolfHPBelt, $GUI_ENABLE)
                                                GUICtrlSetState($WolfHPKey, $GUI_ENABLE)
                                        Else
                                                GUICtrlSetState($UseWolf, $GUI_UNCHECKED)
                                                GUICtrlSetState($WolfBelt, $GUI_DISABLE)
                                                GUICtrlSetState($WolfKey, $GUI_DISABLE)
                                                GUICtrlSetState($HGPBelt, $GUI_DISABLE)
                                                GUICtrlSetState($HGPKey, $GUI_DISABLE)
                                                GUICtrlSetState($WolfHPBelt, $GUI_DISABLE)
                                                GUICtrlSetState($WolfHPKey, $GUI_DISABLE)
                                        EndIf
                                        GUICtrlSetData($WolfBelt, $_WolfBelt)
                                        GUICtrlSetData($WolfKey, $_WolfKey)
                                        GUICtrlSetData($HGPBelt, $_HGPBelt)
                                        GUICtrlSetData($HGPKey, $_HGPKey)
                                        GUICtrlSetData($WolfHPBelt, $_WolfHPBelt)
                                        GUICtrlSetData($WolfHPKey, $_WolfHPKey)
                                        If $_NuBotPickup = 1 Then
                                                GUICtrlSetState($NuBotPickup, $GUI_CHECKED)
                                        EndIf
                                        If $_NuBotSearch = 1 Then
                                                GUICtrlSetState($NuBotSearch, $GUI_CHECKED)
                                        EndIf
                                        If $_AlertGM = 1 Then
                                                GUICtrlSetState($AlertGM, $GUI_CHECKED)
                                        EndIf
                                        If $_AlertPM = 1 Then
                                                GUICtrlSetState($AlertPM, $GUI_CHECKED)
                                        EndIf
                                        GUICtrlSetData($GiantSkills, $_GiantSkills)
                                        GUICtrlSetData($ChampSkills, $_ChampSkills)
                                        MsgBox(64, "SRO BOT", "Settings Loaded")
                                EndIf

                        Case $Start
                                GUISetState(@SW_HIDE)
                                Readyy()
                EndSwitch
        WEnd
EndFunc  ;==>MainGUI


Func Pause()
        $Paused = Not $Paused
        While $Paused
                ToolTip($BotName & ": Paused ", 2, 0)
                Sleep(400)
        WEnd
EndFunc  ;==>Pause

Func stop()
        ToolTip($BotName & ": Shutting Down ", 2, 0)
        Sleep(2000)
        MsgBox(64, $BotName, "Thanks for using " & $BotName & ", Made By The Project Cracks Team.")
        Exit
EndFunc  ;==>stop

Func Wait()
        Global $Message
        $Wait = Not $Wait
        While $Wait
                ToolTip($BotName & ": Press the HOME key to start ", 2, 0)
                Sleep(400)
        WEnd
EndFunc  ;==>Wait


Func Readyy()
        If Not WinExists("SRO_Client") Then
                $Launch = MsgBox(4, $BotName, "Silkroad is not running, Would you like to launch it?")
                Select
                        Case $Launch = 6 ;Yes

                        Case $Launch = 7 ;No
                EndSelect
                If $Launch = 6 Then
                        Run("c:/program files/silkroad/silkroad.exe")
                        WinWait("Silkroad Online Launcher")
                        WinActivate("Silkroad Online Launcher")
                        ControlClick("Silkroad Online Launcher", "Start", "1000")
                        WinWaitActive("SRO_Client")
                        Sleep(500)
                EndIf
        EndIf
        Wait()
EndFunc  ;==>Readyy

Func Start()
        $Monsterlvl = 0
        $tookmoblvl = 0
        WinActivate('SRO_Client')
        CameraSetup()
        $TimerC = TimerInit()
        $PartyTimer = TimerInit()
        $PotTimer = TimerInit()
        $Buff1Timer = TimerInit()
        $Buff2Timer = TimerInit()
        $Buff3Timer = TimerInit()
        $Buff4Timer = TimerInit()
        $Buff5Timer = TimerInit()
        $ChatTimer = TimerInit()
        $BotOpenTimer = TimerInit()
        While 1
                If $AlertGM = 1 Or $AlertPM = 1 Then
                        ChatCheck()
                EndIf
                DisconnectCheck()
                CheckIfDead()
                $MonsterDead = 0
                If TimerDiff($PartyTimer) > 10 * 1000 Then
                        ToolTip($BotName & ": Party Check ", 2, 0)
                        PartyCheck()
                        $PartyTimer = TimerInit()
                EndIf
                If TimerDiff($PotTimer) > 5 * 1000 Then
                        If $LogHP = 1 Or $LogMP = 1 Or $TownHP = 1 Or $TownMP = 1 Or $TownRepair = 1 Or $LogDurability = 1 Then
                                ToolTip($BotName & ": Pot Check ", 2, 0)
                                PotCheck()
                                $PotTimer = TimerInit()
                        EndIf
                EndIf
                If $SitHeal = 1 Then
                        Sit()
                EndIf
                WolfStuff()
                If $Coordsystem = 1 Then
                        If TimerDiff($TimerC) > 8 * 1000 Then
                                ToolTip($BotName & ": Check coords ", 2, 0)
                                CheckCoords()
                                $TimerC = TimerInit()
                        EndIf
                EndIf
                If $UseBuff1 = 1 Or $UseBuff2 = 1 Or $UseBuff3 = 1 Or $UseBuff4 = 1 Or $UseBuff5 = 1 Then
                        Buff()
                EndIf
                If $NuBotSearch = 1 Then
                        NuBotSearch()
                Else
                        ToolTip($BotName & ": Searching for monsters ", 2, 0)
                        CheckMonster()
                EndIf
        WEnd
EndFunc  ;==>AutoTrain

;-------------------------------Camera Setup------------------------------------------------------------------------------
Func CameraSetup()
        ToolTip($BotName & ": Setting Camera ", 2, 0)
        WinActivate('SRO_Client')
        Send("{F9}")
        $nRotation = PixelGetColor(961, 104)
        Sleep(500)
        While $nRotation <> 16711680
                Send("{right down}")
                $nRotation = PixelGetColor(961, 114)
        WEnd
        Send("{right up}")
        Send("{F9}")
        Send("{F9}")
        MouseMove(500, 90, 0)
        Sleep(500)
        MouseClickDrag("right", 500, 90, 500, 610, 10)
        Sleep(500)
        MouseWheel("Up", 25)
        MouseWheel("down", $Camera)
        Sleep(100)
EndFunc  ;==>CameraSetup


;----------------------------Checks----------------------------------------------------------------------------------------
Func ChatCheck()
        If TimerDiff($ChatTimer) > 5500 Then
                If $AlertGM = 1 Then
                        $ChatTimer = TimerInit()
                        $ChatCoord = PixelSearch(23, 566, 396, 690, 0xFFAEC3, 2)
                        If Not @error Then
                                SoundPlay("C:\Windows\media\notify.wav")
                        EndIf
                EndIf
                If $AlertPM = 1 Then
                        $ChatTimer = TimerInit()
                        $ChatCoord = PixelSearch(23, 566, 396, 690, 0x9FFFFE, 2)
                        If Not @error Then
                                SoundPlay("C:\Windows\media\notify.wav")
                        EndIf
                EndIf
        EndIf
EndFunc  ;==>ChatCheck


Func CheckIfDead()
        If PixelGetColor(539, 494) = 0xFEFBD8 Then
                ToolTip($BotName & ": You Died ", 2, 0)
                Sleep(1000)
                If $WhenDead = "Log Out" Then
                        Send("{ESC}")
                        Sleep(250)
                        MouseClick("left", 500, 450, 2)
                        Exit
                EndIf
                If $WhenDead = "Return To Town" Then
                        MouseClick("Left", 473, 490)
                        Sleep(1000)
                EndIf
                If $WhenDead = "Ask For Res" Then
                        MouseClick("Left", 627, 489)
                        Sleep(1000)
                        MouseClick("Left", 69, 553)
                        Sleep(1000)
                        Send("{Enter}")
                        Send("{BackSpace Down}")
                        Sleep(2000)
                        Send("{BackSpace Up}")
                        $ResTimer = TimerInit()

                        While 1
                                $ResMessage = Random(0, 7, 1)
                                If $ResMessage = 0 Then
                                        Send("can someone please res me")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 1 Then
                                        Send("please res me")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 2 Then
                                        Send("please someone res me")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 3 Then
                                        Send("hey could you res me plz")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 4 Then
                                        Send("can i get a res please")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 5 Then
                                        Send("can someone please res me")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 6 Then
                                        Send("res please")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If $ResMessage = 7 Then
                                        Send("anyone wanna resurect me")
                                        Send("{Enter}")
                                        Sleep(16000)
                                EndIf
                                If PixelGetColor(539, 494) = 0xFEFBD8 Then
                                        MouseClick("Left", 473, 490)
                                        Sleep(1000)
                                        $RandMes = Random(1, 4, 1)
                                        If $RandMes = 1 Then
                                                Send("thanks")
                                        EndIf
                                        If $RandMes = 2 Then
                                                Send("thx")
                                        EndIf
                                        If $RandMes = 3 Then
                                                Send("awsome thx")
                                        EndIf
                                        If $RandMes = 4 Then
                                                Send("Thank you")
                                        EndIf
                                        ExitLoop
                                EndIf
                                If TimerDiff($ResTimer) > 350000 Then
                                        Send("{ESC}")
                                        Sleep(250)
                                        MouseClick("left", 500, 450, 2)
                                        Exit
                                EndIf
                        WEnd
                EndIf
        EndIf
EndFunc  ;==>CheckIfDead


Func DisconnectCheck()
        ToolTip($BotName & ": Disconnect Check ", 2, 0)
        PixelSearch(376, 323, 381, 328, 0x1F1F1F, 10)
        If Not @error Then
                PixelSearch(397, 377, 402, 382, 0x292421, 5)
                If Not @error Then
                        PixelSearch(480, 422, 485, 427, 0x7B6B4A, 10)
                        If Not @error Then
                                MouseMove(510, 421)
                                Sleep(1000)
                        EndIf

                        PixelSearch(480, 422, 485, 427, 0x9C4A31, 10)
                        If Not @error Then
                                MouseClick("Left", 510, 421) ;Closes Disconnect Box
                                Reconnect()
                        EndIf
                EndIf
        EndIf
EndFunc  ;==>DisconnectCheck


Func PotCheck()
        Send("{F1}")
        Sleep(500)
        If $LogHP = 1 Then
                ToolTip($BotName & ": Checking Pots ", 2, 0)
                PixelSearch(692, 731, 716, 754, 0x080008, 15)
                If @error Then
                        ToolTip($BotName & ": Pots not found , check once more ", 2, 0)
                        PixelSearch(692, 731, 716, 754, 0x000831, 15)
                        If @error Then
                                Send("{ESC}")
                                Sleep(250)
                                MouseClick("left", 500, 450, 2)
                                Exit
                        EndIf
                EndIf
        EndIf
        If $LogMP = 1 Then
                PixelSearch(728, 732, 752, 754, 0x1942EF, 15)
                If @error Then
                        ToolTip($BotName & ": Pots not found , check once more ", 2, 0)
                        PixelSearch(728, 732, 752, 754, 0x1942EF, 15)
                        If @error Then
                                Send("{ESC}")
                                Sleep(250)
                                MouseClick("left", 500, 450, 2)
                                Exit
                        EndIf
                EndIf
        EndIf
        If $LogDurability = 1 Then
                $BrokenItems = 0
                If PixelGetColor(984, 240) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 278) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 310) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 345) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 380) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf

                If $BrokenItems >= $DurItems Then
                        Send("{esc}")
                        Sleep(300)
                        MouseMove(500, 450, 0)
                        Sleep(250)
                        MouseClick("left", 500, 450, 2)
                        MsgBox(0, "NOTICE", "Durability CRITICAL, Silkroad Shutdown")
                        Exit
                EndIf
        EndIf


        If $TownHP = 1 Then
                ToolTip($BotName & ": Checking Pots ", 2, 0)
                PixelSearch(692, 731, 716, 754, 0xCE0000, 15)
                If @error Then
                        ToolTip($BotName & ": Pots not found , check once more ", 2, 0)
                        PixelSearch(692, 731, 716, 754, 0xCE0000, 15)
                        If @error Then
                                GoToTown()
                        EndIf
                EndIf
        EndIf

        If $TownMP = 1 Then
                PixelSearch(728, 732, 752, 754, 0x1942EF, 15)
                If @error Then
                        ToolTip($BotName & ": Pots not found , check once more ", 2, 0)
                        PixelSearch(728, 732, 752, 754, 0x1942EF, 15)
                        If @error Then
                                GoToTown()
                        EndIf
                EndIf
        EndIf

        If $TownRepair = 1 Then
                $BrokenItems = 0
                If PixelGetColor(984, 240) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 278) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 310) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 345) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf
                If PixelGetColor(984, 380) = 0xD40E00 Then
                        $BrokenItems = $BrokenItems + 1
                EndIf

                If $BrokenItems >= $DurItems Then
                        GoToTown()
                EndIf
        EndIf
EndFunc  ;==>PotCheck


Func PartyCheck()
        If $PartyLeader = 1 Then
                PixelSearch(437, 457, 442, 465, 0x73634A, 1)
                If Not @error Then
                        MouseClick("left", 464, 459)
                        Sleep(500)
                EndIf
        EndIf
        PixelSearch(12, 151, 14, 156, 0x000000, 5)
        If @error Then
                AutoParty()
        Else
                $autoParty = 0
        EndIf
EndFunc  ;==>PartyCheck

;-----------------------------------------------------------------------------------------------------------------------------


;-------------Sit--------------------------------------------------------------------------------------------------------------
Func Sit()
        ToolTip($BotName & ": Sitting ", 2, 0)
        If $SitAt = "75%" Then
                PixelSearch(184, 34, 186, 42, 0x181618, 12)
                If Not @error Then
                        Send("{n}")
                EndIf
        EndIf
        If $SitAt = "50%" Then
                PixelSearch(138, 34, 140, 42, 0x181618, 12)
                If Not @error Then
                        Send("{n}")
                EndIf
        EndIf
        If $SitAt = "25%" Then
                PixelSearch(104, 34, 106, 42, 0x181618, 12)
                If Not @error Then
                        Send("{n}")
                EndIf
        EndIf
        While PixelGetColor(205, 37) = 0x181618
                Sleep(1000)
                If PixelGetColor(539, 494) = 0xFEFBD8 Then
                        ToolTip($BotName & ": You Died ", 2, 0)
                        CheckIfDead()
                EndIf
        WEnd
        Send("{n}")
EndFunc  ;==>Sit
;-----------------------------------------------------------------------------------------------------------------------------


;------------------Login, reconnect, restart------------------------------------------------------------------------------------
Func loginn()
        ToolTip($BotName & ": Logging In ", 2, 0)
        Sleep(2000)
        WinActivate("SRO_Client")
        Sleep(250)
        MouseClick("left", 456, 232)
        Sleep(4000)
        ControlSend("SRO_Client", "", "", "{ENTER}")
        Sleep(1000)
        Sleep(1000)
        ControlSend("SRO_Client", "", "", "{TAB}")
        Sleep(1000)
        Send($UserName)
        Sleep(1000)
        ControlSend("SRO_Client", "", "", "{TAB}")
        Sleep(1000)
        Send($PassWord)
        Sleep(1000)
        ControlSend("SRO_Client", "", "", "{Enter}")
        While PixelGetColor(500, 755) = 0xFFFFFF
                $disconnect = PixelSearch(410, 360, 420, 370, 0x313131, 25, 1)
                If Not @error Then
                        Sleep(250)
                        MouseMove(505, 425, 0)
                        MouseClick("left", 510, 425)
                        Sleep(250)
                        MouseClick("left", 510, 425)
                        Sleep(2000)
                        DisconnectCheck()
                EndIf
                ControlSend("SRO_Client", "", "", "{ENTER}")
                Sleep(1000)
        WEnd
        charselect()
EndFunc  ;==>loginn


Func charselect()
        ToolTip($BotName & ": Selecting Char ", 2, 0)
        Sleep(4000)
        $char = PixelSearch(185, 70, 265, 95, 0xD5BC89, 25)
        If Not @error Then
                Sleep(2000)
                If $char = 1 Then
                        MouseMove(325, 348, 0)
                        MouseClick("left", 325, 348, 2)
                        MouseClick("left", 325, 348, 2)
                EndIf
                If $char = 2 Then
                        MouseMove(521, 362, 0)
                        MouseClick("left", 521, 362, 2)
                        MouseClick("left", 521, 362, 2)
                EndIf
                If $char = 3 Then
                        MouseMove(704, 374, 0)
                        MouseClick("left", 704, 374, 2)
                        MouseClick("left", 704, 374, 2)
                EndIf
                Sleep(800)
                If PixelGetColor(857, 204) = 16737131 Then
                        Sleep(2200)
                        MouseMove(791, 710, 0)
                        MouseClick("left", 791, 710, 2)
                EndIf
                While PixelGetColor(922, 41) = 0x000000
                        Sleep(2000)
                WEnd
                Sleep(2000)
                CameraSetup()
        EndIf
EndFunc  ;==>charselect

Func Reconnect()
        Sleep(8000)
        Run("C:\Program Files\Silkroad\silkroad.exe")
        WinActivate("Silkroad Online Launcher")
        Sleep(250)
        MouseMove(680, 435, 0)
        Sleep(250)
        $Start = PixelSearch(625, 430, 670, 440, 0xFFFFFF)
        If Not @error Then
                Sleep(250)
                MouseClick("Left", 746, 520, 2)
                Sleep(500)
                WinWaitActive("SRO_Client")
                MouseClick("left", 830, 436, 2)
                loginn()
        Else
                Sleep(3000)
                $Start = PixelSearch(625, 430, 670, 440, 0xFFFFFF)
                If Not @error Then
                        Sleep(250)
                        MouseClick("Left", 746, 520, 2)
                        Sleep(500)
                        WinWaitActive("SRO_Client")
                        MouseClick("left", 830, 436, 2)
                        loginn()
                Else
                        ProcessClose("Silkroad Online Launcher")
                        Sleep(2000)
                        Reconnect()
                EndIf
        EndIf
EndFunc  ;==>Reconnect


;------------------------------------Party Functions-------------------------------------------------------------------------------
Func AutoParty()
        ToolTip($BotName & ": Looking for a party", 2, 0)
        Sleep(2000)
        Send("e")
        Sleep(3000)
        MouseClick("Left", 520, 588) ; Next Page
        Sleep(3000)
        MouseClick("Left", 392, 586) ; Auto Match
        Sleep(500)
        MouseClick("Left", 462, 523) ; Click Confirm Button
        Sleep(500)
        Send("e")
        Sleep(1500)
        $autoParty = $autoParty + 1
        If $autoParty = 6 Then
                MakeParty()
        EndIf
EndFunc  ;==>AutoParty

Func MakeParty()
        ToolTip($BotName & ": Making a party", 2, 0)
        Sleep(2000)
        Send("e")
        Sleep(3000)
        MouseClick("Left", 614, 589) ; Form Party
        Sleep(3000)
        MouseClick("Left", 461, 539) ; Click Confirm Button
        Sleep(500)
        Send("e")
        Sleep(1500)
        $PartyLeader = 1
EndFunc  ;==>MakeParty


Func PartyAccept()
        PixelSearch(437, 457, 442, 465, 0x73634A, 1) ;Invite Party Box
        If Not @error Then
                MouseClick("left", 464, 459)
                Sleep(500)
        EndIf
EndFunc  ;==>PartyAccept


;------------------------------------------------------------------------------------------------------------------------------


;------------Wolf--------------------------------------------------------------------------------------------------------------
Func WolfStuff()
        If PixelGetColor(106, 94) <> 0x8C5B00 Then ; If wolf not summoned
                If $WolfBelt = 1 Then
                        Send("{F1}")
                EndIf
                If $WolfBelt = 2 Then
                        Send("{F2}")
                EndIf
                If $WolfBelt = 3 Then
                        Send("{F3}")
                EndIf
                If $WolfBelt = 4 Then
                        Send("{F4}")
                EndIf
                Send($WolfKey)
        EndIf
        If PixelGetColor(106, 94) = 0x8C5B00 Then ; If wolf is summoned then
                If (PixelGetColor(152, 93) <> 16766546) Then
                        If $HGPBelt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $HGPBelt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $HGPBelt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $HGPBelt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($HGPKey)
                        Sleep(1000)
                EndIf

                If (PixelGetColor(152, 87) <> 16724273) Then
                        If $WolfHPBelt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $WolfHPBelt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $WolfHPBelt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $WolfHPBelt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($WolfHPKey)
                        Sleep(1000)
                EndIf
        EndIf
EndFunc  ;==>WolfStuff


;---------------------Monster Search--------------------------------------------------------------------------------------------
Func CheckMonster()
        $CastSkill = 0
        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
        If Not @error Then
                Attack()
        EndIf
        $MonsterLightNotFound = 0
        ;MONSTRZ light
        MonsterNearCheck()
        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
        If Not @error Then
                Attack()
        EndIf
        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
        If Not @error Then
                Attack()
        EndIf
        $coord = PixelSearch(672, 220, 953, 676, 0xFF00FF, 25, 0)
        If Not @error Then
                MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                Attack()
        Else
                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                If Not @error Then
                        Attack()
                EndIf
                $coord = PixelSearch(127, 220, 361, 539, 0xFF00FF, 25, 0)
                If Not @error Then
                        MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                        Attack()
                Else
                        MonsterNearCheck()
                        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                        If Not @error Then
                                Attack()
                        EndIf
                        $coord = PixelSearch(125, 79, 362, 219, 0xFF00FF, 25, 0)
                        If Not @error Then
                                MouseClick("left", $coord[0] + 2, $coord[1] + 2, 1, 0)
                                Attack()
                        Else
                                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                If Not @error Then
                                        Attack()
                                EndIf
                                $coord = PixelSearch(671, 78, 894, 220, 0xFF00FF, 25, 0)
                                If Not @error Then
                                        MouseClick("left", $coord[0] + 2, $coord[1] + 2, 1, 0)
                                        Attack()
                                Else
                                        $MonsterLightNotFound = 1
                                        $MonsterNotFound = $MonsterNotFound + 1
                                EndIf
                        EndIf
                EndIf
        EndIf

        If $MonsterNotFound = 5 Then
                Send("{right down}") ;Holds the A key down
                Sleep(500)
                Send("{right up}") ;Releases the A key
                Send("{up down}")
                Sleep(4000)
                Send("{up up}")
                $MonsterNotFound = 0
        EndIf

        If $MonsterLightNotFound = 1 Then
                ;MONSTRZ dark
                MonsterNearCheck()
                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                If Not @error Then
                        Attack()
                EndIf
                $coord = PixelSearch(672, 220, 953, 676, 0x5E006D, 25, 0)
                If Not @error Then
                        MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                        Attack()
                Else
                        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                        If Not @error Then
                                Attack()
                        EndIf
                        $coord = PixelSearch(127, 220, 361, 539, 0x5E006D, 25, 0)
                        If Not @error Then
                                MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                                Attack()
                        Else
                                MonsterNearCheck()
                                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                If Not @error Then
                                        Attack()
                                EndIf
                                $coord = PixelSearch(125, 79, 362, 219, 0x5E006D, 25, 0)
                                If Not @error Then
                                        MouseClick("left", $coord[0] + 2, $coord[1] + 2, 1, 0)
                                        Attack()
                                Else
                                        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                        If Not @error Then
                                                Attack()
                                        EndIf
                                        $coord = PixelSearch(671, 78, 894, 220, 0x5E006D, 25, 0)
                                        If Not @error Then
                                                MouseClick("left", $coord[0] + 2, $coord[1] + 2, 1, 0)
                                                Attack()
                                        EndIf
                                        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                        If Not @error Then
                                                Attack()
                                        EndIf
                                EndIf
                        EndIf
                EndIf

        EndIf
EndFunc  ;==>CheckMonster

Func MonsterNearCheck()
        ;Monster Light
        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
        If Not @error Then
                Attack()
        EndIf
        $coord = PixelSearch(364, 444, 671, 714, 0xFF00FF, 25, 0)
        If Not @error Then
                MouseClick("left", $coord[0] + 10, $coord[1] + 10, 1, 0)
                Attack()
        Else
                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                If Not @error Then
                        Attack()
                EndIf
                $coord = PixelSearch(362, 78, 671, 442, 0xFF00FF, 25, 0)
                If Not @error Then
                        MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                        Attack()
                Else
                        ;Monster Dark
                        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                        If Not @error Then
                                Attack()
                        EndIf
                        $coord = PixelSearch(364, 444, 671, 714, 0x5E006D, 25, 0)
                        If Not @error Then
                                MouseClick("left", $coord[0] + 10, $coord[1] + 10, 1, 0)
                                Attack()
                        Else
                                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                If Not @error Then
                                        Attack()
                                EndIf
                                $coord = PixelSearch(362, 78, 671, 442, 0x5E006D, 25, 0)
                                If Not @error Then
                                        MouseClick("left", $coord[0] + 5, $coord[1] + 5, 1, 0)
                                        Attack()
                                EndIf
                                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                                If Not @error Then
                                        Attack()
                                EndIf
                        EndIf
                EndIf
        EndIf
EndFunc  ;==>MonsterNearCheck

Func NuBotSearch()
        $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
        If Not @error Then
                Attack()
        Else
                Sleep(500)
        EndIf
EndFunc  ;==>NuBotSearch

;-----------------------------------------------------------------------------------------------------------------------------

Func RunAway()
        Send("{up down}")
        Sleep(8000)
        Send("{up up}")
        MouseClick("Left", 598, 24)
EndFunc  ;==>RunAway


;--------------------Attack and pickup-------------------------------------------------------------------------------------------
Func Attack()
        ToolTip($BotName & ": Checking Mob", 2, 0)
        If $UseBeserkWhen = "Ready" Then
                PixelSearch(18, 4, 35, 16, 0xFFC3ED, 15)
                If Not @error Then
                        Send("{TAB}")
                EndIf
        EndIf
        While $MonsterDead <> 1
                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10) ; Check Monster HP
                If Not @error Then
                        $stuck = TimerInit()


                        ToolTip($BotName & ": Checking Mob Lvl...", 2, 0)
                        ;1st lvl mob
                        $mobcolor = PixelSearch(434, 18, 444, 25, 0x084364, 20)
                        If Not @error Then
                                $Monsterlvl = 1
                                $champion = PixelGetColor(495, 69)
                                $giant = PixelGetColor(496, 70)
                                If $champion = 1642577 Then
                                        $MonsterChamp = 1
                                Else
                                        $MonsterChamp = 0
                                EndIf
                                If $giant = 543364 Then
                                        $MonsterGiant = 1
                                Else
                                        $MonsterGiant = 0
                                EndIf
                                $tookmoblvl = 1
                        EndIf
                        $mobcolor = PixelSearch(434, 18, 444, 25, 0x2A7855, 20)
                        ;2nd lvl mob
                        If Not @error Then
                                $Monsterlvl = 2
                                $champion = PixelGetColor(495, 69)
                                $giant = PixelGetColor(496, 70)
                                If $champion = 1642577 Then
                                        $MonsterChamp = 1
                                Else
                                        $MonsterChamp = 0
                                EndIf
                                If $giant = 543364 Then
                                        $MonsterGiant = 1
                                Else
                                        $MonsterGiant = 0
                                EndIf
                                $tookmoblvl = 1
                        EndIf
                        $mobcolor = PixelSearch(434, 18, 444, 25, 0x717171, 20)
                        ;3rd lvl mob
                        If Not @error Then
                                $Monsterlvl = 3
                                $champion = PixelGetColor(495, 69)
                                $giant = PixelGetColor(496, 70)
                                If $champion = 1642577 Then
                                        $MonsterChamp = 1
                                Else
                                        $MonsterChamp = 0
                                EndIf
                                If $giant = 543364 Then
                                        $MonsterGiant = 1
                                Else
                                        $MonsterGiant = 0
                                EndIf
                                $tookmoblvl = 1
                        EndIf
                        $mobcolor = PixelSearch(435, 18, 442, 25, 15644512, 20)
                        ;4th lvl mob
                        If Not @error Then
                                $Monsterlvl = 4
                                $champion = PixelGetColor(495, 69)
                                $giant = PixelGetColor(496, 70)
                                If $champion = 1642577 Then
                                        $MonsterChamp = 1
                                Else
                                        $MonsterChamp = 0
                                EndIf
                                If $giant = 543364 Then
                                        $MonsterGiant = 1
                                Else
                                        $MonsterGiant = 0
                                EndIf
                                $tookmoblvl = 1
                        EndIf
                        $mobcolor = PixelSearch(435, 18, 442, 25, 14832443, 20)
                        ;5th lvl mob
                        If Not @error Then
                                $Monsterlvl = 5
                                $champion = PixelGetColor(495, 69)
                                $giant = PixelGetColor(496, 70)
                                If $champion = 1642577 Then
                                        $MonsterChamp = 1
                                Else
                                        $MonsterChamp = 0
                                EndIf
                                If $giant = 543364 Then
                                        $MonsterGiant = 1
                                Else
                                        $MonsterGiant = 0
                                EndIf
                                $tookmoblvl = 1
                                If $Monsterlvl = 0 Then
                                        NormalAttack()
                                EndIf
                        EndIf
                        ToolTip($BotName & ": Attacking...", 2, 0)

                        ;-------------------LVL 1 MOB--------------------------------------------------------------------------------------------

                        If $BlueSkills > $CastSkill Then
                                $RandomSkill = Random(1, 5, 1)
                                If $UseSkill1 = 1 Then
                                        If $RandomSkill = 1 Then
                                                If $Skill1Belt = 1 Then
                                                        Send("{F1}")
                                                EndIf
                                                If $Skill1Belt = 2 Then
                                                        Send("{F2}")
                                                EndIf
                                                If $Skill1Belt = 3 Then
                                                        Send("{F3}")
                                                EndIf
                                                If $Skill1Belt = 4 Then
                                                        Send("{F4}")
                                                EndIf
                                                Send($Skill1Key)
                                                Sleep(500)
                                                $CastSkill = $CastSkill + 1
                                        EndIf
                                EndIf

                                If $UseSkill2 = 1 Then
                                        If $RandomSkill = 2 Then
                                                If $Skill2Belt = 1 Then
                                                        Send("{F1}")
                                                EndIf
                                                If $Skill2Belt = 2 Then
                                                        Send("{F2}")
                                                EndIf
                                                If $Skill2Belt = 3 Then
                                                        Send("{F3}")
                                                EndIf
                                                If $Skill2Belt = 4 Then
                                                        Send("{F4}")
                                                EndIf
                                                Send($Skill2Key)
                                                Sleep(500)
                                                $CastSkill = $CastSkill + 1
                                        EndIf
                                EndIf

                                If $UseSkill3 = 1 Then
                                        If $RandomSkill = 3 Then
                                                If $Skill3Belt = 1 Then
                                                        Send("{F1}")
                                                EndIf
                                                If $Skill3Belt = 2 Then
                                                        Send("{F2}")
                                                EndIf
                                                If $Skill3Belt = 3 Then
                                                        Send("{F3}")
                                                EndIf
                                                If $Skill3Belt = 4 Then
                                                        Send("{F4}")
                                                EndIf
                                                Send($Skill3Key)
                                                Sleep(500)
                                                $CastSkill = $CastSkill + 1
                                        EndIf

                                        If $RandomSkill = 4 Then
                                                If $Skill4Belt = 1 Then
                                                        Send("{F1}")
                                                EndIf
                                                If $Skill4Belt = 2 Then
                                                        Send("{F2}")
                                                EndIf
                                                If $Skill4Belt = 3 Then
                                                        Send("{F3}")
                                                EndIf
                                                If $Skill4Belt = 4 Then
                                                        Send("{F4}")
                                                EndIf
                                                Send($Skill4Key)
                                                Sleep(500)
                                                $CastSkill = $CastSkill + 1
                                        EndIf
                                EndIf

                                If $UseSkill5 = 1 Then
                                        If $RandomSkill = 5 Then
                                                If $Skill5Belt = 1 Then
                                                        Send("{F1}")
                                                EndIf
                                                If $Skill5Belt = 2 Then
                                                        Send("{F2}")
                                                EndIf
                                                If $Skill5Belt = 3 Then
                                                        Send("{F3}")
                                                EndIf
                                                If $Skill5Belt = 4 Then
                                                        Send("{F4}")
                                                EndIf
                                                Send($Skill5Key)
                                                Sleep(500)
                                                $CastSkill = $CastSkill + 1
                                        EndIf
                                EndIf
                        EndIf
                        If $Monsterlvl = 1 Then
                                If $ImbueBelt = 1 Then
                                        Send("{F1}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 2 Then
                                        Send("{F2}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 3 Then
                                        Send("{F3}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 4 Then
                                        Send("{F4}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf

                                If $AttackBelt = 1 Then
                                        Send("{F1}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 2 Then
                                        Send("{F2}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 3 Then
                                        Send("{F3}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 4 Then
                                        Send("{F4}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                        EndIf


                        ;-------------------LVL 2 MOB--------------------------------------------------------------------------------------------
                        If $Monsterlvl = 2 Then
                                If $MonsterChamp = 1 Then
                                        $GreenSkills = $GreenSkills + $ChampSkills
                                EndIf
                                If $MonsterGiant = 1 Then
                                        $GreenSkills = $GreenSkills + $GiantSkills
                                EndIf
                                If $GreenSkills > $CastSkill Then
                                        $RandomSkill = Random(1, 5, 1)
                                        If $UseSkill1 = 1 Then
                                                If $RandomSkill = 1 Then
                                                        If $Skill1Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill1Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill1Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill1Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill1Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill2 = 1 Then
                                                If $RandomSkill = 2 Then
                                                        If $Skill2Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill2Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill2Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill2Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill2Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill3 = 1 Then
                                                If $RandomSkill = 3 Then
                                                        If $Skill3Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill3Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill3Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill3Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill3Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill4 = 1 Then
                                                If $RandomSkill = 4 Then
                                                        If $Skill4Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill4Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill4Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill4Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill4Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill5 = 1 Then
                                                If $RandomSkill = 5 Then
                                                        If $Skill5Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill5Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill5Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill5Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill5Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf
                                EndIf
                                If $ImbueBelt = 1 Then
                                        Send("{F1}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 2 Then
                                        Send("{F2}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 3 Then
                                        Send("{F3}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 4 Then
                                        Send("{F4}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 1 Then
                                        Send("{F1}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 2 Then
                                        Send("{F2}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 3 Then
                                        Send("{F3}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 4 Then
                                        Send("{F4}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                        EndIf


                        ;-------------------LVL 3 MOB--------------------------------------------------------------------------------------------
                        If $Monsterlvl = 3 Then
                                If $MonsterChamp = 1 Then
                                        $WhiteSkills = $WhiteSkills + $ChampSkills
                                EndIf
                                If $MonsterGiant = 1 Then
                                        $WhiteSkills = $WhiteSkills + $GiantSkills
                                EndIf
                                If $WhiteSkills > $CastSkill Then
                                        $RandomSkill = Random(1, 5, 1)
                                        If $UseSkill1 = 1 Then
                                                If $RandomSkill = 1 Then
                                                        If $Skill1Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill1Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill1Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill1Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill1Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill2 = 1 Then
                                                If $RandomSkill = 2 Then
                                                        If $Skill2Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill2Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill2Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill2Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill2Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill3 = 1 Then
                                                If $RandomSkill = 3 Then
                                                        If $Skill3Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill3Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill3Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill3Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill3Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill4 = 1 Then
                                                If $RandomSkill = 4 Then
                                                        If $Skill4Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill4Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill4Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill4Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill4Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill5 = 1 Then
                                                If $RandomSkill = 5 Then
                                                        If $Skill5Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill5Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill5Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill5Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill5Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf
                                EndIf
                                If $ImbueBelt = 1 Then
                                        Send("{F1}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 2 Then
                                        Send("{F2}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 3 Then
                                        Send("{F3}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 4 Then
                                        Send("{F4}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 1 Then
                                        Send("{F1}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 2 Then
                                        Send("{F2}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 3 Then
                                        Send("{F3}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 4 Then
                                        Send("{F4}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                        EndIf


                        ;-------------------LVL 4 MOB--------------------------------------------------------------------------------------------
                        If $Monsterlvl = 4 Then
                                If $MonsterChamp = 1 Then
                                        $OrangeSkills = $OrangeSkills + $ChampSkills
                                EndIf
                                If $MonsterGiant = 1 Then
                                        $OrangeSkills = $OrangeSkills + $GiantSkills
                                EndIf
                                If $OrangeSkills > $CastSkill Then
                                        $RandomSkill = Random(1, 5, 1)
                                        If $UseSkill1 = 1 Then
                                                If $RandomSkill = 1 Then
                                                        If $Skill1Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill1Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill1Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill1Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill1Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill2 = 1 Then
                                                If $RandomSkill = 2 Then
                                                        If $Skill2Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill2Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill2Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill2Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill2Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill3 = 1 Then
                                                If $RandomSkill = 3 Then
                                                        If $Skill3Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill3Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill3Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill3Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill3Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill4 = 1 Then
                                                If $RandomSkill = 4 Then
                                                        If $Skill4Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill4Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill4Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill4Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill4Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill5 = 1 Then
                                                If $RandomSkill = 5 Then
                                                        If $Skill5Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill5Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill5Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill5Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill5Key)
                                                        Sleep(500)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf
                                EndIf
                                If $ImbueBelt = 1 Then
                                        Send("{F1}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 2 Then
                                        Send("{F2}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 3 Then
                                        Send("{F3}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 4 Then
                                        Send("{F4}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 1 Then
                                        Send("{F1}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 2 Then
                                        Send("{F2}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 3 Then
                                        Send("{F3}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 4 Then
                                        Send("{F4}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                        EndIf


                        ;-------------------LVL 5 MOB--------------------------------------------------------------------------------------------
                        If $Monsterlvl = 5 Then
                                If $RunFromRed = 1 Then
                                        RunAway()
                                Else
                                        If $MonsterChamp = 1 Then
                                                $RedSkills = $RedSkills + $ChampSkills
                                        EndIf
                                        If $MonsterGiant = 1 Then
                                                $RedSkills = $RedSkills + $GiantSkills
                                        EndIf
                                        If $RedSkills > $CastSkill Then
                                                $RandomSkill = Random(1, 5, 1)
                                                If $UseSkill1 = 1 Then
                                                        If $RandomSkill = 1 Then
                                                                If $Skill1Belt = 1 Then
                                                                        Send("{F1}")
                                                                EndIf
                                                                If $Skill1Belt = 2 Then
                                                                        Send("{F2}")
                                                                EndIf
                                                                If $Skill1Belt = 3 Then
                                                                        Send("{F3}")
                                                                EndIf
                                                                If $Skill1Belt = 4 Then
                                                                        Send("{F4}")
                                                                EndIf
                                                                Send($Skill1Key)
                                                                $CastSkill = $CastSkill + 1
                                                        EndIf
                                                EndIf
                                        EndIf

                                        If $UseSkill2 = 1 Then
                                                If $RandomSkill = 2 Then
                                                        If $Skill2Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill2Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill2Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill2Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill2Key)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill3 = 1 Then
                                                If $RandomSkill = 3 Then
                                                        If $Skill3Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill3Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill3Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill3Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill3Key)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill5 = 1 Then
                                                If $RandomSkill = 4 Then
                                                        If $Skill4Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill4Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill4Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill4Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill4Key)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf

                                        If $UseSkill5 = 1 Then
                                                If $RandomSkill = 5 Then
                                                        If $Skill5Belt = 1 Then
                                                                Send("{F1}")
                                                        EndIf
                                                        If $Skill5Belt = 2 Then
                                                                Send("{F2}")
                                                        EndIf
                                                        If $Skill5Belt = 3 Then
                                                                Send("{F3}")
                                                        EndIf
                                                        If $Skill5Belt = 4 Then
                                                                Send("{F4}")
                                                        EndIf
                                                        Send($Skill5Key)
                                                        $CastSkill = $CastSkill + 1
                                                EndIf
                                        EndIf
                                EndIf
                                If $ImbueBelt = 1 Then
                                        Send("{F1}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 2 Then
                                        Send("{F2}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 3 Then
                                        Send("{F3}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $ImbueBelt = 4 Then
                                        Send("{F4}")
                                        Send($ImbueKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 1 Then
                                        Send("{F1}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 2 Then
                                        Send("{F2}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 3 Then
                                        Send("{F3}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                                If $AttackBelt = 4 Then
                                        Send("{F4}")
                                        Send($AttackKey)
                                        Sleep(500)
                                EndIf
                        EndIf
                Else
                        $MonsterDead = 1
                        Pickup()
                EndIf
                If TimerDiff($Timer1) > 35000 Then
                        If PixelGetColor(539, 494) = 0xFEFBD8 Then
                                ToolTip($BotName & ": You Died ", 2, 0)
                                CheckIfDead()
                        EndIf
                EndIf
                If PixelGetColor(419, 138) = 0xFFFFFF And PixelGetColor(480, 139) = 0xFFFFFF And PixelGetColor(595, 138) = 0xFFFFFF Then
                        Stuck()
                EndIf
        WEnd
EndFunc  ;==>Attack





Func NormalAttack()
        ToolTip($BotName & ": Fighting...", 2, 0)
        While $MonsterDead <> 1
                $fight = PixelSearch(437, 44, 439, 46, 0xFFC6C6, 10)
                If Not @error Then
                        If $AttackBelt = 1 Then
                                Send("{F1}")
                                Send($AttackKey)
                        EndIf
                        If $AttackBelt = 2 Then
                                Send("{F2}")
                                Send($AttackKey)
                        EndIf
                        If $AttackBelt = 3 Then
                                Send("{F3}")
                                Send($AttackKey)
                        EndIf
                        If $AttackBelt = 4 Then
                                Send("{F4}")
                                Send($AttackKey)
                        EndIf
                        If $ImbueBelt = 1 Then
                                Send("{F1}")
                                Send($ImbueKey)
                        EndIf
                        If $ImbueBelt = 2 Then
                                Send("{F2}")
                                Send($ImbueKey)
                        EndIf
                        If $ImbueBelt = 3 Then
                                Send("{F3}")
                                Send($ImbueKey)
                        EndIf
                        If $ImbueBelt = 4 Then
                                Send("{F4}")
                                Send($ImbueKey)
                        EndIf
                Else
                        $MonsterDead = 1
                        Pickup()
                EndIf
        WEnd
EndFunc  ;==>NormalAttack


Func Pickup()
        $Monsterlvl = 0
        $tookmoblvl = 0
        If $NuBotPickup = 0 Then
                If $PickUpItems = 1 Then
                        $ItemSearch = PixelSearch(375, 287, 665, 506, 0x00FFFF, 4)
                        If Not @error Then
                                MouseClick("Left", $ItemSearch[0], $ItemSearch[1], 2)
                        EndIf
                        Sleep(450)
                        Send("gg")
                        Send("gg")
                        Sleep(250)
                        Send("gg")
                        Send("gg")
                        Sleep(100)
                        Send("gg")
                        Send("gg")
                        Sleep(100)
                        Send("gg")
                        Send("gg")
                        Sleep(100)
                        Send("gg")
                        Send("gg")
                        Sleep(100)
                        Send("gg")
                        Send("gg")
                ElseIf $NuBotPickup = 1 Then
                        Sleep(1000)
                EndIf
        EndIf
EndFunc  ;==>Pickup


;------------------------------------------------------------------------------------------------------------------------------

;----------------------------------BUFF----------------------------------------------------------------------------------------
Func Buff()
        If $UseBuff1 = 1 Then
                If TimerDiff($Buff1Timer) > $Buff1Delay + 1000 Then
                        If $Buff1Belt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $Buff1Belt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $Buff1Belt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $Buff1Belt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($Buff1key)
                        Sleep(2500)
                        $Buff1Timer = TimerInit()
                EndIf
        EndIf
        If $UseBuff2 = 1 Then
                If TimerDiff($Buff2Timer) > $Buff2Delay + 2000 Then
                        If $Buff2Belt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $Buff2Belt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $Buff2Belt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $Buff2Belt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($Buff2Key)
                        Sleep(2500)
                        $Buff2Timer = TimerInit()
                EndIf
        EndIf
        If $UseBuff3 = 1 Then
                If TimerDiff($Buff3Timer) > $Buff3Delay + 3000 Then
                        If $Buff3Belt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $Buff3Belt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $Buff3Belt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $Buff3Belt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($Buff3Key)
                        Sleep(2500)
                        $Buff3Timer = TimerInit()
                EndIf
        EndIf
        If $UseBuff4 = 1 Then
                If TimerDiff($Buff4Timer) > $Buff4Delay + 1500 Then
                        If $Buff4Belt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $Buff4Belt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $Buff4Belt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $Buff4Belt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($Buff4Key)
                        Sleep(2500)
                        $Buff4Timer = TimerInit()
                EndIf
        EndIf
        If $UseBuff5 = 1 Then
                If TimerDiff($Buff5Timer) > $Buff5Delay + 2500 Then
                        If $Buff5Belt = 1 Then
                                Send("{F1}")
                        EndIf
                        If $Buff5Belt = 2 Then
                                Send("{F2}")
                        EndIf
                        If $Buff5Belt = 3 Then
                                Send("{F3}")
                        EndIf
                        If $Buff5Belt = 4 Then
                                Send("{F4}")
                        EndIf
                        Send($Buff5Key)
                        Sleep(2500)
                        $Buff5Timer = TimerInit()
                EndIf
        EndIf
EndFunc  ;==>Buff

;------------------------------------------------------------------------------------------------------------------------------

;--------------GoToTown--------------------------------------------------------------------------------------------------------
Func GoToTown()
        MsgBox(64, "Error", "Go To Town hasnt been added yet")
        ;If $X1 = "" Then
        ;MsgBox(64,"Error", "You have not set up the walk to town coords properly")
        ;WalkTo($X1,Y1)
        ;WalkTo($X2,Y2)
EndFunc  ;==>GoToTown

;--------------------------------------------------------------------------------------------------------------------------------

;---------------------------WalkBack--------------------------------------------------------------------------------------------
Func SaveCoords()
        $SavedX = _NCR(923, 34, 950, 45)
        $SavedY = _NCR(982, 34, 1009, 45)
        $Coordsystem = 1
        $walkback = InputBox($BotName, "Walkback, set how far before walkback starts", "", "")
        MsgBox(64, $BotName, "Coords Saved", 3)
EndFunc  ;==>SaveCoords

Func CheckCoords()
        Sleep(1500)
        $CoordX = _NCR(923, 34, 950, 45)
        $FinalX = $SavedX - $CoordX
        If $FinalX < -$walkback Then
                ToolTip($BotName & ": you have wondered off East", 2, 0)
                $east = 1
        EndIf
        If $FinalX > $walkback Then
                ToolTip($BotName & ": you have wondered off West", 2, 0)
                $west = 1
        EndIf

        $CoordY = _NCR(982, 34, 1009, 45)
        $FinalY = $SavedY - $CoordY
        If $FinalY < -$walkback Then
                ToolTip($BotName & ": you have wondered off North", 2, 0)
                $north = 1
        EndIf
        If $FinalY > $walkback Then
                ToolTip($BotName & ": you have wondered off South", 2, 0)
                $south = 1
        EndIf
        Direction()
EndFunc  ;==>CheckCoords

Func Direction()
        $Timer1 = TimerInit()
        If $east = 1 Then
                While 1
                        If TimerDiff($Timer1) > 30 * 1000 Then
                                Stuck()
                                $Timer1 = TimerInit()
                        EndIf
                        MouseClick("left", 680, 425)
                        Sleep(1000)
                        ToolTip($BotName & ": walking West ", 2, 0)
                        $walkCoord = _NCR(923, 34, 950, 45)
                        $TempCoord = $walkCoord - $SavedX
                        If $TempCoord > 6 Then
                                ToolTip($BotName & ": Keep on walking West ", 2, 0)
                        EndIf
                        If $TempCoord < -0 Then
                                ToolTip($BotName & ": OK, back to training ", 2, 0)
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $east = 0
        If $west = 1 Then
                While 1
                        If TimerDiff($Timer1) > 30 * 1000 Then
                                Stuck()
                                $Timer1 = TimerInit()
                        EndIf
                        MouseClick("left", 350, 425)
                        Sleep(1000)
                        ToolTip($BotName & ": walking East ", 2, 0)
                        $walkCoord = _NCR(923, 34, 950, 45)
                        $TempCoord = $walkCoord - $SavedX
                        If $TempCoord < -6 Then
                                ToolTip($BotName & ": Keep on walking East ", 2, 0)
                        EndIf
                        If $TempCoord > 0 Then
                                ToolTip($BotName & ": OK, back to training ", 2, 0)
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $west = 0
        If $north = 1 Then
                While 1
                        If TimerDiff($Timer1) > 30 * 1000 Then
                                Stuck()
                                $Timer1 = TimerInit()
                        EndIf
                        MouseClick("left", 514, 256)
                        Sleep(1000)
                        ToolTip($BotName & ": walking South ", 2, 0)
                        $walkCoord = _NCR(982, 34, 1009, 45)
                        $TempCoord = $walkCoord - $SavedY
                        If $TempCoord > 6 Then
                                ToolTip($BotName & ": Keep on walking South ", 2, 0)
                        EndIf
                        If $TempCoord < -0 Then
                                ToolTip($BotName & ": OK, back to training ", 2, 0)
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $north = 0
        If $south = 1 Then
                While 1
                        If TimerDiff($Timer1) > 30 * 1000 Then
                                Stuck()
                                $Timer1 = TimerInit()
                        EndIf
                        MouseClick("left", 505, 567)
                        Sleep(1000)
                        ToolTip($BotName & ": walking North ", 2, 0)
                        $walkCoord = _NCR(982, 34, 1009, 45)
                        $TempCoord = $walkCoord - $SavedY
                        If $TempCoord < -6 Then
                                ToolTip($BotName & ": Keep on walking North ", 2, 0)
                        EndIf
                        If $TempCoord > 0 Then
                                ToolTip($BotName & ": OK, back to training ", 2, 0)
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $south = 0
EndFunc  ;==>Direction

Func _NCR($Ax, $Ay, $Dx, $Dy)

        $width = $Dx - $Ax
        $length = $Dy - $Ay

        Dim $char[$width][$length]

        For $xwidth = 0 To $width - 1
                For $xlength = 0 To $length - 1
                        $char[$xwidth][$xlength] = Hex(PixelGetColor($Ax, $Ay), 6)
                        $Ay = $Ay + 1
                Next
                $Ax = $Ax + 1
                $Ay = $Ay - $length
        Next
        ;scans entire area


        $p = 1
        Dim $row[$width]
        For $xwidth = 0 To $width - 1

                For $xlength = 0 To $length - 1
                        If $char[$xwidth][$xlength] = "FFFFFF" Then
                                If $p = 1 Then
                                        $div = $xwidth
                                        $p += 2
                                EndIf
                                $x = $xwidth - $div
                                $row[$x] += 1

                        EndIf

                Next
        Next
        ;seriales the array

        Dim $result
        For $xwidth = 0 To $width - 1

                If $row[$xwidth + 0] = 7 And $row[$xwidth + 1] = 2 And $row[$xwidth + 2] = 2 And $row[$xwidth + 3] = 2 And $row[$xwidth + 4] = 7 Then
                        $result &= "0"
                EndIf

                If $row[$xwidth + 0] = 1 And $row[$xwidth + 1] = 1 And $row[$xwidth + 2] = 9 Then
                        $result &= "1"
                EndIf


                If $row[$xwidth + 0] = 2 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 4 And $row[$xwidth + 4] = 4 Then
                        $result &= "2"
                EndIf


                If $row[$xwidth + 0] = 2 And $row[$xwidth + 1] = 2 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 6 Then
                        $result &= "3"
                EndIf


                If $row[$xwidth + 0] = 2 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 9 And $row[$xwidth + 4] = 1 Then
                        $result &= "4"
                EndIf


                If $row[$xwidth + 0] = 4 And $row[$xwidth + 1] = 4 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 5 Then
                        $result &= "5"
                EndIf


                If $row[$xwidth + 0] = 7 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 5 Then
                        $result &= "6"
                EndIf


                If $row[$xwidth + 0] = 1 And $row[$xwidth + 1] = 4 And $row[$xwidth + 2] = 4 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 1 Then
                        $result &= "7"
                EndIf


                If $row[$xwidth + 0] = 6 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 6 Then
                        $result &= "8"
                EndIf


                If $row[$xwidth + 0] = 5 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 7 Then
                        $result &= "9"
                EndIf



        Next
        $len = StringLen($result)
        Return $result

EndFunc  ;==>_NCR

;----------------------------------------------------------------------------------------------------------------------------------

Func Stuck()
        ToolTip($BotName & ": i think were stuck ", 2, 0)
        MouseClick("left", 227, 97)
        Sleep(1000)
        MouseClick("left", 847, 93)
        Sleep(1000)
        MouseClick("left", 80, 512)
        Sleep(1000)
        MouseClick("left", 958, 532)
        Sleep(1000)
EndFunc  ;==>Stuck


;--------------------------WalkTo----------------------------------------------------------------------------------------------
Func WalkTo($WalkToX, $WalkToY)
        $walktoSystem = 1
        $Coordsystem = 0
        $CoordX = _NCR(923, 34, 950, 45)
        $DestinationX = $WalkToX - $CoordX
        If $DestinationX < -2 Then
                $east = 1
        EndIf
        If $DestinationX > 2 Then
                $west = 1
        EndIf

        $CoordY = _NCR(982, 34, 1009, 45)
        $DestinationY = $WalkToY - $CoordY
        If $DestinationY < -2 Then
                $north = 1
        EndIf
        If $DestinationY > 2 Then
                $south = 1
        EndIf
        $Timer1 = TimerInit()
        If $east = 1 Then
                While 1
                        If TimerDiff($Timer1) > 45 * 1000 Then
                                Stuck()
                                $Timer1 = TimerInit()
                        EndIf
                        MouseClick("left", 680, 425)
                        Sleep(1000)
                        ToolTip($BotName & ": walking West ", 2, 0)
                        $walkCoord = _NCR(923, 34, 950, 45)
                        $TempCoord = $walkCoord - $WalkToX
                        If $TempCoord > 2 Then
                                ToolTip($BotName & ": Keep on walking West ", 2, 0)
                        EndIf
                        If $TempCoord < 0 Then
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $east = 0
        If $west = 1 Then
                While 1
                        If TimerDiff($Timer1) > 45 * 1000 Then
                                Stuck()
                        EndIf
                        MouseClick("left", 350, 425)
                        Sleep(1000)
                        ToolTip($BotName & ": walking East ", 2, 0)
                        $walkCoord = _NCR(923, 34, 950, 45)
                        $TempCoord = $walkCoord - $WalkToX
                        If $TempCoord > -2 Then
                                ToolTip($BotName & ": Keep on walking East ", 2, 0)
                        EndIf
                        If $TempCoord > 0 Then
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $west = 0
        If $north = 1 Then
                While 1
                        If TimerDiff($Timer1) > 45 * 1000 Then
                                Stuck()
                        EndIf
                        MouseClick("left", 514, 256)
                        Sleep(1000)
                        ToolTip($BotName & ": walking South ", 2, 0)
                        $walkCoord = _NCR(982, 34, 1009, 45)
                        $TempCoord = $walkCoord - $WalkToY
                        If $TempCoord > 2 Then
                                ToolTip($BotName & ": Keep on walking South ", 2, 0)
                        EndIf
                        If $TempCoord < 0 Then
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $north = 0
        If $south = 1 Then
                While 1
                        If TimerDiff($Timer1) > 45 * 1000 Then
                                Stuck()
                        EndIf
                        MouseClick("left", 505, 567)
                        Sleep(1000)
                        ToolTip($BotName & ": walking North ", 2, 0)
                        $walkCoord = _NCR(982, 34, 1009, 45)
                        $TempCoord = $walkCoord - $WalkToY
                        If $TempCoord < -2 Then
                                ToolTip($BotName & ": Keep on walking North ", 2, 0)
                        EndIf
                        If $TempCoord > 0 Then
                                ExitLoop
                        EndIf
                WEnd
        EndIf
        $south = 0
EndFunc  ;==>WalkTo

;--------------------------------------------------------------------------------------------------------------------------------


Func OpenMem()
Local $DllInformation = _MemoryOpen($ProcessID)
If @Error Then
MsgBox(4096, "ERROR", "Failed to open memory.")
Exit
EndIf
EndFunc

Func ReadMem()
$X = _MemoryRead("0x" & $XAddress, $DllInformation)
$Y = _MemoryRead("0x" & $YAddress, $DllInformation)
EndFunc



Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)

If Not ProcessExists($iv_Pid) Then
SetError(1)
Return 0
EndIf

Local $ah_Handle[2] = [DllOpen('kernel32.dll')]

If @Error Then
SetError(2)
Return 0
EndIf

Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)

If @Error Then
DllClose($ah_Handle[0])
SetError(3)
Return 0
EndIf

$ah_Handle[1] = $av_OpenProcess[0]

Return $ah_Handle

EndFunc


Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'char[5]')

If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf

Local $v_Buffer = DllStructCreate($sv_Type)

If @Error Then
SetError(@Error + 1)
Return 0
EndIf

DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

If Not @Error Then
Local $v_Value = DllStructGetData($v_Buffer, 1)
Return $v_Value
Else
SetError(6)
Return 0
EndIf

EndFunc


Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')

If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf

Local $v_Buffer = DllStructCreate($sv_Type)

If @Error Then
SetError(@Error + 1)
Return 0
Else
DllStructSetData($v_Buffer, 1, $v_Data)
If @Error Then
SetError(6)
Return 0
EndIf
EndIf

DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

If Not @Error Then
Return 1
Else
SetError(7)
Return 0
EndIf

EndFunc


Func _MemoryClose($ah_Handle)

If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf

DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
If Not @Error Then
DllClose($ah_Handle[0])
Return 1
Else
DllClose($ah_Handle[0])
SetError(2)
Return 0
EndIf

EndFunc


Func _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword')

If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf

Local $iv_Data[2], $i
Local $v_Buffer = DllStructCreate('dword')

For $i = 0 to $iv_PointerCount

If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 2)
Return 0
EndIf

$iv_Address = '0x' & hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

Else
$iv_Address = '0x' & hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

EndIf

Next

$iv_Data[0] = $iv_Address

Return $iv_Data

EndFunc

Func _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data, $sv_Type = 'dword')

If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf

Local $iv_StructData, $i
Local $v_Buffer = DllStructCreate('dword')

For $i = 0 to $iv_PointerCount
If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 3)
Return 0
EndIf

DllStructSetData($v_Buffer, 1, $v_Data)
If @Error Then
SetError(8)
Return 0
EndIf

$iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(9)
Return 0
Else
Return $iv_Address
EndIf
ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(3)
Return 0
EndIf

$iv_StructData = DllStructGetData($v_Buffer, 1)

Else
$iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(3)
Return 0
EndIf

$iv_StructData = DllStructGetData($v_Buffer, 1)

EndIf
Next

EndFunc


Func MemSaveCoords()
        Global $ProcessID = WinGetProcess("SRO_Client")


Global $DllInformation = _MemoryOpen($ProcessID)
If @Error Then
MsgBox(4096, "ERROR", "Failed to open memory.")
Exit
EndIf
$SavedX = _MemoryRead($XMemory, $DllInformation)
$SavedY = _MemoryRead($YMemory, $DllInformation)
MsgBox(4096, "X", $SavedX)
MsgBox(4096, "Y", $SavedY)
$Coordsystem = 1
_MemoryClose($DllInformation)
EndFunc

        Func MemWalkStuck()
                        Global $ProcessID = WinGetProcess("SRO_Client")


Global $DllInformation = _MemoryOpen($ProcessID)
If @Error Then
MsgBox(4096, "ERROR", "Failed to open memory.")
Exit
EndIf
        $CurrentCoord = _MemoryRead($XMemory, $DllInformation)
                if $walkCoord = $CurrentCoord Or $walkcoord1 = $CurrentCoord Or $walkcoord2 = $CurrentCoord Then
                        ToolTip("HelBot: Shit im stuck ", 2, 0)
                        MouseClick( "left", 227,97)
                        Sleep(1000)
                        MouseClick( "left", 847,93)
                        Sleep(1000)
                        MouseClick( "left", 80,512)
                        Sleep(1000)
                        MouseClick( "left", 958,532)
                        Sleep(1000)
                        _MemoryClose($DllInformation)
                        MemWalkToDirection()
                EndIf
                EndFunc



        Func MemWalkTo($WalkToX,$WalkToY)
                Global $ProcessID = WinGetProcess("SRO_Client")


Global $DllInformation = _MemoryOpen($ProcessID)
If @Error Then
MsgBox(4096, "ERROR", "Failed to open memory.")
Exit
EndIf
                $walktoSystem = 1
                $Coordsystem = 0
                $CoordX = _MemoryRead($XMemory, $DllInformation)
$Destination = $WalkToX - $CoordX
If $DestinationX < -5 Then
        $east = 1
        EndIf
        If $DestinationX > 5 Then
                $west = 1
        EndIf

$CoordY = _MemoryRead($YMemory, $DllInformation)
$DestinationY = $WalkToY - $CoordY
If $DestinationY < -5 Then
        $north = 1
        EndIf
        If $DestinationY > 5 Then
                $south = 1
        EndIf
        _MemoryClose($DllInformation)
                MemWalkToDirection()
        EndFunc
       
       


        Func MemWalkToDirection()
        $Timer1 = TimerInit()
        If $east = 1 Then
                While 1
                        if timerdiff($timer1) > 45 * 1000 then
                                Stuck()
                                $Timer1 = TimerInit()
                                EndIf
                MouseClick("left",676,425)
                Sleep(500)
                ToolTip("HelBot: walking West ", 2, 0)
                $walkCoord = _MemoryRead($XMemory, $DllInformation)
                $TempCoord = $walkCoord - $WalkToX
                If $TempCoord > 5 Then
                                ToolTip("HelBot: Keep on walking West ", 2, 0)
                                Endif
                If $TempCoord < -5 Then
                        ExitLoop
                EndIf
                Wend
        EndIf
$east = 0
;------------------------------------------------------------------------------------------------------------------------
If $west = 1 Then
                While 1
                        if timerdiff($timer1) > 45 * 1000 then
                                Stuck()
                                EndIf
                MouseClick("left",369,409)
                Sleep(500)
                ToolTip("HelBot: walking East ", 2, 0)
                $walkCoord = _MemoryRead($XMemory, $DllInformation)
                $TempCoord = $walkCoord - $WalkToX
                If $TempCoord < -5 Then
                                ToolTip("HelBot: Keep on walking East ", 2, 0)
                                Endif
                If $TempCoord > 5 Then
                        ExitLoop
                EndIf
                Wend
        EndIf
$west = 0
;------------------------------------------------------------------------------------------------------------------------
If $north = 1 Then
                While 1
                        if timerdiff($timer1) > 45 * 1000 then
                                Stuck()
                                EndIf
                MouseClick("left",510,253)
                Sleep(500)
                ToolTip("HelBot: walking South ", 2, 0)
                $walkCoord = _MemoryRead($YMemory, $DllInformation)
                $TempCoord = $walkCoord - $WalkToY
                MsgBox(64,"WalkCoord",$WalkCoord)
                MsgBox(64,"temp",$TempCoord)
                If $TempCoord > 5 Then
                                ToolTip("HelBot: Keep on walking South ", 2, 0)
                                Endif
                If $TempCoord < -5 Then
                        ExitLoop
                EndIf
                Wend
        EndIf
$north = 0
;------------------------------------------------------------------------------------------------------------------------
If $south = 1 Then
                While 1
                        if timerdiff($timer1) > 45 * 1000 then
                                Stuck()
                                EndIf
                MouseClick("left",510,548)
                Sleep(500)
                ToolTip("HelBot: walking North ", 2, 0)
                $walkCoord = _MemoryRead($YMemory, $DllInformation)
                $TempCoord = $walkCoord - $WalkToY
                If $TempCoord < -5 Then
                                ToolTip("HelBot: Keep on walking North ", 2, 0)
                                Endif
                If $TempCoord > 5 Then
                        ExitLoop
                EndIf
                Wend
        EndIf
$south = 0
;------------------------------------------------------------------------------------------------------------------------
_MemoryClose($DllInformation)
        EndFunc

Func WalkPath()
Global $CoordListItem[101]
#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\save.kxf
$Form1 = GUICreate("coords", 219, 300, 193, 115)
$XC = GUICtrlCreateInput("", 40, 216, 33, 21)
$Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$YC = GUICtrlCreateInput("", 96, 216, 33, 21)
$Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, 0)
$CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER))
For $i = 1 To UBound($CoordListItem)-1
    $CoordListItem[$i] = GUICtrlCreateListViewItem($i & "||",$CoordList)
Next
$Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0)
$Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0)
$OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0)
$WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21)
_GUICtrlListViewSetColumnWidth ($CoordList, 1, 60)
_GUICtrlListViewSetColumnWidth ($CoordList, 2, 60)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
                Case $CoordList
                       
                Case $Enter
                        If GUICtrlRead($XC) = "" Or GUICtrlRead($YC) = "" Then
                                        MsgBox(0,"Error","Fill In X & Y Inputs Please")
                                        Else
                        GUICtrlSetData($CoordListItem[_GUICtrlListViewGetSelectedIndices($CoordList)+1],_GUICtrlListViewGetSelectedIndices($CoordList)+1 & "|" & GUICtrlRead($XC) & "|" & GUICtrlRead($YC))
                        EndIf

                Case $OK
                        $Name = GUICtrlRead($WalkToName)
                        If $Name = "" Then
                                MsgBox(64,"Error", "You must have a path loaded or it wont work")
                        Else
                          $X1 = _GUICtrlListViewGetItemText ($CoordList, 1,1)
                          $Y1 = _GUICtrlListViewGetItemText ($CoordList, 1,2)
                         
                          MsgBox(64,"SROBOT", "You are using the walkback path named : " & $Name)
                          GUISetState(@SW_HIDE)
                        EndIf
 
          Case $Save
                  $Name = GUICtrlRead($WalkToName)
                  If $Name = "" Then
                          $Name = "default.txt"
                  EndIf
                        For $x = 1 to UBound($CoordListItem)-1
                                IniWrite ($Name, "Coordinates", "coord" & $x, GuiCtrlRead($CoordListItem[$x]))
                        Next
                   
                Case $Load
                        $Name2 = InputBox ("Enter name of .ini file", "Enter name of WalkTo .ini file")
                        If $Name2 = "" Then
                                $Name2 = "default.txt"
                        EndIf
                        GUICtrlSetData($WalkToName,$Name2)
                        $LoadRecords = IniReadSection($Name2, "Coordinates")
                        If @error Then
                                MsgBox(4096, "", "Error occurred, probably no INI file.")
                        Else
                                For $i = 1 To $LoadRecords[0][0]
                                        GuiCtrlSetData($CoordListItem[$i], $LoadRecords[$i][1])
                                        ;MsgBox(4096, "", "Key: " & $LoadRecords[$i][0] & @CRLF & "Value: " & $LoadRecords[$i][1])
                                Next
                        EndIf

        EndSwitch

WEnd
EndFunc

Func GetItem()
        WinActivate("SRO_Client")
Sleep(500)
;-----------------------------------------FIND ITEM MARKER---------------------------------------------
        While 1
                ToolTip("Get Item : Searching for item marker ", 2, 0)
                ;---------------------------Determine search coords----------------------------------------
                $pos = MouseGetPos()
                If $pos[0] < 656 Then  ; vert row 1
                        $poscoord1 = 656
                EndIf
                If $pos[0] < 692 And $pos[0] > 657 Then ;vert row 2
                        $poscoord1 = 692
                EndIf
                If $pos[0] < 728 And $pos[0] > 693 Then ; vert row 3
                        $poscoord1 = 728
                        EndIf
                If $pos[0] > 729 Then ;vert row 4
                        $poscoord1 = 750
                        EndIf
                If $pos[1] < 371 Then ; hori row 1
                        $poscoord2 = 371
                EndIf
                If $pos[1] < 407 And $pos[1] > 372 Then ; hori row 2
                        $poscoord2 = 407
                EndIf
                If $pos[1] < 443 And $pos[1] > 408 Then ; hori row 3
                        $poscoord2 = 443
                EndIf
                If $pos[1] < 479 And $pos[1] > 443 Then ; hori row 4
                        $poscoord2 = 479
                EndIf
                If $pos[1] < 515 And $pos[1] > 479 Then ; hori row 5
                        $poscoord2 = 515
                EndIf
                If $pos[1] < 550 And $pos[1] > 515 Then ; hori row 6
                        $poscoord2 = 550
                EndIf
                If $pos[1] < 587 And $pos[1] > 550 Then ; hori row 7
                        $poscoord2 = 587
                EndIf
                If $pos[1] < 624 And $pos[1] > 587 Then ; hori row 8
                        $poscoord2 = 624
                EndIf
               
$coords = PixelSearch($poscoord1,330,783,$poscoord2,0xC2BDB6,$Sensitivity) ;search for marker
If Not @error Then
        MsgBox(0,"Found Item Marker","Found") ; when marker found
        WinActivate("SRO_Client")
$SearchCoord1 = $coords[1] - 13 ;set ocr coords
$SearchCoord2 = $coords[1] + 29 ; set ocr coords
$ItemMarkerFound = 1
Else
WinActivate("SRO_Client")
$ItemMarkerFound = 0
EndIf
If $ItemMarkerFound = 1 Then
        ExitLoop
        EndIf
WEnd
;----------------------------------------------ANALYZE ITEM---------------------------------------------------
$result = ""
ToolTip("Get Item : Analyzing Item ", 2, 0)
$ItemText = _ItemCR($coords[0],$SearchCoord1,910,$SearchCoord2)
MsgBox(0,"Result is",$ItemText)
WinActivate("SRO_Client")
$Item = StringInStr( $ItemText, "(+)",1)
;-----------------------------------------------ITEM RESULT-----------------------------------------------
If $Item <> 0 Then
MsgBox(0,"Item","Item is a + item")
WinActivate("SRO_Client")
$ItemType = "+ Item"
EndIf
$Item = StringInStr( $ItemText, "MP",1)
If $Item <> 0 Then
MsgBox(0,"Item","Item is a MP pot")
WinActivate("SRO_Client")
$ItemType = "MP Pot"
EndIf
$Item = StringInStr( $ItemText, "HP",1)
If $Item <> 0 Then
MsgBox(0,"Item","Item is a HP pot")
WinActivate("SRO_Client")
$ItemType = "HP Pot"
EndIf
$Item = StringInStr( $ItemText, "Retu",1)
If $Item <> 0 Then
MsgBox(0,"Item","Item is a Return Scroll")
WinActivate("SRO_Client")
$ItemType = "Return Scroll"
EndIf
$Item = StringInStr( $ItemText, "Rub",1)
If $Item <> 0 Then
MsgBox(0,"Item","Item is a alchemy tablet")
WinActivate("SRO_Client")
$ItemType = "Ruby Tablet"
EndIf
$Item = StringInStr( $ItemText, "Jade",1)
If $Item <> 0 Then
MsgBox(0,"Item","Item is a alchemy tablet")
WinActivate("SRO_Client")
$ItemType = "Jade Tablet"
EndIf
PixelSearch($coords[0],$SearchCoord1,835,$SearchCoord2,0x72BFFF)
If Not @error Then
        MsgBox(0,"Item","Item is a Blue")
WinActivate("SRO_Client")
$ItemType = "Blue Item"
EndIf
;PixelSearch($coords[0],$SearchCoord1,835,$SearchCoord2,0x72BFFF)  edit this for sos items
;If Not @error Then
;        MsgBox(0,"Item","Item is a Sealed Item")
;WinActivate("SRO_Client")
;$ItemType = "Sealed Item"
;EndIf
WinActivate("SRO_Client")
EndFunc





Func _ItemCR($Ax, $Ay, $Dx, $Dy)

        $width = $Dx - $Ax
        $length = $Dy - $Ay

        Dim $char[$width][$length]

        For $xwidth = 0 To $width - 1
                For $xlength = 0 To $length - 1
                        $char[$xwidth][$xlength] = Hex(PixelGetColor($Ax, $Ay), 6)
                        $Ay = $Ay + 1
                Next
                $Ax = $Ax + 1
                $Ay = $Ay - $length
        Next
        ;scans entire area


        $p = 1
        Dim $row[$width]
        For $xwidth = 0 To $width - 1

                For $xlength = 0 To $length - 1
                        If $char[$xwidth][$xlength] = "FFFFFF" Then
                                If $p = 1 Then
                                        $div = $xwidth
                                        $p += 2
                                EndIf
                                $x = $xwidth - $div
                                $row[$x] += 1

                        EndIf

                Next
        Next
        ;seriales the array

        Dim $result
        For $xwidth = 0 To $width - 1
               
                If $row[$xwidth + 0] = 5 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 4 Then
                        $result &= "("
                EndIf
               
               
                If $row[$xwidth + 0] = 4 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 5 Then
                        $result &= ")"
                EndIf
               
               
                If $row[$xwidth + 0] = 1 And $row[$xwidth + 1] = 1 And $row[$xwidth + 2] = 5 And $row[$xwidth + 3] = 5 And $row[$xwidth + 4] = 1 And $row[$xwidth + 5] = 1 Then
                        $result &= "+"
                EndIf
               
               
                If $row[$xwidth + 0] = 9 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 1 And $row[$xwidth + 3] = 1 And $row[$xwidth + 4] = 1 And $row[$xwidth + 5] = 9 And $row[$xwidth + 6] = 9 Then
                        $result &= "H"
                EndIf
               
               
                If $row[$xwidth + 0] = 9 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 4 And $row[$xwidth + 3] = 6 And $row[$xwidth + 4] = 3 And $row[$xwidth + 5] = 6 And $row[$xwidth + 6] = 4  And $row[$xwidth + 7] = 9 And $row[$xwidth + 8] = 9 Then
                        $result &= "M"
                EndIf
               
               
                If $row[$xwidth + 0] = 9 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 2 And $row[$xwidth + 3] = 2 And $row[$xwidth + 4] = 2 And $row[$xwidth + 5] = 6 And $row[$xwidth + 6] = 4 Then
                        $result &= "P"
                EndIf
               
               
                If $row[$xwidth + 0] = 9 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 2 And $row[$xwidth + 3] = 2 And $row[$xwidth + 4] = 3 And $row[$xwidth + 5] = 8 And $row[$xwidth + 6] = 6  And $row[$xwidth + 7] = 1 Then
                        $result &= "R"
                EndIf
               

                If $row[$xwidth + 0] = 5 And $row[$xwidth + 1] = 7 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 6 And $row[$xwidth + 5] = 4 Then
                        $result &= "e"
                EndIf
               

                If $row[$xwidth + 0] = 7 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 2 Then
                        $result &= "t"
                EndIf
               

                If $row[$xwidth + 0] = 6 And $row[$xwidth + 1] = 7 And $row[$xwidth + 2] = 1 And $row[$xwidth + 3] = 1 And $row[$xwidth + 4] = 7 And $row[$xwidth + 5] = 7 Then
                        $result &= "u"
                EndIf
               

                If $row[$xwidth + 0] = 9 And $row[$xwidth + 1] = 9 And $row[$xwidth + 2] = 2 And $row[$xwidth + 3] = 2 And $row[$xwidth + 4] = 7 And $row[$xwidth + 5] = 5 Then
                        $result &= "b"
                EndIf
               

                If $row[$xwidth + 0] = 5 And $row[$xwidth + 1] = 8 And $row[$xwidth + 2] = 3 And $row[$xwidth + 3] = 5 And $row[$xwidth + 4] = 5 And $row[$xwidth + 5] = 2 Then
                        $result &= "u"
                EndIf
               
                If $row[$xwidth + 0] = 2 And $row[$xwidth + 1] = 3 And $row[$xwidth + 2] = 1 And $row[$xwidth + 3] = 1 And $row[$xwidth + 4] = 9 And $row[$xwidth + 5] = 8 Then
                        $result &= "J"
                EndIf
               
                If $row[$xwidth + 0] = 3 And $row[$xwidth + 1] = 5 And $row[$xwidth + 2] = 4 And $row[$xwidth + 3] = 3 And $row[$xwidth + 4] = 7 And $row[$xwidth + 5] = 6 Then
                        $result &= "a"
                EndIf
               
                If $row[$xwidth + 0] = 5 And $row[$xwidth + 1] = 7 And $row[$xwidth + 2] = 2 And $row[$xwidth + 3] = 2 And $row[$xwidth + 4] = 9 And $row[$xwidth + 5] = 9 Then
                        $result &= "d"
                EndIf
               
                $len = StringLen($result)
                If $result > 4 Then
                        ExitLoop
                        Return $result
                        EndIf



        Next
        $len = StringLen($result)
        Return $result

EndFunc  ;==>_NCR



Func AutoSpam()
        While 1
        Sleep($SpamDelay)
        MouseClick("Left",87,703,1,0)
        Sleep(300)
        ControlSend("SRO_Client", "", "", $SpamMessage1)
        Sleep(1000)
        ControlSend("SRO_Client", "", "", "{ENTER}")
        WEnd
endFunc

دا الاوبن سورس ياريت حد يفهنى انا محتاج اتعلم ايه وايه المطلوب منى عشان اقدر اشغل البوت ع البريفت سيرفر


الساعة الآن 11:22 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions, Inc.