childhoodbestfriend489 Posted February 10, 2021 Share Posted February 10, 2021 (edited) 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 February 10, 2021 by childhoodbestfriend489 Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 10, 2021 Share Posted February 10, 2021 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 More sharing options...
Fritigern Gothly Posted February 10, 2021 Share Posted February 10, 2021 I just happened to have learned about the object_rez() event last night, and it would seem that the example script on this page is going to be just what you need!http://wiki.secondlife.com/wiki/Object_rez Link to comment Share on other sites More sharing options...
Fritigern Gothly Posted February 10, 2021 Share Posted February 10, 2021 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 More sharing options...
Rolig Loon Posted February 11, 2021 Share Posted February 11, 2021 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"); 2 Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted February 11, 2021 Author Share Posted February 11, 2021 (edited) 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 February 11, 2021 by childhoodbestfriend489 1 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