Reputation: 13
I am trying to make an agentset do something, if an agent(of a different agentset) has a particular shape.
Here, if the shape of a particular
ghost (say Ghost 1) is circle,
then all rabbits are supposed to move forward 1. (<-This is the intended behavior)
where
agentset A
agentset B
I have tried along these lines:
ask rabbits
[
if (shape ghost 1 = "circle")
[
forward 1
]
]
For this code I get,
"Expected a closing paranthesis here."
with a highlighter on ghost. I'm aware that this code is wrong but I can't think of how else this should be written to get the desired result.
Upvotes: 1
Views: 45
Reputation: 17678
This will (I think - can't test) get the syntax correct:
ask rabbits
[
if ([shape] of ghost 1 = "circle")
[
forward 1
]
]
but you also have an ordering error and will have every rabbit check the shape of chost 1. I think what you really want is:
if ([shape] of ghost 1 = "circle")
[ ask rabbits
[ forward 1
]
]
Upvotes: 2