View Single Post
Junior Member
Status: Offline
Posts: 6
Join Date: Oct 2011
Location: UK
Default 10-31-2011, 12:09 PM

Ah. There was a vaguely obvious thing.

If you have

for (MyRobot m:robots)
m.addMouseButtonListener ( whatever )

the variable m isn't valid in "whatever". It seems you have to use e.getModelAtMouseLocation instead. But e isn't available from the list of things you can get Procedures and Functions for, as far as I can see, so you have to drop in the procedure you want from some other object- which of course would logically be "m", and then you have to use the drop down list in the code window to change "m" to "e" and pick the right function.

Replied to self because nobody else seemed to be and it might be useful to someone at some point
Reply With Quote