adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] changes, problems & solutions


From: Kai Sterker
Subject: Re: [Adonthell-devel] changes, problems & solutions
Date: Sun, 16 Jun 2002 22:08:27 +0200

On Sat, 15 Jun 2002 22:21:25 +0200 Kai Sterker wrote:

> A solution would be to have a prepare_ or queue_schedule method that
> will override the manager script. If a schedule wants another script
> to run, it would queue it and quit itself with above method. The next
> update would spot the stopped schedule, but instead of running the
> manager script, it would use the queued script as new schedule.
> That'll cause none of the problems described.

I've finished that. Everything working much better now. I'll attach the
updated test scripts. The activities are still the same, but they make
use of the new features. See cinema.py for events with callbacks. Both
cinema.py and pub.py also give an example of schedules overriding the
manager script.

Note how much simpler the manager script (student.py) now is.


Another problem still remains though. The manager script was running
before clearing the old schedule. So under certain circumstances, the
manager script accesses character data that is no longer up-to-date.
(Because the internal script state is usually written back to the
character in the schedule destructor).

I fixed that for the case that the schedule has stopped itself. However,
if an alarm was set, the manager script will be called directly (as it
is the script attached to the time_event). Looks like we'll _need_ C++
callbacks for our events after all ;). 

That way, the event could also use the set_running(false) call to stop
the schedule and leave everything else to the update() method. That'll
mean, the only point where a schedule might change would be during the
update function. It'll be a good thing, if everything is handled in the
same fashion.

It also means I can remove the event/shared_script crap before anyone
has a closer look at it :P.

Kai

Attachment: schedtest.tgz
Description: GNU Unix tar archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]