Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #InstallMouseHook
- /*
- a simple bot for Anti-Idle: The Game
- In it's current state will harvest & replant the Free tree then send you into the battle arena
- And nudge the mouse to keep you from AFK'ing
- It / can / be reconfigured to plant different trees from the basic garden & send you into different areas.
- Quite ambitious and low quality. mostly works tho
- ; toDo:
- ::STUDY:: Implement Coordinates / Click recording for user made sequences from previous script
- ::STUDY:: GUI
- ::STUDY:: Convert coordinates to object
- ::CODE:: Create 'TogMouseLast'
- ::FEATURE:: Add Battery, Manual & Doom antSprayers behaviours in Misc.
- ::FEATURE::
- ::CODE:: Pause without resetting counters
- ::FEATURE:: Change Starting point offset whilst script is running / paused ^
- ::CODE:: Enhance MyHome
- ::INFO:: Create more splashText
- */
- CoordMode, Mouse, Screen
- CoordMode, Tooltip, Mouse
- MSGBODY = [F1] Toggles help message [Esc] will terminate this script `nTo activate:`n1. Go to the garden`n2. [Alt]+[LeftClick] on the top left corner above the text saying "Garden"`n(That will get the base value to offset button locations from.)`n3. [ALT]+[RightClick] Will activate
- msgbox,,FreeTreeBot,%MSGBODY%
- Busy := 0
- Harvested := 0
- TogRB := 0
- Timeout=50
- MenuClicKDelay := 500
- S := 1000
- M := S * 60
- H := M * 60
- D := H * 24
- NudgeInterval := 3 * S ;How often to nudge the mouse ( ms )
- TreeHarvest := 30000
- TreeLifeSpan := 5 * M
- ReplantEvery := floor(TreeLifeSpan / TreeHarvest)
- Numpad1::Harvested++
- Numpad2::Tooltip, % Harvested A_SPACE abs((TreeLifeSpan ) / S - ( Harvested * (TreeHarvest / S )))
- Numpad3::Tooltip, % NudgeInterval / 100
- ;----------------------------
- ;Input
- Return
- MyHome:
- BlockInput,MouseMove
- MovArena() ; MovArena() MovFishing() MovMarket()
- BlockInput,MouseMoveOff
- Return
- ; SORT THIS SHIT OUT M8
- Busy := If GetKeyState(LButton,T) | GetKeyState(RButton,T) ? 1 : 0
- ; Busy := 1
- ; } else {
- ; Busy := 0
- ; }
- ;Busy := If GetKeyState(LButton,T) or GetKeyState(RButton,T) {
- ; Busy := 1
- ; } else {
- ; Busy := 0
- ; }
- ;----------------------------
- !LButton:: ;set starting position
- Gosub DefineButtons
- return
- ;----------------------------
- !RButton::
- If (TogRB=1) {
- send {RButton}
- } else {
- BlockInput,MouseMove
- TogRB := 1
- MovFreeTree()
- MovPlantAll()
- Gosub MyHome
- BlockInput,MouseMoveOff
- Goto QuickStartRoutine
- }
- return
- ;----------------------------
- Routine:
- SetTimer, Routine, Off
- SetTimer, StayAlive, Off
- If (Harvested >= ( ReplantEvery-1 ) ) {
- Harvested := 0
- Gosub Replant
- } else {
- Gosub harvest
- }
- QuickStartRoutine:
- SetTimer, StayAlive, 100
- SetTimer, Routine, % TreeHarvest+100
- Return
- ;----------------------------
- harvest: ;Can be simplified with TogMouseLast
- Global Busy := 1
- Global Harvested += 1
- splashThis(100,50,"You've Harvested %Harvested% Times.")
- BlockInput,MouseMove
- MouseGetPos, x, y, ,Init
- mousemove AutoHarvestX,AutoHarvestY
- sleep 200
- click
- MouseMove x,y
- BlockInput,MouseMoveOff
- Global Busy := 0
- return
- ;----------------------------
- Replant:
- Global Busy := 1
- BlockInput,MouseMove
- MovAutoHarvest()
- MovGarden()
- MovFreeTree()
- MovDestroyAll()
- MovPlantAll()
- Completed += 1
- BlockInput,MouseMoveOff
- Gosub MyHome
- SplashThis(300,25,"You've completed %Completed% Harvests.")
- Global Busy := 0
- return
- ; Movement related ----------------------------
- MovFreeTree(){
- mousemove,xFreeTree,yFreeTree
- sleep MenuClicKDelay
- click
- }
- MovPlantAll(){
- mousemove,PlantAllX,PlantAllY
- sleep MenuClicKDelay
- click
- }
- MovAutoHarvest(){
- mousemove,AutoHarvestX,AutoHarvestY
- sleep MenuClicKDelay
- click
- }
- MovDestroyAll(){
- sleep MenuClicKDelay
- mousemove,DestroyAllX,DestroyAllY
- sleep MenuClicKDelay
- send +{click}
- sleep MenuClicKDelay
- }
- MovMenu(){
- mousemove,MenuX,MenuY
- sleep 200
- }
- MovGarden() {
- MovMenu()
- mousemove,GardenX - MenuX,GardenY - MenuY,,R
- sleep MenuClicKDelay
- click
- }
- MovArena() {
- MovMenu()
- mousemove,ArenaX - MenuX, ArenaY - MenuY,,R
- sleep MenuClicKDelay
- click
- }
- MovMarket() {
- MovMenu()
- mousemove,MarketX - MenuX,MarketY - MenuY,,R
- sleep MenuClicKDelay
- click
- }
- MovFishing() {
- MovMenu()
- mousemove,FishingX - MenuX,FishingY - MenuY,,R
- sleep MenuClicKDelay
- click
- }
- ;----------------------------
- DefineButtons:
- MouseGetPos, x, y, ,Init
- Global xCorner := x
- Global yCorner := y
- Global xFreeTree := xCorner + 25
- Global yFreeTree := yCorner + 325
- Global PlantAllX := xCorner + 335
- Global PlantAllY := yCorner + 330
- Global DestroyAllX := xCorner + 435
- Global DestroyAllY := yCorner + 330
- Global AutoHarvestX := xCorner + 40
- Global AutoHarvestY := yCorner + 480
- Global MenuX := xCorner + 450
- Global MenuY := yCorner + 10
- Global GardenX := xCorner + 450
- Global GardenY := yCorner + 65
- Global ArenaX := xCorner + 450
- Global ArenaY := yCorner + 90
- Global MarketX := xCorner + 450
- Global MarketY := yCorner + 235
- Global FishingX := xCorner + 450
- Global FishingY := yCorner + 290
- return
- ; Stay Alive - butchered from a previous script i wrote. ------------------------------------------------
- TogMisc:
- Active := !Active
- Activate:
- if !Active {
- SetTimer, StayAlive, Off ;
- } else {
- SetTimer, StayAlive, 100
- }
- return
- ;----------------------------
- CheckPos: ;Called by StayAlive when conditions are met.
- if(xCorner=xCurrent) & (yCorner=yCurrent) {
- Dance(1) ;To be replaced with "Is within the coordinates"
- } else {
- MouseMove,xCorner,yCorner
- Dance(9)
- MouseMove,xCurrent,yCurrent
- GoSub StayAlive
- }
- return
- ;----------------------------
- StayAlive: ;Tracks movement on a timer from TogMisc
- ; Not sure how it works if it sleeps same interval as it's called, Hope it doesn't leak memory
- MouseGetPos,xCheck,yCheck
- sleep 100
- mousegetpos, xCurrent, yCurrent
- Tooltip, % Busy
- ; ToolTip, % MovChk A_SPACE MovAccum A_SPACE TimeOut A_SPACE Busy
- MovChk := abs(xCheck-xCurrent + yCheck-yCurrent)
- MovAccum += MovChk > 0 && MovAccum < 25 ? 1 : 0
- MovAccum -= MovChk < 1 && MovAccum > 0 ? 1 : 0
- Timeout -= Timeout > 0 && MovAccum = 0 ? 1 : 0
- if (MovAccum<1) && (Timeout=0) && (Busy=0){
- Timeout := round( NudgeInterval / 100 )
- sum++
- GoSub CheckPos
- }
- return
- ;----------------------------
- Dance(SPD) { ;Callde by CheckPos
- BlockInput,MouseMove
- MouseMove,-5,0,100*SPD,R
- MouseMove,10,0,100*SPD,R
- MouseMove,-5,0,100*SPD,R
- BlockInput,MouseMoveOff
- }
- return
- ;----------------------------
- SplashThis(W=0,L=0,String="") {
- If (SplashTextOn) {
- SplashTextOff
- SplashTextOn,W,L,, % String
- setTimer splashOff, 2000
- Return
- } Else {
- SplashTextOn,W,L,, % String
- setTimer splashOff, 2000
- Return
- }
- splashOff:
- setTimer splashOff, Off
- ; tooltip, You weren't supposed to see this ;Shows up if triggered, debugging
- SplashTextOff
- Return
- }
- ;----------------------------
- F1::
- TogHelp := !TogHelp
- If !TogHelp {
- SplashTextOff
- } else {
- SplashTextOn,450,120,"Free Tree Bot" for Anti-Idle: The Game,%MSGBODY%
- }
- Return
- ;----------------------------
- ^esc::
- reload
- Return
- esc::
- IF (TogHelp=1) {
- TogHelp := 0
- SplashTextOff
- } else {
- toolTip Terminating script
- sleep 1000
- ExitApp
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement