Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Object Communication?

Xhris Roussel
Registered User
Join date: 8 May 2008
Posts: 5
05-08-2008 17:31
Hey all, After playing around with Second Lifes easier areas, ive decided to have a go at some scripting/building.

I am trying to be able to drop an object(box) onto a flat object, and then have the box's name read out from the flat object.

My rough idea was to use llgetobjectname, and put this into a string and output the string onto the screen, but I cannot figure this out.

An example of what I mean:
You pickup the box called test1, drop it onto the flat object and it says "this is test1" and so on. Thanks in advance!
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
05-08-2008 19:08
llGetObjectName will return object's name where the script is in in this case the "Flat" object.

What you can do is have an inventory list and when and inventory changed is detected scan for all the objects if there's an object that is not on that list then that's the new object... kinda complex for a first script...but i don't see other way.


http://rpgstats.com/wiki/index.php?title=List

http://rpgstats.com/wiki/index.php?title=Inventory
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-08-2008 21:08
Hmm. I think there might be some confusion as to what you mean by "dropped onto". If you mean inserted into the flat object's inventory, the above post should help. If you mean literally drop a physical object in-world onto the surface of the flat object, then you'll want to check out the collision events. See http://www.lslwiki.net/lslwiki/wakka.php?wakka=collisions and note in particular the llDetectedName() function.

http://www.lslwiki.net/ is also a great place to read all about scripting. it has tutorials, documentation about the LSL language and the function library divided into useful sections, and all kinds of other helpful material.
Xhris Roussel
Registered User
Join date: 8 May 2008
Posts: 5
05-10-2008 20:41
I think you are definatly on the right track there Hewee.

Is there any chance I could get a hand with some of the code on that? I have a hard time putting it all together. Thanks again!
Xhris Roussel
Registered User
Join date: 8 May 2008
Posts: 5
05-11-2008 17:37
Ive spent a few good hours trying to get this to work with no luck :( Ive tried cutting and pasting the example code with no luck. It doesnt work when objects or myself walk over the object. Any help would be hugely appreciated.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-11-2008 23:19
Try this:

CODE

default
{
collision_start(integer nDetected)
{
integer i;
for (i = 0; i < nDetected; ++i)
{
llSay(0, "Touched by "+llDetectedName(i));
}
}
}
Xhris Roussel
Registered User
Join date: 8 May 2008
Posts: 5
05-13-2008 17:13
Stupid newbie mistake that I realised, my script wasnt set to "running" haha whoops. Cheers for the help!