Skip to content

Instantly share code, notes, and snippets.

@rdp
Forked from CreamyGhost25/ttdbot.py
Last active November 2, 2024 09:15
Show Gist options
  • Save rdp/bee70cc1524295eefaf5a6b787d39617 to your computer and use it in GitHub Desktop.
Save rdp/bee70cc1524295eefaf5a6b787d39617 to your computer and use it in GitHub Desktop.
# Import things
import subprocess
import pyautogui
import time
import pydirectinput
from pathlib import Path
print('might want to click on roblox focus')
time.sleep(5)
print(pyautogui.position())
def selectUnitSlotSix():
roClick(1211, 981)
def selectUnitSlotThree():
roClick(945, 981)
def roHoldKey(keyDown, timeDown):
pydirectinput.keyDown(keyDown)
time.sleep(timeDown)
pydirectinput.keyUp(keyDown)
time.sleep(0.1)
def roHover(mouseXPos, mouseYPos):
pydirectinput.moveTo((mouseXPos+1), (mouseYPos+1))
time.sleep(0.1)
pydirectinput.moveTo(mouseXPos, mouseYPos)
time.sleep(0.1)
def roClick(mouseXPos, mouseYPos):
roHover(mouseXPos, mouseYPos)
pyautogui.click(x=mouseXPos, y=mouseYPos, clicks=1, interval=1, button='left')
time.sleep(0.1)
def clickAutoSkip():
roClick(1031, 100)
def clickReconnect ():
roClick(1070, 610)
def selectTeleportMenu():
roClick(217, 51)
def scrollAndSelectEndlessTeleport():
# scrolls down to endless teleport
roHover(217, 156)
for i in range(5):
pydirectinput.scroll(-1) # scroll to bottom
time.sleep(0.1)
# clicks teleport to endless
roClick(216, 126)
def walkToendlessSquare ():
#walks forward towards entering endless
roHoldKey('w', 5)
#walks from the endless wall into a cubicle
roHoldKey('a', 0.1)
roHoldKey('s', 0.1)
def clickStartGame():
roClick(983, 753)
time.sleep(1)
roClick(983, 753) # click again in case it showed up late
def placeMewingTV():
print ('placing mewing')
selectUnitSlotThree()
roClick(939, 807)
def mewingUpgrade ():
roClick(939, 807)
roClick(120, 585)
def spawnToPlaceMewing():
print("waiting for lobby load fully")
time.sleep(45)
lobbyToPlaceMewing()
def lobbyToPlaceMewing():
selectTeleportMenu()
scrollAndSelectEndlessTeleport()
walkToendlessSquare()
clickStartGame()
bootStrapGame()
def bootStrapGame():
print("letting game first load up")
time.sleep(30) # 24s had some auto skips not click?
clickAutoSkip()
time.sleep(40) # waits for money to affordc mewing jamin 40 me 10
placeMewingTV()
# jamin 90, me 30
time.sleep(90) # stall while can't upgrade yet anyway to get more extra money
useEndlessAbility() # extra money
def clickLobby():
roClick(1055, 763)
def clickPlayAgain():
roClick(1312, 766)
time.sleep(5) # has its own countdown thing
def useEndlessAbility () :
roHoldKey('c',0.1)
#clickPlayAgain()
bootStrapGame()
loopInfinite = 1
# LOOP ALL THIS
while loopInfinite!=0:
loopInfinite+=1
subprocess.run(["capture.bat", "out.png"])
# check image
if loopInfinite%2==0:
subprocess.run(["C:\\Program Files\\Tesseract-OCR\\tesseract.exe", "out.png", "ocr", "-c", "thresholding_method=2"])
else:
subprocess.run(["C:\\Program Files\\Tesseract-OCR\\tesseract.exe", "out.png", "ocr", "-c", "thresholding_method=0"])
# if image text = restart (fortress)
txt = Path('ocr.txt').read_text(encoding='utf-8')
#click play again
if "ortress" in txt or "Beaten" in txt:
#clickLobby()
#spawnToPlaceMewing()
# jamin
clickPlayAgain()
bootStrapGame()
# if image text = disconnected
elif "connect" in txt:
print('string', "iscon_____", 'Found in File')
clickReconnect()
spawnToPlaceMewing()
else:
mewingUpgrade()
# threshold 0 saw teleports and quests
# want clickPlayAgain()
# want I am a bot
@rdp
Copy link
Author

rdp commented Aug 12, 2024

python

@rdp
Copy link
Author

rdp commented Sep 21, 2024

@rdp
Copy link
Author

rdp commented Sep 26, 2024

want: click on start again

@rdp
Copy link
Author

rdp commented Sep 26, 2024

I am a bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment