Jump to content

SLS_Help_Post_1


childhoodbestfriend489
 Share

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

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

Recommended Posts

Imagine there is an object which has two objects in it's inventory named Pet and egg. The object will rez Pet and on rez Pet will get egg in 
it's inventory. I tried the bellow script but error occurred. Who wants to help me removing error editing and not changing 
the purpose?


default

{

    on_rez(integer start_param)

    {

        llListen(0,"","","");

        llSleep(5);

        llRezObject("Pet", llGetPos() + <0,0,1>, ZERO_VECTOR, ZERO_ROTATION, 0);

    }

    listen(integer channel, string name, key id, string message)

    {

        if(message == "die")

        {

            llDie();

        }

    }

    object_rez(key id) 

    { 

        llGiveInventory(id, llKey2Name(egg));

    } 

}
Edited by childhoodbestfriend489
Link to comment
Share on other sites

Well, "child" is not defined, so

llGiveInventory(child, llKey2Name(egg));

is not going to give "egg" to anything.  Beyond that,  the function llGiveInventory needs the name of "egg" (which you already know -- it's "Egg"), not its key (which you don't know and doesn't need to be converted to egg anyway) .

Link to comment
Share on other sites

5 hours ago, Rolig Loon said:

Well, "child" is not defined, so



llGiveInventory(child, llKey2Name(egg));

is not going to give "egg" to anything.  Beyond that,  the function llGiveInventory needs the name of "egg" (which you already know -- it's "Egg"), not its key (which you don't know and doesn't need to be converted to egg anyway) .

With object_rez(), you CAN know this 🙂

Link to comment
Share on other sites

1 hour ago, Fritigern Gothly said:

With object_rez(), you CAN know this 🙂

Yes, I know that.  However, the OP did not do that.  That's what I was pointing out.  ;)   Her post has been edited since it was posted originally.  As you quoted, the original version said

1 hour ago, Fritigern Gothly said:

llGiveInventory(child, llKey2Name(egg));

and the variable named child was not defined. The statement has since been corrected to 

7 hours ago, childhoodbestfriend489 said:

llGiveInventory(id, llKey2Name(egg));

although it still contains llKey2Name(egg), which is not correct.  It should be

llGiveInventory(id, "Egg"); 

  • Like 2
Link to comment
Share on other sites

May God bless you both. I am really very grateful to Rolig Loon and Fritigern Gothly. The code is now working as I expect. Thank you so very much Fritigern Gothly for your help. Thanks Rolig Loon,to help me to understand what Fritigern Gothly wanted to say. I probably wouldn't understand Fritigern Gothly properly without the explanation of Rolig Loon. It seems to be you both know this process of scripting. You both are expert scripter since you could answer this type of question. Thank you both so very much. :-)

Edited by childhoodbestfriend489
  • Like 1
Link to comment
Share on other sites

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