From abc55276c6f6eea40f5be75308856912af07d17b Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 6 Aug 2023 21:47:59 +0200 Subject: [PATCH] Channel.start with integer start_delay led to a traceback. Resolve #3240 --- CHANGELOG.md | 1 + evennia/scripts/scripts.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6484411f97..3a10238f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix: Make sure `at_server_reload` is called also on non-repeating Scripts. - Fix: Webclient was not giving a proper error when sending an unknown outputfunc to it. - Fix: Make `py` command always send strings unless `client_raw` flag is set. +- Fix: `Script.start` with an integer `start_delay` caused a traceback. - Docs: Remove doc pages for Travis/TeamCity CI tools, they were both very much out of date, and Travis is not free for OSS anymore. - Docs: A lot fixes of typos and bugs in tutorials. diff --git a/evennia/scripts/scripts.py b/evennia/scripts/scripts.py index 7abd589c34..fcf2c76f29 100644 --- a/evennia/scripts/scripts.py +++ b/evennia/scripts/scripts.py @@ -205,7 +205,9 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase): self.db_interval = interval update_fields.append("db_interval") if start_delay is not None: - self.db_start_delay = start_delay + # note that for historical reasons, the start_delay is a boolean field, not an int; the + # actual value is only used with the task. + self.db_start_delay = bool(start_delay) update_fields.append("db_start_delay") if repeats is not None: self.db_repeats = repeats @@ -244,7 +246,9 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase): if not self.ndb._task.running: # if not unpausing started it, start script anew with the new values - self.ndb._task.start(self.db_interval, now=not self.db_start_delay) + self.ndb._task.start( + self.db_interval, now=not self.db_start_delay, start_delay=start_delay + ) self.at_start(**kwargs) @@ -547,7 +551,7 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase): Keyword Args: interval (int): How often to fire `at_repeat` in seconds. - start_delay (int): If the start of ticking should be delayed. + start_delay (int): If the start of ticking should be delayed and by how much. repeats (int): How many repeats. 0 for infinite repeats. **kwargs: Optional (default unused) kwargs passed on into the `at_start` hook.