Any better way to draw/sheath a spyglass?
|
|
Kirilisa Tigerpaw
Registered User
Join date: 6 Nov 2007
Posts: 15
|
07-17-2009 01:48
Can someone tell me if there is a better way to do this? My code works, so I won't post it unless someone wants, but I'll just say what I'm doing.
I have made a backpack that has a folded up spyglass attached to it. When the avatar is wearing the backpack, when they click on the folded up spyglass part of it, it does several things: 1) rezes invisible open spyglass from folded spyglass inventory 2) gets permissions and calls llAttachToAvatar() to attach it to their hand; makes it visible and plays anim 3) makes the spyglass-related prims on the backpack invisible
This all works as described. To get rid of the spyglass, they can either click on the invisible folded spyglass on the backpack, which detaches the held spyglass and makes the folded one appear again, or detach it manually which results in the same thing.
I know it is not possible to use llDie() to get rid of something that is attached. And there is also nothing like llDrop() as far as I've seen in the forum.
So my questions are as follows:
1) Is there any other way to make the held telescope not appear in their inventory every time they detach it? Else every time they use the backpack they will end up with a copy of the telescope clogging up their inventory...
2) Also, is there any way to make it not have to ask for permissions for the held telescope every time? Is there a way to make the permissions for the backpack apply to the spawned telescope, since they are already wearing the backpack?
How do weapon makers do this, bringing something from sheathed to drawn without making a zillion copies and having to ask for permissions?
Thanks!
|
|
Tali Rosca
Plywood Whisperer
Join date: 6 Feb 2007
Posts: 767
|
07-17-2009 02:25
Most weapons simply have you wear both items (sheathed and drawn version) all the time, and then switch back and forth between which is visible.
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-17-2009 03:14
In answer to the specific questions, yes, it is possible to stop the telescope asking permissions each time you rez it, by using the method outlined at /54/b4/210611/1.html#post1802563However, no, it's not possible to stop it ending up in your inventory when you detach it. For what it's worth, I don't think it's a particularly good solution for your particular example; quite apart from ending up with a cluttered inventory, you will only be able to draw your spyglass on land where you can rez stuff. Tali Rosca's suggestion, which is that used by every weapon manufacturer I've come across, is far more practicable, to my mind. Or, if you don't want to tie up a hand attachment point, you could wear from inventory. as and when you want it, the spyglass you put up to your eye and have it tell the backpack one to hide and show itself as and when you attach it. Or, it occurs to me, you could use the Restrained Life Viewer or an alternative viewer that has it built in -- The Cool Viewer and Emerald both have it, as do others -- and make use of its capacity to have you wear items from your inventory with an llOwnerSay. So, for example, you might do it this way -- create a folder in your inventory called #RLV (you have to have this) and then a sub-folder inside it called "spyglass". Call your spyglass, "my_spyglass (right hand)" without the quotes. The thing's name isn't important but the (right hand) bit is. Put it inside your spyglass subfolder, and then put a script in your backpack that says llOwnerSay("@attach  pyglass=force"  ; when you touch it. Combine that with having the spyglass tell the one hanging from your backpack to toggle its visibility, and you're all set.
|
|
Tali Rosca
Plywood Whisperer
Join date: 6 Feb 2007
Posts: 767
|
07-17-2009 03:25
Having the hand version command the backpack version on attach and detach sounds like a good idea. Remember that the "attach" event fires when detaching, too, and should give you enough time to speak out a command to the backpack to go visible.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-17-2009 07:45
From: Tali Rosca Having the hand version command the backpack version on attach and detach sounds like a good idea. Remember that the "attach" event fires when detaching, too, and should give you enough time to speak out a command to the backpack to go visible. should... but' it's inconsistent... often it doesn't fire before it goes to inventory, and if worn from inventory might fire then...PITA the double wear version works out better for not cluttering inventory, but prevents an object being in that hand.... (it also avoid no rez areas, which will prevent you from rezzing your copy to be worn) if their are multiple items that can go from backpack to hand, you can still use the double wear method, and build all of your possible attachments into a single piece to wear on the hand, then have them become selectively visible
_____________________
| | . "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... | - 
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
07-17-2009 10:20
From: Void Singer should... but' it's inconsistent... often it doesn't fire before it goes to inventory, and if worn from inventory might fire then...PITA What happens if you detach the spyglass by touching it (or a chat command) so it turns itself invisible, tells the one on the backpack to turn visible, and only then detaches itself? Or is that unreliable, too?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-17-2009 10:58
From: Innula Zenovka What happens if you detach the spyglass by touching it (or a chat command) so it turns itself invisible, tells the one on the backpack to turn visible, and only then detaches itself? Or is that unreliable, too? that should work fine, it's just reliance on the detach event firing before it derezzes that's buggy... so it may not get caught it the av uses detach from the inventory or pie menu commands.... there's also a current bug with attaching from an inworld object where it show up in the inventory window between your normal inventory and the library... clicking on it there will crash the viewer (it's not a 100% reproducible bug, but i've hit it twice when attaching from inventory, dropping to the ground, reattaching from inworld, and then detaching to inventory... ymmv)
_____________________
| | . "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... | - 
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
Enhancement...
07-18-2009 09:10
something like this would be a good enhancement to LSL. Something like
llChangeAttachment(....)
that lets you move an object from on attachment point to another, change its rotation, etc etc. Of course, in this case, it would have to be unlinked from an item, and attached. The general case might be unlink/unattach and then link/attach with new animation and rotation...
_____________________
So many monkeys, so little Shakespeare.
|
|
Bizcut Vanbrugh
Registered User
Join date: 23 Jul 2006
Posts: 99
|
07-22-2009 21:00
another method would be to haver the one attachment animate itself and move/expand at the proper postion then when done it will collaspe/move back to the backpack. this is a bit intensive but would solve the problem of cluttering inventory.
on a side note i have seen some weapons systems that have multiple weapons in one attachment and depening on the draw command it makes certin weapons visable. it is a realy nice system for using multiple weapons without changing attachments
now that i have writen that you could simple add the trasparent expaned spyglass to the back pack in a postion already and just animate the avatart changeing the transparancy of the 3 items then you would not be attaching or moving anything but rather just making one visable and the other not if this is only for yourself then its no problem but if its part of something that others are using then there may be a issue with placement unless you include some kind of customization on where the class is placed
|