Skip to content

Instantly share code, notes, and snippets.

@QuadStorm
Last active November 20, 2019 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuadStorm/0a6e8f1933202513dd0ea2d6904d9064 to your computer and use it in GitHub Desktop.
Save QuadStorm/0a6e8f1933202513dd0ea2d6904d9064 to your computer and use it in GitHub Desktop.
autosave, autorestart on close, autorefresh(restart) every ~9 days - made for lot build + cheeseville
#Persistent
#SingleInstance Force
SetTitleMatchMode 2
serverWindow = BrickadiaServer-Win64-Shipping.exe
EnvGet, LocalAppData, LocalAppData
buildsFolder = %LocalAppData%\Brickadia\Saved\Builds
SetKeyDelay, 5, 10
InputBox, BrickadiaDirectory, Input Brickadia Directory, Input the directory of your game (should end with "Brickadia_Alpha4_Patch1_CL3642_Win64")
SetTimer, Autosave, 1800000
SetTimer, Autorestart, 300000
SetTimer, Autorefresh, -777777777
Return
Autosave:
IfWinExist, %serverWindow%
{
KeyWait Control
KeyWait Alt
KeyWait Shift
BlockInput On
ControlSend,, {Esc}+chat.+broadcast +`,color=+'999999+'+.+saving +bricks+`,/+.{ENTER}, %serverWindow%
FormatTime, Timestamp,%A_NowUTC%,yyyy-MM-dd HH-mm-ss
ControlSend,, {Esc}+bricks.+save +'+lot +build {+} +cheeseville %Timestamp%+'{ENTER}, %serverWindow%
ControlSend,, {Esc}+chat.+broadcast +`,color=+'00ff00+'+.+saved +bricks+`,/+.{ENTER}, %serverWindow%
BlockInput Off
}
Else
{
MsgBox Autosave Failed: No Server Window Found
}
Return
Autorestart:
IfWinNotExist %serverWindow%
{
Run, %BrickadiaDirectory%\Brickadia\Binaries\Win64\BrickadiaServer-Win64-Shipping.exe -log, %BrickadiaDirectory%\Brickadia\Binaries\Win64
WinWait, %serverWindow%
Sleep 5000
Loop, %buildsFolder%\*.brs
{
If (A_LoopFileTimeCreated>Rec)
{
FName=%A_LoopFileName%
Rec=%A_LoopFileTimeCreated%
}
}
FName := SubStr(FName, 1, -4)
KeyWait Control
KeyWait Alt
KeyWait Shift
BlockInput On
ControlSend,, {Esc}+bricks.+load +', %serverWindow%
ControlSendRaw,, %FName%, %serverWindow%
ControlSend,, +'{ENTER}, %serverWindow%
BlockInput Off
SoundBeep, 1000, 200
MsgBox Server Restarted
SetTimer, Autorefresh, -777777777
SetTimer, Autosave, 1800000
Return
}
Else
Return
Autorefresh:
SoundBeep, 1000, 200
KeyWait Control
KeyWait Alt
KeyWait Shift
ControlSend,, {Esc}+chat.+broadcast +`,color=+'ff0000+'+.+`,b+.+w+a+r+n+i+n+g+; Server refreshing in 60 seconds+1 +prepare to leave.+`,/+.{ENTER}, %serverWindow%
Sleep 60000
Gosub, Autosave
KeyWait Control
KeyWait Alt
KeyWait Shift
ControlSend,, {Esc}+chat.+broadcast +`,color=+'ff0000+'+.+`,b+.+r+e+s+t+a+r+t+i+n+g +s+e+r+v+e+r+1 Rejoin in 5 minutes+1+`,/+.{ENTER}, %serverWindow%
SoundBeep, 2000, 200
WinClose, %serverWindow%
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment