Question on controlling inventory objects from 'main' object
|
|
Dora Weatherwax
Registered User
Join date: 21 Dec 2007
Posts: 7
|
05-10-2009 13:01
Hi,
I'm very new to LSL and I'm having trouble with having an object control other objects in its inventory. I have a single 'main' object that receives information (integers) from a webpage via xmlrpc, and I want to use this information to move objects in the main object's inventory to specified (nearby) locations based on what number is passed in (say, a block of a grid).
I'm having trouble understanding moving and controlling inventory objects from a main object. How can I make a 'main' object control the positions of other objects in its inventory, other than rezzing a new object?
Thanks so much!
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-10-2009 19:08
not sure what you're trying to do here.... if it's in inventory it doesn't have a position.
if you're talking about saving an offset for when the storage prim DOES rez the object, that's a bit simpler, store both the inventory items and the offset in a list, and reference the inventory item to the list of stored offsets when you rez that item from inventory.
if you're talking about moving the inventory to another prims inventory, you can use name based sensor detection of the target prim and llGiveInventory to transfer it.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Dora Weatherwax
Registered User
Join date: 21 Dec 2007
Posts: 7
|
05-10-2009 19:45
Ooh, okay, I'm not sure what I'm talking about either... I thought that having a certain object in a prim's inventory gave the prim the ability to control an instance of that object in its inventory via scripting.
I guess what I want to ask is, how do I make one script, stored in one particular prim, control multiple outside objects?
|
|
Dora Weatherwax
Registered User
Join date: 21 Dec 2007
Posts: 7
|
05-10-2009 19:46
...and by "control" I mean "set the position of."
Thanks!!
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-10-2009 20:07
if the inworld prims are linked to the object determining the movements you can use llSetLinkPrimitiveParams or llSetPos in the prim to be moved in conjunction with link messages. if the inworld object to be moved is not linked to the base object, you'll need to send the other object a message, and have a seperate script to recieve and translate that message and move based on that. llSay, or llRegionSay to send the message, and llListen (and the listen event) to recieve the message, then llSetPos or llSetPrimitiveParams to apply it. details on how to use each function can be found here: https://wiki.secondlife.com/wiki/LSL_Portal
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
05-11-2009 05:53
From: Dora Weatherwax ... I thought that having a certain object in a prim's inventory gave the prim the ability to control an instance of that object in its inventory via scripting. You're mistaken. This only gives the object the ability to rez them or to give them (to avatars or other objects).
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
05-11-2009 05:57
and if i remember correctly, the only way it can give something to another object is if it's in the same sim
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
05-11-2009 08:16
That's one limitation. Another is that the object has to allow it. I wouldn't be surprised if there are more.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-11-2009 10:13
there are... you can only give so often within a certain time frame... I can't remember the limit but one of the wikis should note it.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Dora Weatherwax
Registered User
Join date: 21 Dec 2007
Posts: 7
|
05-17-2009 22:58
I'm still working on this, and so far I have the objects linked and I can send a message from the root to each child prim telling the child where I want it to go, but for some reason llSetPos does nothing! The objects are not physical, I'm sure that I'm casting to vector correctly, and I can get each child object to 'say' the vector as a string, but calling llSetPos just doesn't move the child object. I've also tried llSetPrimitiveParams with PRIM_POSITION in the child object. Is there another function I should be using for setting the position of a child object? Thanks!
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-18-2009 02:35
llSetPos has two limitations you need to be aware of 1) it'll only work if the move is to a position <= 10m away (see warpPos and jumpPos for workarounds) 2) linked objects won't move outside of link distance (which is a very complex calculation)
if it's under 10m then you're probably hitting a link distance barrier (which varies based on the size of ALL prims within the linkset), otherwise you're hitting the hard limit of 10m (undirected)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
05-18-2009 04:28
From: Dora Weatherwax I'm still working on this, and so far I have the objects linked and I can send a message from the root to each child prim telling the child where I want it to go, but for some reason llSetPos does nothing! The objects are not physical, I'm sure that I'm casting to vector correctly, and I can get each child object to 'say' the vector as a string, but calling llSetPos just doesn't move the child object. I've also tried llSetPrimitiveParams with PRIM_POSITION in the child object. Is there another function I should be using for setting the position of a child object? Thanks! Make sure the position vector you pass is relative to the root prim, and relative to the coordinate system using the root prim's axes as the basis. This is how llSetPos() works for child prims.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-18-2009 10:39
lol and why didn't I remember to mention that it uses region coordinates for root movement, and local coordinates for the for child movement I'll never know
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
05-18-2009 11:09
From: Dora Weatherwax I guess what I want to ask is, how do I make one script, stored in one particular prim, control multiple outside objects? You put a script in each object and have them talk to each other through llRegionSay().
|