Jump to content

need some help with a script


crazydudemartijn
 Share

You are about to reply to a thread that has been inactive for 2173 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 comment
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 comment
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 comment
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 comment
Share on other sites

You are about to reply to a thread that has been inactive for 2173 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...