swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] Sending parameters via message: m()


From: Paul E. Johnson
Subject: Re: [Swarm-Support] Sending parameters via message: m()
Date: Fri, 12 Dec 2003 20:41:56 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114

James Keirstead wrote:

Hi,

I'm just beginning with SWARM and seem to be having trouble with some
basic syntax issues.  I've searched the web but can't seem to find
anything on the most basic question - such as:

While searching the "Internet", one is well advised to begin with the FAQ or the User Guide. I'd suggest:
http://www.ku.edu/~pauljohn/SwarmFaq/SwarmOnlineFaq.html#6.7
as well as
http://lark.cc.ukans.edu/~pauljohn/Swarm/Beta/SwarmUserGuide/swarm.user.user2.04-macro.sect1.html
(search for the term "wrapper")
I feel certain there are many working examples illustrating the wrapper idea in here
http://www.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/

for example

http://www.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/objc/MapIntegerIndex.txt
http://www.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/objc/serialization3.m


1) How do I send parameters via message: m()?

In buildActions of ModelSwarm.m I've got this code excerpt and I want to
pass parameters for getDistance X and Y.

 modelSchedule = [Schedule createBegin: self];
 [modelSchedule setRepeatInterval: 1];
 modelSchedule = [modelSchedule createEnd];
[modelSchedule at: 0 createActionTo: aCustomer message:
M(getDistanceX:Y:)];

This will compile and run, granted with garbage numbers since I don't
actually pass anything to getDistance.  I've seen reference to
[modelSchedule ... message: M(getDistanceX:Y):20:30]; but I get errors
with that syntax.

2) How do I refer to the properties of an object?  I've tried
aCustomer.xPos, where aCustomer is a Swarm Object called Customer with
an internal variable called xPos, but get "request for member 'xPos' in
something not a structure or union".

Thanks for your help

Cheers,
James Keirstead

_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support


--
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




reply via email to

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