Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trying to build a demo rezzer ...

Isobel DeSantis
Rechargeable ...
Join date: 1 Jan 2007
Posts: 104
02-07-2008 13:50
I sell shoes and I want to keep one colour of each style rezzed in my store but allow customers to rez any of the other colours they'd like to see (in place of the one already there). These aren't vendors, just displays.

I found a script in here to which I added a tiny piece of code just to make the shoe rez 1m above the rezzing object. However, the new shoe rezzes in exactly the same place as the old one, without deleting it. I found llDie but that seems to work on the rezzing object, not the rezzed one. How do I tell the rezzer to delete the existing object before rezzing a new one please?

Deleting the previous object is my main concern at the moment, but I'd also like to refine the script in a few ways, if it's not too difficult (for me! lol):
a) I would like only one person at a time to be able to use any particular rezzer (there could be maybe 12 of them in the store) and for it to be locked to anyone else until the first person hasn't touched it for say 1 minute;
b) As there will be so many rezzers, I realise they will all have to be on different channels but I probably don't want them all listening all the time, do I? I see there's a thread today about using a timer event for this but I don't know how to incorporate that into the script I'm using;
c) The last thing, and this is really me being a perfectionist :) I'd like to set a "default" colour for each rezzer and for the rezzer to replace the object rezzed by a customer with that default after a certain period of inactivity, say 5 mins.

This is the script as it stands at the moment:
From: someone
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
{

vector vec = llGetPos() + < 0.0, 0.0, 1.0>; // 1 meter above this
llRezAtRoot(message, vec, ZERO_VECTOR, llGetRot(), 0);
}
}
}
}


If anyone has the patience to explain this to me, I'd appreciate it :)

Thanks!
Isobel
_____________________
http://slurl.com/secondlife/West%20Sunset/208/126/22

http://www.angelsblog.net/

A great many people think they are thinking when they are merely rearranging their prejudices. ~ William James
Woolich Ulich
Registered User
Join date: 16 Jun 2007
Posts: 17
02-07-2008 17:39
To delete te rezzed script you have to put a script with llDie inside the rezzed object, not inside rezzer...
1 - A script inside the rezzed object with llListen... When it receives a message from the rezzer it will execute llDie and delete itself.
2 - A script inside the rezzed object with a timer... It will execute llDie and delete itself after some time.

OR

3 - Rezz the object as TEMP_ON_REZ. It will delete itself after ???? seconds, minutes...

-------------

a) When the rezzer is inactive... save the KEY or NAME of the avatar who touches the rezzer the first time it touches it... Put a timer event and reset it every time the same avatar touches the rezzer... If the timer event fires... (the avatar has not touched the rezzer) you can place it in inactive mode again... mmmm... an example...

..... define some global variables...

key avatartouch = NULL_KEY;
int rezzermode = FALSE; // If FALSE=rezzer inactive, if TRUE=avatar using it.

..... in the touch event

if (rezzermode == FALSE) // here the rezzer is inactive.
{
avatartouch = llDetectedKey(0); // save the key of avatar using rezzer.
rezzermode = TRUE;
llSetTimerEvent(60.0) ; // for example , timer event 60 seconds.
}
else
{ // here the rezzer it is being used by some avatar.
if (llDetectedKey(0) == avatartouch) // touched by the same avatar using it???
{ // yes
llSetTimerEvent(60.0); // restart the timer event.

// add here more your code for more actions...
}
}

..... and timer event

timer() // if it fires... the avatar has not touched the rezzer last 60 seconds.
{
llSetTimerEvent(0.0); // stop the timer event
avatartouch == NULL_KEY;
rezzermode == FALSE;
}


b) use a timer event in a similar way as in previous example... realize you can use only one timer in the same state and script...

In the touch event, open a listening channel... start a timer event... and then in the timer event remove the listening channel with llListenRemove.

c) another timer event :-)

Sorry for my english :)

Woolich