I've written a script which uses the sleep() function from the time module. Some of my functions only sleep for a five seconds, which doesn't seem to cause any problems, but when this particular function sleeps, it does so for 23 seconds, and this causes MUSHclient to freeze entirely (Not Responding). I've only run the script all the way through once; it froze up for the duration of the script (23 seconds times the 22 times the loop was executed), but was back to normal after. However, I experimented with the function a second time, only running one iteration of the loop (23 seconds) and the client froze for several minutes, and when it seemed like it wouldn't return to normal, I terminated its process via the Task Manager.
Below is the function I use.
I've got experience writing code. Just not good code. There may be some kinda of inefficiency or unnecessary steps in the code. My main question is: Is MUSH supposed to freeze for the duration of the sleep() function? If so, how can I prevent it from doing so?
Below is the function I use.
def study(pages):
i = 1
while i < pages:
world.send("flip book to %s" % i)
world.send("study book")
i += 1
sleep(21)
I've got experience writing code. Just not good code. There may be some kinda of inefficiency or unnecessary steps in the code. My main question is: Is MUSH supposed to freeze for the duration of the sleep() function? If so, how can I prevent it from doing so?