Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- CoordMode, ToolTip, Screen
- CoordMode, Pixel, Screen
- CoordMode, Mouse, Screen
- CoordMode, Caret, Screen
- CoordMode, Menu, Screen
- path := [""] ;We start at path[2]!
- pathInstructs := [""] ;includes color, coords, etc
- pathDetails := [""] ; 1 is move mouse subscreen color//
- pathXY := [""]
- grabcolor := false
- started := false
- stop := false
- sleepU := false
- sleepUI := false
- color = 0x0000
- colorSU = 0x0000
- Gui, Show , w350 h640, Create a Script!
- ; basic elements
- Gui, Add, Text, x20 y10 w150 Left, % "Click show path to see what your bot will loop on run"
- Gui, Add, Button, x20 y40 w90 h20 gshow_path, Show path
- Gui, Add, Text, x20 y100 w150 Left, % "Add commands to the list of things your bot will loop"
- Gui, Add, Button, x20 y130 w150 h40 gadd_move_mouse_subwindow, Move mouse to a color (game subwindow)
- Gui, Add, Button, x20 y170 w150 h40 gadd_move_mouse_inventory, Move mouse to a color (inventory)
- Gui, Add, Button, x20 y210 w150 h40 gadd_move_mouse_chatbox, Move mouse to a color (chatbox)
- Gui, Add, Button, x20 y250 w150 h40 gadd_mouse_click, Click
- Gui, Add, Button, x20 y290 w150 h40 gadd_right_mouse_click, Right click
- Gui, Add, Button, x20 y330 w150 h40 gadd_move_mouse_relative, Move mouse to relative X,Y position
- Gui, Add, Edit, w50 h20 x180 y330 vXRELATIVE Left,
- Gui, Add, Edit, w50 h20 x240 y330 vYRELATIVE Left,
- Gui, Add, Text, x180 y350 w170 Left, % "^ Enter X and Y then hit relative <-"
- Gui, Add, Button, x20 y370 w150 h40 gadd_move_mouse_absolute, Move mouse to an absolute X,Y position
- Gui, Add, Edit, w50 h20 x180 y370 vXABSOLUTE Left,
- Gui, Add, Edit, w50 h20 x240 y370 vYABSOLUTE Left,
- Gui, Add, Text, x180 y390 w170 Left, % "^ Enter X and Y then hit absolute <-"
- Gui, Add, Button, x20 y410 w150 h40 gadd_type, Type in text
- Gui, Add, Edit, w50 h20 x170 y410 vTYPE Left,
- Gui, Add, Text, x180 y430 w170 Left, % "Enter message and hit button <-"
- Gui, Add, Button, x20 y450 w150 h40 gadd_sleep, Sleep for amount of milliseconds
- Gui, Add, Edit, w50 h20 x170 y450 vMILLI Left,
- Gui, Add, Text, x180 y470 w170 Left, % "^ Enter sleep time (milli) and hit button<-"
- Gui, Add, Button, x20 y490 w150 h40 gadd_sleepU, Sleep until color appears in subwindow
- Gui, Add, Button, x20 y530 w150 h40 gadd_sleepUI, Sleep until color appears in inventory
- Gui, Add, Button, x20 y570 w150 h40 gremove_last_element, Delete previous addition
- Gui, Add, Button, x20 y610 w150 h40 gstart, Start the script (press C to stop)
- Gui, Add, Text, x200 y10 w150 Left, % "Change subwindow coords (X1, Y1, X2, Y2)"
- Gui, Add, Edit, w30 h20 x200 y40 vSUBWINDOWTOPX Left, 5
- Gui, Add, Edit, w30 h20 x230 y40 vSUBWINDOWTOPY Left, 24
- Gui, Add, Edit, w30 h20 x200 y65 vSUBWINDOWBOTTOMX Left, 518
- Gui, Add, Edit, w30 h20 x230 y65 vSUBWINDOWBOTTOMY Left, 361
- Gui, Add, Text, x200 y80 w150 Left, % "Change inventory coords (X1, Y1, X2, Y2)"
- Gui, Add, Edit, w30 h20 x200 y110 vINVENTORYTOPX Left, 565
- Gui, Add, Edit, w30 h20 x230 y110 vINVENTORYTOPY Left, 228
- Gui, Add, Edit, w30 h20 x200 y135 vINVENTORYBOTTOMX Left, 736
- Gui, Add, Edit, w30 h20 x230 y135 vINVENTORYBOTTOMY Left, 477
- Gui, Add, Text, x200 y180 w150 Left, % "Change chatbox coords (X1, Y1, X2, Y2)"
- Gui, Add, Edit, w30 h20 x200 y210 vCHATBOXTOPX Left, 4
- Gui, Add, Edit, w30 h20 x230 y210 vCHATBOXTOPY Left, 363
- Gui, Add, Edit, w30 h20 x200 y235 vCHATBOXBOTTOMX Left, 504
- Gui, Add, Edit, w30 h20 x230 y235 vCHATBOXBOTTOMY Left, 479
- return
- start:
- {
- Gui, Submit, NoHide
- string := % path[1]
- counter := 2
- while (counter <= path.maxIndex())
- {
- string := % string . ">" . path[counter]
- counter ++
- }
- MsgBox % path.maxIndex() string
- Gui, Submit, NoHide
- stop := false
- started := true
- while (stop = false)
- {
- counter = 2
- while (counter <= path.maxIndex() and stop = false)
- {
- if (pathDetails[counter] = 1)
- {
- PixelSearch, Px, Py, SUBWINDOWTOPX, SUBWINDOWTOPY, SUBWINDOWBOTTOMX, SUBWINDOWBOTTOMY, pathInstructs[counter], 0, Fast
- if ErrorLevel
- {
- ;Color not found
- ;Sleep?
- }
- else
- MouseMove Px, Py
- }
- else if (pathDetails[counter] = 2)
- {
- PixelSearch, Px, Py, INVENTORYTOPX, INVENTORYTOPY, INVENTORYBOTTOMX, INVENTORYBOTTOMY, pathInstructs[counter], 0, Fast
- if ErrorLevel
- {
- ;Color not found
- ;Sleep?
- }
- else
- MouseMove Px, Py
- }
- else if (pathDetails[counter] = 3)
- {
- PixelSearch, Px, Py, CHATBOXTOPX, vCHATBOXTOPY, vCHATBOXBOTTOMX, vCHATBOXBOTTOMY, pathInstructs[counter], 0, Fast
- if ErrorLevel
- {
- ;Color not found
- ;Sleep?
- }
- else
- MouseMove Px, Py
- }
- else if (pathDetails[counter] = 4)
- {
- Click
- }
- else if (pathDetails[counter] = 5)
- {
- Click Right
- }
- else if (pathDetails[counter] = 6)
- {
- MouseMove pathInstructs[counter], pathXY[counter], 1, R
- }
- else if (pathDetails[counter] = 7)
- {
- MouseMove pathInstructs[counter], pathXY[counter]
- }
- else if (pathDetails[counter] = 8)
- {
- Send pathInstructs[counter] {enter}
- }
- else if (pathDetails[counter] = 9)
- {
- sleep pathInstructs[counter]
- }
- else if (pathDetails[counter] = 10)
- {
- temp := true
- sleepC := 0
- while (temp = true and sleepC < 10)
- {
- PixelSearch, Px, Py, SUBWINDOWTOPX, SUBWINDOWTOPY, SUBWINDOWBOTTOMX, SUBWINDOWBOTTOMY, pathInstructs[counter], 0, Fast
- if ErrorLevel
- {
- sleep 500
- sleepC ++
- }
- else
- {
- temp = false
- }
- }
- }
- else if (pathDetails[counter] = 11)
- {
- temp := true
- sleepC := 0
- while (temp = true and sleepC < 10)
- {
- PixelSearch, Px, Py, INVENTORYTOPX, INVENTORYTOPY, INVENTORYBOTTOMX, INVENTORYBOTTOMY, pathInstructs[counter], 0, Fast
- if ErrorLevel
- {
- sleep 500
- sleepC ++
- }
- else
- {
- temp = false
- }
- }
- }
- counter ++
- }
- sleep 50
- }
- started := false
- }
- return
- show_path:
- {
- Gui, Submit, NoHide
- string := % path[1]
- counter := 2
- while (counter <= path.maxIndex())
- {
- string := % string . ">" . path[counter]
- counter ++
- }
- MsgBox % path.maxIndex() string
- }
- return
- add_move_mouse_subwindow:
- {
- Gui, Submit, NoHide
- grabcolor := true
- MsgBox % "Press C to grab color [DO NOT CLOSE THIS BEFORE YOU PRESS C]"
- path[path.maxIndex()+1] := "Move mouse to subwindow and on color " color
- pathInstructs[pathInstructs.maxIndex()+1] := color
- pathDetails[pathDetails.maxIndex()+1] := 1 ;1 is subgame window move to color
- }
- return
- add_move_mouse_inventory:
- {
- Gui, Submit, NoHide
- grabcolor := true
- MsgBox % "Press C to grab color [DO NOT CLOSE THIS BEFORE YOU PRESS C]"
- path[path.maxIndex()+1] := "Move mouse to inventory and on color " color
- pathInstructs[pathInstructs.maxIndex()+1] := color
- pathDetails[pathDetails.maxIndex()+1] := 2 ;2 is inventory move to color
- }
- return
- add_move_mouse_chatbox:
- {
- Gui, Submit, NoHide
- grabcolor := true
- MsgBox % "Press C to grab color [DO NOT CLOSE THIS BEFORE YOU PRESS C]"
- path[path.maxIndex()+1] := "Move mouse to chatbox and on color " color
- pathInstructs[pathInstructs.maxIndex()+1] := color
- pathDetails[pathDetails.maxIndex()+1] := 3 ;3 is chatbox
- }
- return
- add_mouse_click:
- {
- Gui, Submit, NoHide
- path[path.maxIndex()+1] := "Click"
- pathInstructs[pathInstructs.maxIndex()+1] := click
- pathDetails[pathDetails.maxIndex()+1] := 4 ;4 is Click
- }
- return
- add_right_mouse_click:
- {
- Gui, Submit, NoHide
- path[path.maxIndex()+1] := "Click (Right)"
- pathInstructs[pathInstructs.maxIndex()+1] := right
- pathDetails[pathDetails.maxIndex()+1] := 5 ;5 is Right Click
- }
- return
- add_move_mouse_relative:
- {
- Gui, Submit, NoHide
- MsgBox % "Added XY relative " XRELATIVE "," YRELATIVE
- path[path.maxIndex()+1] := "Move Mouse Relative" XRELATIVE "," YRELATIVE
- pathInstructs[pathInstructs.maxIndex()+1] := XRELATIVE
- pathXY[path.maxIndex()] := YRELATIVE
- pathDetails[pathDetails.maxIndex()+1] := 6 ;6 is move mouse relative
- }
- return
- add_move_mouse_absolute:
- {
- Gui, Submit, NoHide
- MsgBox % "Added XY absolute " XABSOLUTE "," YABSOLUTE
- path[path.maxIndex()+1] := "Move Mouse Absolute" XABSOLUTE "," YABSOLUTE
- pathInstructs[pathInstructs.maxIndex()+1] := XABSOLUTE ;
- pathXY[path.maxIndex()] := YABSOLUTE
- pathDetails[pathDetails.maxIndex()+1] := 7 ;7 is move mouse absolute
- }
- return
- add_type:
- {
- Gui, Submit, NoHide
- MsgBox % "Will type " TYPE " and hit {ENTER}!"
- path[path.maxIndex()+1] := "Type <" TYPE ">"
- pathInstructs[pathInstructs.maxIndex()+1] := TYPE
- pathDetails[pathDetails.maxIndex()+1] := 8 ;8 is type
- }
- return
- add_sleep:
- {
- Gui, Submit, NoHide
- MsgBox % "Will sleep " MILLI "milliseconds"
- path[path.maxIndex()+1] := "Sleep for " MILLI
- pathInstructs[pathInstructs.maxIndex()+1] := MILLI
- pathDetails[pathDetails.maxIndex()+1] := 9 ;9 is sleep
- }
- return
- add_sleepU:
- {
- Gui, Submit, NoHide
- sleepU := true
- MsgBox % "Press C to grab color you're waiting for [DO NOT CLOSE THIS BEFORE YOU PRESS C]"
- path[path.maxIndex()+1] := "Wait for " colorSU
- pathInstructs[pathInstructs.maxIndex()+1] := colorSU
- pathDetails[pathDetails.maxIndex()+1] := 10 ;10 is subgame window wait for color
- }
- return
- add_sleepUI:
- {
- Gui, Submit, NoHide
- SleepUI := true
- MsgBox % "Press C to grab color you're waiting for [DO NOT CLOSE THIS BEFORE YOU PRESS C]"
- path[path.maxIndex()+1] := "Wait for " colorSU
- pathInstructs[pathInstructs.maxIndex()+1] := colorSU
- pathDetails[pathDetails.maxIndex()+1] := 11 ;11 is inventory wait for color
- }
- return
- remove_last_element:
- {
- path.Pop()
- pathDetails.pop()
- pathInstructs.pop()
- MsgBox "Element deleted."
- }
- return
- c::
- if (grabcolor = true)
- {
- MouseGetPos X, Y
- PixelGetColor, color, X, Y
- MsgBox
- (
- Color: %color%
- Mouse Coords: %X%, %Y%
- This color has been noted.
- )
- grabcolor := false
- }
- if (started = true)
- {
- stop := true
- }
- if (sleepU = true or sleepUI = true)
- {
- MouseGetPos X, Y
- PixelGetColor, colorSU, X, Y
- MsgBox
- (
- Color: %colorSU%
- Mouse Coords: %X%, %Y%
- This color has been noted.
- )
- sleepU := false
- sleepUI := false
- }
- return
- GuiClose:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement