Page 1 of 1

Golly crash

Posted: December 1st, 2017, 12:43 pm
by lifeisawesome
This is the code I'm using:

Code: Select all

import time, golly as g
x = int(g.getstring("Enter generation delay (in milliseconds):"))/1000
if x <= 0:
  g.show("Invalid number.")
  exit()

while True:
  g.run(1)
  time.sleep(x)
When I run this script on Golly 3.0, it exits.

Re: Golly crash

Posted: December 1st, 2017, 5:27 pm
by rowett
The int needs to be a float or x becomes 0 for any input less than 1000 at which point you call exit().

Also don't call exit() because it will exit the process. Perhaps use an else: for the while clause.

Oh and you'll need a call to g.update() after g.run(1) to refresh the display.

Re: Golly crash

Posted: December 4th, 2017, 10:55 am
by lifeisawesome
Oh, exit() was the problem.