Whenever I pass a command from one behavior to another with a variable, the
variable turns up all messed up! For example, when I write in a behavior on
sprite 3:
sendSprite(3, #checkRight, 15)
And then on another behavior on sprite 3 I write:
on checkRight whatNumber
put whatNumber
end
At 13:48 +0200 2001_06_22, Michael Nadel wrote:
Whenever I pass a command from one behavior to another with a variable, the
variable turns up all messed up! For example, when I write in a behavior on
sprite 3:
sendSprite(3, #checkRight, 15)
And then on another behavior on sprite 3 I write:
on
try putting me into the behaviour:
on checkRight me, whatNumber
put whatNumber
end
On Friday, June 22, 2001, at 12:48 PM, Michael Nadel wrote:
Whenever I pass a command from one behavior to another with a variable,
the
variable turns up all messed up! For example, when I write in a
When using behaviors you need to remember that the object reference always
gets passed as the first parameter. In other words:
on foo me
me.foo2(test)
end
on foo2
put param(1) -- you'll get something like you did below
put param(2) -- you'll get test
end
HTH,
-- Clint
At 01:48 PM 6/22/01
Others have already pointed out the need for the me variable. But
I'll add something else. If you have a behavior where to want to
send something to the same sprite number, instead of hard coding the
sprite number, use the built in spriteNum variable. For example,
instead of:
Correct me if I'm wrong - I mean this - CORRECT me if I'm wrong - but
in the case below wouldn't spriteNum hold a reference to the sprite
that the behaviour was attached to - and in effect, the behaviour would
be sending the message to itself?
Pete
On Friday, June 22, 2001, at 03:57 PM, Irv
OK, I'll have to I'll have to correct you. In the original posting,
the question was about having two behaviors attached to the same
sprite and how to send a message from one behavior to the other
behavior.
If you do what I suggest, by using spriteNum instead of hard-coding
the number, the
Spot on - now I understand
Cheers
On Friday, June 22, 2001, at 05:30 PM, Irv Kalb wrote:
OK, I'll have to I'll have to correct you. In the original posting,
the question was about having two behaviors attached to the same sprite
and how to send a message from one behavior to the other
sendSprite(3, #checkRight, 15)
And then on another behavior on sprite 3 I write:
on checkRight whatNumber
put whatNumber
end
This is what I get in the message window!
-- offspring findSound 4 125c4b8
Change your handler to:
on checkRight me whatNumber
Think about it--you're sending
Michael Nadel wrote:
Whenever I pass a command from one behavior to another with a variable, the
variable turns up all messed up! For example, when I write in a behavior on
sprite 3:
sendSprite(3, #checkRight, 15)
And then on another behavior on sprite 3 I write:
on checkRight
Irv Kalb wrote:
Others have already pointed out the need for the me variable. But
I'll add something else. If you have a behavior where to want to
send something to the same sprite number, instead of hard coding the
sprite number, use the built in spriteNum variable. For example,
At 3:25 PM -0400 6/22/01, Carl West wrote:
Irv Kalb wrote:
Others have already pointed out the need for the me variable. But
I'll add something else. If you have a behavior where to want to
send something to the same sprite number, instead of hard coding the
sprite number, use the
12 matches
Mail list logo