XSpidey Defiant Posted May 10, 2011 Share Posted May 10, 2011 Ok, so im makeing a script for a group gift thats attached to an avatar such as a sword or gun, I have been playing around with different styles but nothing has worked so far.What i want is for the object to detect group(mine) and if it doesnt detect it to delete its inventory or disable itself so the user HAS to have the group active or else. Here is what i have so fardefault{state_entry(){}on_rez(integer total_number){llList2String(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]),0);}{if llList2String(llGetObjectDetails(llGetKey(1d2b8ad2-34a5-6797-6d70-7d127c80c33f), [OBJECT_GROUP]),0) == FALSE){llRemoveInventory(llGetScriptName("New-Script")) }}} Link to comment Share on other sites More sharing options...
Kamimatsu Posted May 10, 2011 Share Posted May 10, 2011 What you should do is, rather than remove the inventory, switch to a dormant state and keep it that way until it rezzes again. A few corrections. First, the {} only appear INSIDE OF statments, states, and events. The if statement would actually go as follows. //a simplified exampleif (conditionToBeTested){ doSomething}else if (conditionToTestIfFirstIsFalse) //optional{ doSomethingElse}else{ somethingElseCompletely} Also, state_entry() does not have to be there if it has no contents and there are other events in that state. Hope this helps. Happy scripting. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 10, 2011 Share Posted May 10, 2011 You're taking a more complicated route than you need to. Try default{ touch_start(integer num) { if(llSameGroup(llDetectedKey(0)) // That is, if the detected person is in the same group as this vendor object... { // Do whatever is allowed for group members only, like, for example ... llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0)); } }} Take a look at some of the very nice tutorials at http://wiki.secondlife.com/wiki/LSL_Tutorial to get a better feel for LSL syntax, and don't hesitate to come back here if you have other scripting questions. You might also consider taking an in-world scripting course at someplace like Builder's Buddy or NCI. Link to comment Share on other sites More sharing options...
Rhonda Huntress Posted May 10, 2011 Share Posted May 10, 2011 If it were my, I would just detach the object with llDetatchFromAvatar() http://wiki.secondlife.com/wiki/LlDetachFromAvatar You could also prompt them to set the correct active group just before detatching the object. However, as far as finding if the agent has the correct group active ... you could try resing a prim (full transparent, phantom, temp) and then testing that prim's group key versus your group's key. So the flow would be: Set listen channel On chat timeout, assume we should detatch. Res temp objet - temp object get's it's group key - temp object whispers it's group key in channel Cancel detatch if group key matches your group. Link to comment Share on other sites More sharing options...
Rhonda Huntress Posted May 10, 2011 Share Posted May 10, 2011 Rolig Loon wrote: You're taking a more complicated route than you need to. Try default{ touch_start(integer num) { if(llSameGroup(llDetectedKey(0)) // That is, if the detected person is in the same group as this vendor object... { // Do whatever is allowed for group members only, like, for example ... llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0)); } }} Take a look at some of the very nice tutorials at http://wiki.secondlife.com/wiki/LSL_Tutorial to get a better feel for LSL syntax, and don't hesitate to come back here if you have other scripting questions. You might also consider taking an in-world scripting course at someplace like Builder's Buddy or NCI. Wouldn't llSameGroup always be true for attached items? I think he is wanting to know if it is set to his specific group. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 10, 2011 Share Posted May 10, 2011 Rhonda Huntress wrote: Rolig Loon wrote: You're taking a more complicated route than you need to. Try default{ touch_start(integer num) { if(llSameGroup(llDetectedKey(0)) // That is, if the detected person is in the same group as this vendor object... { // Do whatever is allowed for group members only, like, for example ... llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0)); } }} Take a look at some of the very nice tutorials at http://wiki.secondlife.com/wiki/LSL_Tutorial to get a better feel for LSL syntax, and don't hesitate to come back here if you have other scripting questions. You might also consider taking an in-world scripting course at someplace like Builder's Buddy or NCI. Wouldn't llSameGroup always be true for attached items? I think he is wanting to know if it is set to his specific group. Ooop. I somehow missed the point about being an attachment. Dumb, dumb,dumb. Link to comment Share on other sites More sharing options...
Void Singer Posted May 10, 2011 Share Posted May 10, 2011 needs the group's key hard coded into it, and compare to llGetObjectDetails run on the object (objects assume the owner group when worn, but not if they change it after worn) Link to comment Share on other sites More sharing options...
XSpidey Defiant Posted May 10, 2011 Author Share Posted May 10, 2011 how so? Link to comment Share on other sites More sharing options...
Void Singer Posted May 11, 2011 Share Posted May 11, 2011 attach( key vKeyOwn ){ if ((string)llGetObjectDetails( llGetKey(), [OBJECT_GROUP] ) != "group key goes here"){ //-- disable it, warn the user, set a variable, w/e } } Link to comment Share on other sites More sharing options...
Acheron Gloom Posted May 11, 2011 Share Posted May 11, 2011 I think if, for some reason, you also want to limit their tag while they're using it you can also start doing llSameGroup with the owner. Pretty sure you can change object's groups once attached, though, so you'd have to check that once more. Link to comment Share on other sites More sharing options...
Rhonda Huntress Posted May 11, 2011 Share Posted May 11, 2011 Acheron Gloom wrote: Pretty sure you can change object's groups once attached, though, so you'd have to check that once more. I just checked in world. You can try to change the objects group setting but it immediatly reverts back to its original group. Changing your active group does not change an attachments group. Also, trying to change an attachment group does nothing after changing the avatars active group. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now