Jump to content
You are about to reply to a thread that has been inactive for 1058 days.

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

Recommended Posts

i have this script it is working but i notice it gives a error when no object is found,

 and im bad at scripting so i have no clue how to inpliment this line___   if name = "box" say, nothing is here

 

 

default
{
    touch_start(integer total_number)
    {
        string rezName=llGetLinkName(llDetectedLinkNumber(0));
        llGiveInventory(llDetectedKey(0), rezName);

    }

}

 

Link to post
Share on other sites

At a glance you're using the names of links in a linkset, as the contents of the prim you are giving?.

 

default
{
    touch_start(integer total_number)
    {
        string rezName=llGetLinkName(llDetectedLinkNumber(0));
        if(rezName == "box")
        {
            llSay(0, "Nothing is here");
        }
        else
        {
            llGiveInventory(llDetectedKey(0), rezName);
        }
    }
}

 

would check the string stored in rezName and "box"  for equality.

Link to post
Share on other sites

So you have a scripted object, "Giver", that should give an "Item" when someone touches it.

Function llGiveInventory() looks for the Item in the Giver's inventory. The Item needs:

  • to be in the Giver's inventory
  • to have these access rights: Copy, Transfer

llGiveInventory() uses two arguments:

  1. ID of the target who will receive the Item
  2. Name of the Item
// Which item do we want to give?
string Item = "MyGiftToYou";

default
{
	touch_start(integer touchers)
	{
		// Let's check that the item actually is in the inventory:
		if(~llGetInventoryType(Item))
		{
			// If it is, then give it to the person who touched.
			llGiveInventory(llDetectedKey(0), Item);
		}
	}
}

 

  • Like 1
Link to post
Share on other sites
  • 2 weeks later...
// god i hate these boards...
//  @LaurisFashion's code should work fine?...


touch_start(integer touchers)
{       string rezName = llGetLinkName(llDetectedLinkNumber(0));
        if(rezName == "box")
        {  llSay(0, "Nothing is here");
        }
        else
        {
          if(~llGetInventoryType(rezName))
          {  llGiveInventory(llDetectedKey(0), rezName);
          }
        }
}
Edited by Xiija
  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 1058 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...