swarm-support
[Top][All Lists]
Advanced

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

Re: ordering events in a swarm ....


From: Paul Johnson
Subject: Re: ordering events in a swarm ....
Date: Fri, 11 Jun 1999 13:08:09 -0500

> - start
> {
>   count = 0;
>   schedule = [Schedule create: globalZone];
>   [self schedule: 3];
>    [[schedule activateIn: nil] run];
>    [schedule at: 7 createActionTo: objecta message: M(actiona)];
>    [schedule at: 5 createActionTo: objectb message: M(actionb)];
>   // ...more new schedule for 'schedule' object
>   // ...
>    return self;
> }
> 
> My original thought was that: 'schedule' object is created, activated,
> and run at first; then some new objects such as objecta, objectb, ...,
> are created at some random stages later, and they will randomly send
> 'schedule' actions, such as actiona, actionb, .....
> Maybe my original idea was wrong. I will give up trying.
> Marcus' example currently will help me.
> Thanks again!

Just to see if this thread does close off after this, let me make sure I
understand the problem.  In the code snip above, objecta and objectb DO
NOT EXIST at the time the start method is executed.  As a result,
telling the schedule to plan actions for them does nothing.

In order to rectify this situation, one must first create objects, then
send a message to the ModelSwarm telling it to place those objects in a
schedule.

Here is an alternative that I thing might work.  If you change your
schedule at: command to refer to a list, then objects that are created
and added to the list would get grabbed by the schedule:
  [schedule at: 7 createActionForEach: aList message: M(actiona)];
The object aList must be created before this executes, but it does allow
the freedom to create objects later, as long as they put themselves in
aList.

I've made mistakes of this sort in the past, where code sends messages
to objects that are not yet created.  It is a frustrating kind of bug
because you don't necessarily get an error message, its just that
nothing happens.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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