Jump to content

Rezzing an object


ChaosRaine
 Share

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

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

Recommended Posts

Also I need some way for it to delete the items when another is selected. Right now I have it so I have a script in the item rezzing that just deletes it when its clicked. I'd rather it be part of the menu though.

Here's what I have if it helps.

integer MAX_REZZED_OBJECTS = 1;vector REZ_POSITION = <0.02, 0.02, 0.025>;vector REZ_ROTATION = <0.0, 0.0, 0.0>;integer i = 0;integer currentPos = 0;integer listener;integer MENU_CHANNEL ; // opens menu channel and displays dialogDialog(key id){    list MENU1 = [];    // count the textures in the prim to see if we need pages    integer c = llGetInventoryNumber(INVENTORY_OBJECT);    if (c <= 12)    {        for (i = 0; i < c; i++ ) {            MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);        }    }    else    {                   for (i = 10 * currentPos; i < (10 + (10 * currentPos)) ; i++) {                        // check to make sure name <= 24, or else the menu will not work.            string aname = llGetInventoryName(INVENTORY_OBJECT, i);            if ( llStringLength(aname) >24)             {                llOwnerSay("The texture  named " + aname + " has too long of a name to be used, please give it a shorter name <= 24 characters ");            }               else            {             if (i < c ) {                    MENU1 += aname;                }            }        }        MENU1 += ">>";               if (currentPos != 0)            MENU1 += "<<";         else            MENU1 += "-";      }            MENU_CHANNEL = (integer) (llFrand(10000) + 10000);    listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");        llDialog(id, "Select one object below: ", MENU1, MENU_CHANNEL);} default{    on_rez(integer num)    {        // reset scripts on rez        llResetScript();    }     touch_start(integer total_number)    {        // display the dialog         Dialog(llDetectedKey(0));    }     listen(integer channel, string name, key id, string message)     {        if (channel == MENU_CHANNEL)        {            llListenRemove(listener);              if (message == ">>")            {                currentPos ++;                Dialog(id);            }            else if (message == "<<")            {                currentPos--;                if (currentPos < 0)                    currentPos = 0;                Dialog(id);            }                    else                                {                // display the texture from menu selection      llRezObject (message, llGetPos() + REZ_POSITION, ZERO_VECTOR, llEuler2Rot (REZ_ROTATION * DEG_TO_RAD), 0);             }              }    }  }

 

Link to comment
Share on other sites

I can't see a good reason why your script shouldn't rez objects anywhere that you have permission to rez, assuming that you actually have rezzable objects in inventory.

As for making currently rezzed objects disappear when new ones appear, all you should need to do is have your script send a coded KILL message by llRegionSay before it rezzes the new object.  When your previous object gets the kill signal, it will llDie as if you had used you current touch-activated method.  To make that method work, I'd recommend grabbing an object's UUID with an object_rez event and then using that UUID to construct a temporary channel to send your KILL message:

integer Temp_Channel = (integer)("0xF" + llGetSubString(new_object_UUID, 0,6));

Add the same channel definition to the script in your rezzable objects and use it to construct the llListen that the script will need for hearing the KILL message. That way,. the KILL message will be tailored specifically for that object

 

Link to comment
Share on other sites

I got the rezz issue fixed. I"m not really sure what was going on. I think it was an issue with the sim. The problem I am having now is when it is empty. Sence my current set up is based of my menu, is it possable to add an invisable prim that deletes as soon as my basket rezzes it? As soon as the script is activated I want it to run the llDie and just delete itself.

Link to comment
Share on other sites

That seems like a roundabout solution.  Why do you need something to delete?  If you haven't rezzed anything yet, the UUID of your non-existant rezzed object is NULL_KEY.  So

if (rezzed_object_key == NULL_KEY){    // Don't send a KILL message}

 

 

 

 

Link to comment
Share on other sites

The problem is that the script I'm working with the only way I know of to make a new menu button is by adding a new inventory item. I just want to be able to click on the button and have nothing in the basket. Just the basket by itself as though I just rezzed it fresh from my inventory.

Link to comment
Share on other sites

Hard coding the contents would be far better than using that menu texture script. 

list buttons = ["-", "Red", "Green", "Yellow"];string dialogInfo = "\nPlease make a choice."; key ToucherID;integer dialogChannel;integer listenHandle; default{    state_entry()    {        dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );    }     touch_start(integer num_detected)    {        ToucherID = llDetectedKey(0);        llListenRemove(listenHandle);        listenHandle = llListen(dialogChannel, "", ToucherID, "");        llDialog(ToucherID, dialogInfo, buttons, dialogChannel);        llSetTimerEvent(60.0); // Here we set a time limit for responses    }     listen(integer channel, string name, key id, string message)    {        if (message == "-")        {            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);            return;        }         llListenRemove(listenHandle);        //  stop timer since the menu was clicked        llSetTimerEvent(0);         if (message == "Red")        {            // process Red here        }        else if (message == "Green")        {            // process Green here        }        else        {            // do any other action here        }    }     timer()    {    //  stop timer        llSetTimerEvent(0);         llListenRemove(listenHandle);        llWhisper(0, "Sorry. You snooze; you lose.");    }}

 Dialog_Menus

You can get the rezzed object UUID with this 

list    gObject_key     = [];object_rez(key id)	{		gObject_key = [];		gObject_key = llListInsertList(gObject_key, [id], 0);	}

 

Link to comment
Share on other sites

How about

integer c = llGetInventoryNumber(INVENTORY_OBJECT);if (c == 0){    MENU1 = ["Rez Basket"];}else if (c <= 12){    for (i = 0; i < c; i++ ) {         MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);    }}// And so on....

 Then in the listen event just add

else if (message == "Rez Basket"){    llRezAtRoot ("my_basket", llGetPos() + REZ_POSITION, ZERO_VECTOR, llEuler2Rot (REZ_ROTATION * DEG_TO_RAD), 0);} 

 

Link to comment
Share on other sites

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