One object sending a method to another

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

One object sending a method to another

Slavin, Simon
I'm just about to implement something and hoped to find someone had already done it -- better than the way I dreamed up.  I have a bunch of objects in a scene and they need to communicate.  For instance, one object needs to ask another "where are you" and get a vector back; one object needs to tell another "move two metres down".

Apparently the best method to do this is to pick a communications channel, implement a listener for each object and work out a common language they can all speak.  Does anyone know a better way of doing it ?

Simon.
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: One object sending a method to another

Toni Alatalo-2
On Apr 5, 2011, at 12:07 PM, Simon Slavin wrote:
Apparently the best method to do this is to pick a communications channel, implement a listener for each object and work out a common language they can all speak.  Does anyone know a better way of doing it ?

AFAIK this is the only way in LSL.

With Opensim, however, you also have the option to do it with normal programming .. where can just have all the objects in one application and let them call each other however they want etc. In a region module.

For example this opensim region module creates a lot of objects in the code, and keeps references to the objects in the main app class, so can just call methods in them like in normal programming: self.tree = self.initTree("naali") etc. in http://code.google.com/p/rexprojectspace/source/browse/trunk/rexprojectspacemodule.py

Simon.

~Toni


_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: One object sending a method to another

Fish_Kungfu

Depending on exactly what you want to accomplish, you might want to look at some of the AI swarm/flock/school scripts.  Here is one:  http://slconceptual.wordpress.com/2007/05/17/lsl-swarm-script-for-second-life-make-birds-butterflies-etc/

On Apr 5, 2011 5:19 AM, "Toni Alatalo" <[hidden email]> wrote:
> On Apr 5, 2011, at 12:07 PM, Simon Slavin wrote:
>> Apparently the best method to do this is to pick a communications channel, implement a listener for each object and work out a common language they can all speak. Does anyone know a better way of doing it ?
>
> AFAIK this is the only way in LSL.
>
> With Opensim, however, you also have the option to do it with normal programming .. where can just have all the objects in one application and let them call each other however they want etc. In a region module.
>
> For example this opensim region module creates a lot of objects in the code, and keeps references to the objects in the main app class, so can just call methods in them like in normal programming: self.tree = self.initTree("naali") etc. in http://code.google.com/p/rexprojectspace/source/browse/trunk/rexprojectspacemodule.py
>
>> Simon.
>
> ~Toni
>

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: One object sending a method to another

Toni Alatalo-2
On Apr 5, 2011, at 12:24 PM, Fish Kungfu wrote:

Depending on exactly what you want to accomplish, you might want to look at some of the AI swarm/flock/school scripts.  Here is one:  http://slconceptual.wordpress.com/2007/05/17/lsl-swarm-script-for-second-life-make-birds-butterflies-etc/


That seems to use the chat messaging technique that the original poster asked about, things like llSay(school_comm_channel, (string)myvel);

Being able to share data for the whole swarm, pass arbitrary types as arguments (not just strings in chat messages) and get return values from function calls etc. make normal programming easily much more efficient and straightforward.

But LSL you can do without access to the server (which region modules require), and you can run the LSLs on every opensim (&sl) server without anything special. So I think mostly depends on the case, whether it is some app that can dev on own server, or something that want to distribute LSL style.

~Toni

On Apr 5, 2011 5:19 AM, "Toni Alatalo" <[hidden email]> wrote:
> On Apr 5, 2011, at 12:07 PM, Simon Slavin wrote:
>> Apparently the best method to do this is to pick a communications channel, implement a listener for each object and work out a common language they can all speak. Does anyone know a better way of doing it ?
>
> AFAIK this is the only way in LSL.
>
> With Opensim, however, you also have the option to do it with normal programming .. where can just have all the objects in one application and let them call each other however they want etc. In a region module.
>
> For example this opensim region module creates a lot of objects in the code, and keeps references to the objects in the main app class, so can just call methods in them like in normal programming: self.tree = self.initTree("naali") etc. in http://code.google.com/p/rexprojectspace/source/browse/trunk/rexprojectspacemodule.py
>
>> Simon.
>
> ~Toni
>
_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users


_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users