Python Forum
Quick Help - Timers - Need Small Solution for Working Code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick Help - Timers - Need Small Solution for Working Code
#1
Good Evening,

I am looking to get some help as programming is not my game, I am into networking.

To explain intentions:

This code is being used locally at home on a device that is not connected to the internet. This code is being used for a PlayStation 4 Competitive Basketball team to automate play calling. I will attach what I have at the present time, it is working code, but needs to be regenerated/re-executed each time I want to see a new play. I would like the script to run on like a 30 to 60 second timer until I stop the program.

import random

def random_line(pname):
	lines = open(pname).read().splitlines()
	return random.choice(lines)
print(random_line('listofplays.txt'))
Output:
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> RESTART: C:\Users\HOUSTONE\Desktop\NBA2K Play Calling Script\playcallscript.py Pick & Roll (1/3) (HARD) >>> RESTART: C:\Users\HOUSTONE\Desktop\NBA2K Play Calling Script\playcallscript.py Pick & Pop (1/4) (SOFT) >>> RESTART: C:\Users\HOUSTONE\Desktop\NBA2K Play Calling Script\playcallscript.py Pick & Pop (1/4) (HARD) >>>
Any help is greatly appreciated!!!
Reply


Messages In This Thread
Quick Help - Timers - Need Small Solution for Working Code - by EwH006 - Jan-19-2019, 10:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 1,037 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  code not working when executed from flask app ThomasDC 1 972 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  I am new to python and Could someone please explain how this below code is working? kartheekdas 2 1,072 Dec-19-2022, 05:24 PM
Last Post: kartheekdas
Exclamation My code is not working as I expected and I don't know why! Marinho 4 1,137 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  small code for sampel asn1ate borys 0 897 Jul-26-2022, 10:48 AM
Last Post: borys
  Can someone explain this small snippet of code like I am a 5 year old? PythonNPC 3 1,305 Apr-08-2022, 05:54 PM
Last Post: deanhystad
  My Code isn't working... End3r 4 2,007 Mar-21-2022, 10:12 AM
Last Post: End3r
  please looking for typo in my code (solution please) jamie_01 1 1,317 Jan-12-2022, 06:45 AM
Last Post: Gribouillis
  i need help with a small code Jacobthefirst 1 1,531 Sep-22-2021, 03:33 PM
Last Post: bowlofred
  Newbie - code solution explained Stjude1982 2 1,942 Sep-16-2021, 08:54 AM
Last Post: Stjude1982

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020