Jump to content

Scripting Help


XSpidey Defiant
 Share

You are about to reply to a thread that has been inactive for 4734 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 far

default
{
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

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

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

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


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
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

 


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
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


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

You are about to reply to a thread that has been inactive for 4734 days.

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
 Share

×
×
  • Create New...