Jieguan runtime scheduler to simulate human playing (python and exe available)

smby

Member
LATEST VERSION: https://www.afkbots.com/index.php?resources/jieguan-human-simulation-runtime-scheduler-beta.9/



I wrote a gui-based python script:
1656628527325.png


"How long to run (hours)" is how long the bot will run for (this includes playtime and breaks)
"Interval of running (hours)" is a range of how long it will bot straight, in this case, between 2 and 5 hours at a time
"Interval of break (minutes" is a range of how long the bot will take a break after it finishes each run interval

As soon as the how long to run time is reached, bot will kill itself and stop running.

Warning: as of today, I just wrote this so I have only tested that the intervals of running and breaking work - I haven't confirmed that it will stop running after 12 hours :)
Python source code here:

Python:
import time
import random
import sys
import os
import subprocess
import PySimpleGUI as sg


form = sg.FlexForm('PythonTest')
layout = [
          [sg.Text('Please enter your runtime settings')],
          [sg.Text('How long to run (hours):', size=25), sg.InputText('12', key='runtime')],
          [sg.Text('Interval of running (hours):', size=25), sg.InputText('2', key='minrangehours'), sg.InputText('5',key='maxrangehours')],
          [sg.Text('Interval of break (minutes):', size=25), sg.InputText('15', key='minrangeminutes'), sg.InputText('60', key='maxrangeminutes')],
          [sg.Submit(), sg.Cancel()]
         ]
window = sg.Window('Run Schedule', layout)  
event, values = window.read()
if event == 'Cancel':
    os._exit(0)
window.close()  


try: #Make sure values are integers!
    for item in values:
        int(values[item])
except ValueError as e:
    print ('You are noob like zhipei! Only number work in program') #how dare u call me noob zhipei (╬◥益◤)
starttime=time.perf_counter()
timedefault=values['runtime']
minrun = int(values['minrangehours'])
maxrun = int(values['maxrangehours'])
minbreak = int(values['minrangeminutes'])
maxbreak = int(values['maxrangeminutes'])
hours=int(3600)
minutes=int(60)

print("Running for " + str(timedefault) + " hours")

while( ((time.perf_counter()-starttime)/hours) < int(timedefault)):
    runtime = random.randint(minrun*hours, maxrun*hours)
    print("This run will be for " + str(round(runtime/hours, 2)) + " hours")
    startrun=time.perf_counter()
    arr = os.listdir()
    filename = ""
    for file in arr:
        if file.endswith(".exe"):
            if len(file)==16:
                filename = file
    if filename == "":
        print("FILE NOT FOUND")
        sys.exit()
    DETACHED_PROCESS = 0x00000008
    pid = subprocess.Popen([filename],creationflags=DETACHED_PROCESS).pid
    while( ((time.perf_counter()-startrun) < runtime) and (((time.perf_counter()-starttime)/hours) < int(timedefault)) ):
        pass

    sleeptime = random.randint(minbreak*minutes,maxbreak*minutes)
    print("taking break for " + str(round(sleeptime/minutes, 2)) + " minutes")
    temppath = os.getenv("LocalAppData")
    arr = os.listdir(temppath + "\\Temp")
    runningfile = ""
    for file in arr:
        if file.endswith(".exe"):
            if len(file)==16:
                runningfile = file
    subprocess.call("taskkill /im "+runningfile, stdout=subprocess.PIPE)
    subprocess.call("taskkill /im "+ "d2r.exe", stdout=subprocess.PIPE)
    time.sleep(sleeptime)

EXE is attached as zip file (compiled via PyInstaller)
 

Attachments

  • run-scheduler.zip
    9.2 MB · Views: 109
Last edited:
Top