From 5589a95a8f46c1e043b3dd0b2e7b007b9b5b07c2 Mon Sep 17 00:00:00 2001 From: jenzur Date: Sun, 20 Sep 2020 20:19:07 +0200 Subject: [PATCH] minor updates to print and wait timing --- AutismBotIngame/python/ingamefollowct.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index 9a1cbfac..410783cc 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -15,11 +15,16 @@ looptestPath = '/home/gameservers/.steam/steam/steamapps/common/Counter-Strike S chatmsg = "" ladder_counter = 0 -def writeCfgInput(Input): +def colored(r, g, b, text): + return "\033[38;2;{};{};{}m{} \033[38;2;255;255;255m".format(r, g, b, text) + +def writeCfgInput(Input_user): with open(looptestPath, 'w') as f: if input == "wait 5;": time.sleep(1) - f.write(Input) + colored_text = colored(255, 0, 0, ('Input: ' + Input_user)) + print(colored_text) + f.write(Input_user) def exit_handler(): print('reached exithandler') @@ -29,6 +34,7 @@ def joinTeam(): str = "jointeam 2; joinclass 3; zspawn;" writeCfgInput(str) print('jointeam func: ') + writeCfgInput('wait 5;') def bot_process_surf(input_line): bot_surf_plane = input_line[input_line.index("surfing:") + len("surfing:"):] @@ -138,6 +144,7 @@ def bot_connect_ze(): strdev = "connect 151.80.230.149:27019/test132;" str1 = "connect 151.80.230.149:27015;" writeCfgInput(str1) + writeCfgInput('wait 5;') print('not yet connected') if __name__ == '__main__': @@ -168,6 +175,7 @@ if __name__ == '__main__': response_msg = f"""say {data}""" print("enabled remote UDP packet response_msg: ", response_msg) writeCfgInput(response_msg) + writeCfgInput("wait 5;") if data == "autismo connected": print('Bot connected!') connection_issue_counter = 0