Jump to content

Auto Fill/Auto Rezzer Script


nycbard
 Share

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

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

Recommended Posts

Hi, first i would like to thank everyone who answers the thread in advance. Sometimes being new makes you ask dump questions, but wihtout asking i can't learn. Thanks =)

 

I am trying to format a script to auto rez an object from inventory. Then I need a loop to check if the item was purchased, if it was, the script would auto-rez the next item in inventory.

"llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<0,0,.5>,ZERO_VECTOR,ZERO_ROTATION,0);"

So i got this piece of code to auto rez the object from inventory but i don't know how to rez next.

 

This is going to be for a vendor that sells K9 Kennels. So when someoen buys the first kennel another is placed in its place. I have looked in WIki Script Library but couldn't find anything.


Thank you for your help.

Link to comment
Share on other sites

What you want is a holovendor.  You can put various products in them and the customer can use arrow buttons to see them,  Then they pay the vendor and receive the merchandise once they make a selection. 

If you search for holovendors in the marketplace you will find them in a wide variety  of price ranges depending on other features and if they network.  A network would allow you to have vendors in multiple locations on various sims and a server in a single location.  When you want to update or ad a product you do it at the server and it will update all the vendors.

Link to comment
Share on other sites

Unless I'm missing something, it should be fairly easy to do.  It sounds as if you are selling one-of-a-kind objects.  You rez one and it sits there until it is sold, then you rez the next one, and so on.  Schematically, your script

(1) Rezzes INVENTORY_OBJECT, 0 , remembering its name as it does.

(2) Starts a timer, firing a sensor to look for the object by name every few seconds. If a no_sensor event is triggered ....

(3) It checks to see if there's another object in inventory  ( that is, if(llGetInventoryNumber(INVENTORY_OBJECT)) ) . If so ...

(4) It rezzes the next object which, conveniently, is now INVENTORY_OBJECT, 0 because the previous object zero was already rezzed and has now been sold.

This continues until there are no more objects left, when the script raises a sign that says EMPTY and shuts off the timed sensor.

You don't have to do anything with money in the script at all.  Each rezzed object is unique.  You give it a price, set it to BUY OBJECT when clicked, and be sure that you have set it to sell the object itself (Original).  As soon as a customer buys the object, it disappears into her/his inventory and L$  for the sale is transferred to your account.  The vendor's sensor can't find the object any more, so it rezzes the next one.

 ETA:  Aha... Amethyst has another way of thinking about it.  If you are not thinking about selling one-of-a-kind objects, then a holovendor is exactly what you want.  It's hard to beat Hiro Pendragon's free holovendor script, which is also full-perm.   You can learn a lot by seeing how he designed it.  Teleport to http://maps.secondlife.com/secondlife/Varney/191/216/24 and see for yourself.

Link to comment
Share on other sites

Thank you Amythyst for your reply. I know i can purchase a system but I would like to learn how to do this myself. =) Even if i spend the whole weekend to figuer it out.

Thank you Rolig Loon for giving me a direction to go in. I am having issues with the llSensorRepeat loop itself. 

"(2) Starts a timer, firing a sensor to look for the object by name every few seconds. If a no_sensor event is triggered ...."

state_entry()
    {
        llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<0,0,.5>,ZERO_VECTOR,ZERO_ROTATION,0);
        llSensorRepeat("", "", PASSIVE, .5, PI/4, 3.0);
    }

This code would rez the initial Kennel and then start a sensor. I believe it would look fo a PASSIVE items since i don't believe other types fit.

Then the sensor fires:

 sensor(integer num_detected)

Then i would use a FOR loop...this is where i'm at now. i'm not sure how to use the counter and also am i senince the NAME or TYPE of object? i'll post more as i understand more.

 

THANK YOU for all your help.


Link to comment
Share on other sites

default {
     on_rez(integer i) {
          llSensor("", "", PASSIVE, .5, PI);
     }
     sensor(integer num) {
          integer i = 0;
          do {
               llSensorRepeat("", "", PASSIVE, .5, PI, 3.0);
          }while(++i < num);
     }
     no_sensor() {
          llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<0,0,.5>,ZERO_VECTOR,ZERO_ROTATION,0);
     }
}

 

Thats the code that i wrote so far. On rez the first Kennel is rezzed but it doesn't rez any subsequent kennels afterwards =(

I think i just don't understand the loop structure well enough to edit. but i'll continues to work on it. Any help is appreciated!

Link to comment
Share on other sites

Your sensor event is totally wrong. You just need an empty one because you are only interested in the no_sensor() event... and there is that bug which prevents no_sensor() from firing if there is not at least an empty sensor() event.

Any way, that is not the problem. The problem is that you write the script directly in the object and, in that case, on_rez() does not fire until re-rezzed. So, no sensor at all. Which is a good thing...

Instead of a sensor, I would rather use llGetObjectDetails() to check the position of the rezzed item.

 

key ItemKey;default{	on_rez(integer param) { llResetScript(); }	state_entry()	{		llSetTimerEvent(0.0); // Not needed until we have an item to watch	}	touch_end(integer num)	{		if (llDetectedKey(0) == llGetOwner()) // Owner touch to rez the first one		{			llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0, 0.0, 0.5>,					ZERO_VECTOR, ZERO_ROTATION, 42); // Never ask why 42. 		}	}	object_rez(key id)	{		ItemKey = id; // We just rezzed something...		llSetTimerEvent(5.0); // Start watching.	}	timer()	{		if (llList2Vector(llGetObjectDetails(ItemKey, [OBJECT_POS]), 0) == ZERO_VECTOR)		{			// Gone? Rez a new one!			llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0, 0.0, 0.5>,					ZERO_VECTOR, ZERO_ROTATION, 42); // Never ask why 42. 		}	}}

 Attention: In all cases, take the rezzer in inventory first or reset the script before to delete/take the item. There is no way to differentiate in between a sold item and a deleted/taken item.

  • Like 1
Link to comment
Share on other sites


nycbard wrote:

default {

     on_rez(integer i) {

          llSensor("", "", PASSIVE, .5, PI);

     }

     sensor(integer num) {

          integer i = 0;

          do {

               llSensorRepeat("", "", PASSIVE, .5, PI, 3.0);

          }while(++i < num);

     }

     no_sensor() {

          llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<0,0,.5>,ZERO_VECTOR,ZERO_ROTATION,0);

     }

}

 

Thats the code that i wrote so far. On rez the first Kennel is rezzed but it doesn't rez any subsequent kennels afterwards =(

I think i just don't understand the loop structure well enough to edit. but i'll continues to work on it. Any help is appreciated!

You were so close:smileytongue:

With a few simplifications the code becomes:

default{    on_rez(integer i)    {        llSensorRepeat(llGetInventoryName(INVENTORY_OBJECT,0), "", PASSIVE, 1.0, PI, 3.0);    }    no_sensor()    {        llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<0,0,.5>,ZERO_VECTOR,ZERO_ROTATION,0);    }    sensor(integer num) {} // needed for no_sensor to work}

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hey guys
:)
 

i found this old thread while browsing through. First: I´m not native english speaking, it´s a foreign language, so when i spell something wrong or use wrong translated words, please ask again if you don´t understand. 

My question belongs to the script below:

Kaluura Boa wrote:

 
key ItemKey;default{	on_rez(integer param) { llResetScript(); }	state_entry()	{		llSetTimerEvent(0.0); // Not needed until we have an item to watch	}	touch_end(integer num)	{		if (llDetectedKey(0) == llGetOwner()) // Owner touch to rez the first one		{			llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0, 0.0, 0.5>,					ZERO_VECTOR, ZERO_ROTATION, 42); // Never ask why 42. 		}	}	object_rez(key id)	{		ItemKey = id; // We just rezzed something...		llSetTimerEvent(5.0); // Start watching.	}	timer()	{		if (llList2Vector(llGetObjectDetails(ItemKey, [OBJECT_POS]), 0) == ZERO_VECTOR)		{			// Gone? Rez a new one!			llRezObject(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0, 0.0, 0.5>,					ZERO_VECTOR, ZERO_ROTATION, 42); // Never ask why 42. 		}	}}

 

Is there a chance to ask a second prim in a specificated range (about 50-100m) if there is an object rezzed, and if not, rez a new from inventory. So you only need ONE storage and can use several remote rezz-pads (Also talking about one-of-a-kind-objects in storage-inventory)

I hope, my question is understandable :)

With best regards,

Susan

Link to comment
Share on other sites

As written, llGetObjectDetails will already tell you whether the target object is anywhere in the sim, so you don't need extra stations to give you that information.  If you want to add extra stations simply for the touch capability, you could do that, but there's no savings in storage.  After all, an object in inventory isn't really stored in the same physical sense that it would be in RL.  It is just a UUID, a reference to the item's description in the SL asset servers.  If you want to add extra stations for your own convenience, that's fine, though.  All you need to do is tell all of the stations the UUID of a newly-rezzed object so they know what to watch for.

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...