Skip to content

Instantly share code, notes, and snippets.

@cornernote
Last active Oct 12, 2019
Embed
What would you like to do?
;
; Auto-Farmer for Bee Swarm Simulator
; Version 1.0
;
; Copyright 2019 Brett O'Donnell
;
#include <TrayConstants.au3>
Local $gumdropsSlot; = 2
Local $converterSlot; = 6
Local $sizeX = 80
Local $sizeY = 100
Local $minLengthX
Local $maxLengthX
Local $changeLengthX
Local $initialLengthX
Local $currentLengthX
Local $minLengthY
Local $maxLengthY
Local $changeLengthY
Local $initialLengthY
Local $currentLengthY
Local $currentFarming
Local $currentWards
Local $currentWise
HotKeySet('^x', 'End')
Func End()
Send("{W UP}")
Send("{A UP}")
Send("{S UP}")
Send("{D UP}")
TrayTip('BSS Farmer is EXITING!', 'bye bye...', 0, $TIP_ICONASTERISK)
Sleep(3000)
Exit
EndFunc
HotKeySet(']', 'IncreaseSizeX')
Func IncreaseSizeX()
SetSizeX($sizeX / 0.8)
EndFunc
HotKeySet('[', 'DecreaseSizeX')
Func DecreaseSizeX()
SetSizeX($sizeX * 0.8)
EndFunc
HotKeySet('=', 'IncreaseSizeY')
HotKeySet('+', 'IncreaseSizeY')
Func IncreaseSizeY()
SetSizeY($sizeY / 0.8)
EndFunc
HotKeySet('-', 'DecreaseSizeY')
Func DecreaseSizeY()
SetSizeY($sizeY * 0.8)
EndFunc
Func SetSizeX($_size)
$sizeX = $_size
$minLengthX = 5 * $sizeX
$maxLengthX = 16 * $sizeX
$changeLengthX = 1 * $sizeX
$initialLengthX = $minLengthX
SetTrayTip()
EndFunc
Func SetSizeY($_size)
$sizeY = $_size
$minLengthY = 5 * $sizeY
$maxLengthY = 16 * $sizeY
$changeLengthY = 1 * $sizeY
$initialLengthY = $minLengthY
SetTrayTip()
EndFunc
HotKeySet('0', 'Farm')
Func Farm()
If $currentFarming Then
$currentFarming = False
SetTrayTip()
Else
$currentFarming = True
SetTrayTip()
EndIf
EndFunc
SetTrayTip()
Func SetTrayTip()
Local $status = 'PAUSED'
If $currentFarming Then
$status = 'RUNNING'
EndIf
Local $title = 'BSS Farmer is ' & $status & ' size:' & Round($sizeX) & 'x' & Round($sizeY)
Local $message = 'Press "0" to toggle farming' & @CRLF & 'Press "+" / "-" to change Y-Size' & @CRLF & 'Press "[" / "]" to change Y-Size' & @CRLF & 'Press "[ctrl] + x" to Exit';
TrayTip($title, $message, 0, $TIP_ICONASTERISK)
TraySetToolTip($title & @CRLF & $message)
EndFunc
Func Init()
$currentLengthX = $initialLengthX - $changeLengthX
$currentLengthY = $initialLengthY - $changeLengthY
$currentWards = 'out'
$currentWise = 'clock'
EndFunc
Func Loop()
If $currentFarming Then
If $currentWise == 'anti' Then
Key('W')
Key('A')
Key('S')
Key('D')
Else
Key('A')
Key('W')
Key('D')
Key('S')
EndIf
ChangeWards()
ChangeWise()
CheckFull()
Else
Sleep(100)
Init()
EndIf
EndFunc
Func Key($key)
If $currentFarming Then
ChangeLength()
Local $length
If $key=='W' Or $key=='S' Then
$length = $currentLengthY
Else
$length = $currentLengthX
EndIf
;ConsoleWrite($currentWise & ' ' & $currentWards & ' ' & $key & ' ' & $length & @CRLF)
Send("{" & $key & " DOWN}")
For $i = 0 To 10 Step 1
If $currentFarming Then
Sleep($length / 10)
EndIf
Next
Send("{" & $key & " UP}")
EndIf
EndFunc
Func ChangeWards()
If $currentWards == 'in' Then
If $currentLengthX <= $minLengthX Or $currentLengthY <= $minLengthY Then
$currentWards = 'out'
$currentLengthX = $minLengthX - $changeLengthX
$currentLengthY = $minLengthY - $changeLengthY
EndIf
Else
If $currentLengthX >= $maxLengthX Or $currentLengthY >= $maxLengthY Then
$currentWards = 'in'
$currentLengthX = $maxLengthX + $changeLengthX
$currentLengthY = $maxLengthY + $changeLengthY
EndIf
EndIf
EndFunc
Func ChangeWise()
If $currentLengthX <= $minLengthX Or $currentLengthY <= $minLengthY Then
If $gumdropsSlot Then
Send('{' & $gumdropsSlot & '}')
EndIf
If $currentWise == 'clock' Then
$currentWise = 'anti'
Else
$currentWise = 'clock'
EndIf
EndIf
EndFunc
Func ChangeLength()
If $currentWards == 'in' Then
$currentLengthX = $currentLengthX - $changeLengthX
$currentLengthY = $currentLengthY - $changeLengthY
Else
$currentLengthX = $currentLengthX + $changeLengthX
$currentLengthY = $currentLengthY + $changeLengthY
EndIf
EndFunc
Func CheckFull()
If $converterSlot Then
If PixelChecksum(1235, 30, 1239, 30) == 782173511 Then
TrayTip('Polin Container Full', 'Attempting to use converter in [SLOT-' & $converterSlot & ']...', 0, $TIP_ICONASTERISK)
Send('{' & $converterSlot & '}')
EndIf
EndIf
EndFunc
Init()
SetSizeX($sizeX)
SetSizeY($sizeY)
While True
Loop()
WEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment