Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu Rezzer Script

Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
02-18-2008 15:57
Found a great menu rezzer script, but would like it to kill the object rezzed with the next object rezzed.
I have a kill script and an object script that gets a "die" message from it- but putting them together is beyond me.
(would be happy to pay for help, im me)

This is the menu rezzer script:
----------------------------------

[PNP]
list MENU1 = [];
list MENU2 = [];
integer listener;
integer MENU_CHANNEL = 1000;


Dialog(key id, list menu)
{
llListenRemove(listener);
listener = llListen(MENU_CHANNEL, "", NULL_KEY, "";);
llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);
}

default
{
on_rez(integer num)
{
llResetScript();
}

touch_start(integer total_number)
{
integer i = 0;
MENU1 = [];
MENU2 = [];
integer c = llGetInventoryNumber(INVENTORY_OBJECT);
if (c <= 12)
{
for (; i < c; ++i)
MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);
}
else
{
for (; i < 11; ++i)
MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);
if(c > 22)
c = 22;
for (; i < c; ++i)
MENU2 += llGetInventoryName(INVENTORY_OBJECT, i);
MENU1 += ">>";
MENU2 += "<<";
}
Dialog(llDetectedKey(0), MENU1);
}

listen(integer channel, string name, key id, string message)
{
if (channel == MENU_CHANNEL)
{
llListenRemove(listener);
if (message == ">>";)
{
Dialog(id, MENU2);
}
else if (message == "<<";)
{
Dialog(id, MENU1);
}
else
{
// todo add offsets so box sites perfect on rezzer
llRezAtRoot(message, llGetPos(), ZERO_VECTOR, llGetRot(), 0);
}
}
}
}
[PNP]


This is the send to die part of another script:
---------------------------------------------------

[PNP]

//Messages that should do something i can care less who they are from
link_message(integer sender, integer number, string message, key id)
{
if(message == "DIE";)
{
llDie();
}
}


}[PNP]

This is the receiver script:
--------------------------------

[PNP]
default
{
state_entry()
{
//Litterally this has to just kill the rezzed item
llMessageLinked(LINK_SET,0,"DIE",NULL_KEY);
}
}
[PNP]
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
02-23-2008 22:15
The two short scripts at the bottom of our post are identical, yet you seem to be describing them as a "kill script" and a "send to die" script

In fact both scripts are the same llMessageLinked scripts which is used to SEND a message "DIE" from a root prim to link_message scripts in the child prims.

llMessageLinked sends the message to linked prims
link_message recieves the message from a root prim

llMessageLinked and link_message scripts will not work between a rezzer and a seperate rezzed object as they are not linked.

In order for the menu to communicate with an unlinked rezzed object you need to modify the menu script to "llSay()" a command that the rezzed objects can hear using "llListen()".
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
02-24-2008 04:17
ArchTx,
Thanks- put the send script where it belongs
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
02-24-2008 09:33
From: Dragger Lok
ArchTx,
Thanks- put the send script where it belongs


Ok, but you are still using a link_message event to trigger llDie(). So it won't work unless you want the rezzer to delete it self when it is used.

Add this line directly before the llRezAtRoot line in the rezzer code, it will say the "die" command just before it rezzes a new object, thereby deleting the old object.

llSay(1000, "die";);

Add the script below to each object being rezzed so it will "listen" for the "die" command.

CODE

// This script listens to messages on channel 1000, deleting itself if it hears "die".
default
{
state_entry()
{
llListen(1000,"","","");
}

listen(integer chan, string name, key id, string msg)
{
if(msg=="die")
{
llDie();
}
}
}


Also I suggest you change the lRezAtRoot call to a llRezObject call so the new object does not rezz centered inside of the rezzer prim.


In regard to posting scripts, where you typed in [PNP] before and after each script, it should be
CODE
 before the script and 
after each script so that it formats properly.
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo