Stopping a timed event

In case anyone else runs into this: Inform doesn’t by default provide a way to stop a timed event that’s already been scheduled. Here’s the technique I used.

Include (-
[ ClearTimedEvent rule i b;
	for (i=1: i<=(TimedEventsTable-->0): i++) {
		if (rule == TimedEventsTable-->i) { b=i; break; }
		if (TimedEventsTable-->i == 0) rtrue; ! We went through the whole table and didn't find this event.
	TimedEventsTable-->b = 0;

To (R - rule) never:
	(- ClearTimedEvent({-mark-event-used:R}); -).

Now if you set an event with “the bomb explodes in five minutes from now”, you can clear it with “the bomb explodes never”. (Awkward English, but “the bomb explodes” needs to be exactly the same phrase as when it was set.)

Available as a mini-extension at Github.

(A note on the code: it’s messier than it needs to be, in order to follow the structure of SetTimedEvent. Hopefully that’ll make it easier to update if the I6T layer changes.)

Snagged. I was accomplishing this by tying events to a truth statement that was set true when the event started, and the result code could be canceled by setting it false. This is much neater. Thank you!

This should definitely go in the monthly digest of forum activity – a useful feature that seems easy to implement and should probably be part of the default functionality of Inform 7.

I’d log a formal suggestion for it at uservoice, but I’m out of points.

The usual process - and I’ve learned this by flooding Emily unnecessarily at the beginning, and she never had to say anything 'cause I quickly learned how unnecessary it was - is to identify an issue and raise it on Mantis or Uservoice.

I’m keeping the monthly digests for anything else. For instance, issues that keep cropping up despite already being known bugs. Well, mostly that, really.

There are a couple of things like this in Inform 7. A similar one is “I want a command to make a scene end, like “now the train_arrives scene is over”.” I7 just doesn’t work that way. And the usual way of using a timer in I7 as I understand it is to add a condition to the part of the code that triggers when the timer’s over, which for all intents and purposes works the same way as “now the bomb explodes never”.

My point is, I’m not seeing this changing, but even if it does, Emily and Graham are much more likely to respond through it if it goes through the usual channels.

I think the issue with normal channels may be that so many people are out of points. This was brought up on Uservoice itself–they can’t give us more points without spending lots of money–but it does rather gum up the usual channels.

That’s good to know. Thanks for bringing it up - I’ll be more attentive with a view to reporting this sort of thing as well.

You may have noticed that an “Andrew Z. Plotkin” showed up on uservoice and started filing suggestions after “Andrew Plotkin” ran out of points.

It’s also quite possible that there are three other matt w’s on the Uservoice forum… but those are all actually different people.

Hah! seems as though the Cancel Event discussed in a recent topic [url]] has a solution after all. By experiment, we determined that an event could have its end-time altered by resetting the event, and could be cancelled by resetting it with a negative duration.

Two topics touching the same issue in the same month. Definitely reporting it.

Thanks for suggesting it in the first place, otistdog. :slight_smile: