just some basic actions

This commit is contained in:
jenzur 2020-01-26 02:29:34 +01:00
parent 6c9ebc1fb0
commit e95d3a7b11
2 changed files with 17 additions and 14 deletions

View File

@ -20,13 +20,13 @@ from time import sleep
#-nopreload seemingly prevents from joining servers
#cd /home/nonroot/.steam/
#./steam.sh -applaunch 240 -textmode -novid -nosound -noipx -nojoy -noshaderapi -condebug +exec looptest.cfg
#./steam.sh -applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi -condebug +exec looptest.cfg
#
def joinsteam():
subprocess.Popen(["steam", "-login", "username","password"])
sleep(25)
subprocess.Popen(["/home/nonroot/.steam/steam.sh", "-applaunch 240 -textmode -novid -nosound -noipx -nojoy -noshaderapi -condebug +exec looptest.cfg"])
subprocess.Popen(["/home/nonroot/.steam/steam.sh", "-applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi -condebug +exec looptest.cfg"])
if __name__ == '__main__':
joinsteam()

View File

@ -1,8 +1,7 @@
import os
import subprocess
import atexit
import time
import threading
from threading import Timer
import string
import random
@ -22,7 +21,7 @@ def writeCfgInput(Input):
def getconsoleOutputForStatus(input):
randomlygeneratedString = id_generator(11)
str = "status; wait 5; sm_botfindString {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
str = "status; wait 5; {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
print('writeCfgInput')
writeCfgInput(str)
checkConsoleOutput(randomlygeneratedString)
@ -37,7 +36,7 @@ def getconsoleOutputForStatus(input):
def getConsoleOutputForTeams():
teamvalues = ['Spectactor', 'Terrorist', 'Counter-Terrorist']
randomlygeneratedString = id_generator(11)
str = "sm_teaminfo; wait 50; sm_botfindString {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
str = "sm_teaminfo; wait 50; {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
while True:
writeCfgInput(str)
#is sm_team a command to show team?
@ -70,18 +69,20 @@ def resetCfgInputShortWait():
#getpos
randomlygeneratedString = id_generator(11)
print('randomlygeneratedString: ', randomlygeneratedString)
str = "wait 5; sm_botfindString {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
str = "wait 50; {0}; wait 50; exec looptest.cfg;".format(randomlygeneratedString)
with open(looptestPath, 'w') as f:
f.write(str)
checkConsoleOutput(randomlygeneratedString)
def exit_handler():
resetCfgInputShortWait()
print('exithandler')
#resetCfgInputShortWait()
def joinTeam():
clearconsolelog()
randomlygeneratedString = id_generator(11)
str = "jointeam 2; wait 2; zspawn; wait 1; sm_botfindString {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
writeCfgInput(str)
checkConsoleOutput(randomlygeneratedString)
@ -95,20 +96,22 @@ def checkbotteam():
def checkIfConnected():
clearconsolelog()
str1 = "connect 151.80.230.149:27015; wait 500; exec looptest.cfg;"
randomlygeneratedString = id_generator(11)
str1 = "connect 151.80.230.149:27015; wait 5; {0}; wait 500; exec looptest.cfg;".format(randomlygeneratedString)
if (getconsoleOutputForStatus("hostname:")):
writeCfgInput(str1)
time.sleep(2)
checkConsoleOutput(randomlygeneratedString)
resetCfgInputShortWait()
checkbotteam()
resetCfgInputShortWait()
followPlayer()
threading.Timer(60.0 * 5, checkIfConnected).start()
def followPlayer():
#randomlygeneratedString = id_generator(11)
default_input = "+attack; wait 1; cl_minmodels 1; wait 5; setang 0 180 0; wait 1;"
randomlygeneratedString = id_generator(11)
#setang 0 180 0;
default_input = "+attack; wait 50; cl_minmodels; wait 50; +right; wait 50; +jump; wait 50; -jump; wait 50; +forward; wait 50; {0}; wait 5; exec looptest.cfg;".format(randomlygeneratedString)
writeCfgInput(default_input)
checkConsoleOutput(randomlygeneratedString)
#print('start of method \n')