Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Max Number to rez & is target below ground?

Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-24-2009 17:04
so i'm working on an object that rezzes an object a certain number of times. the rezzed objects will be temp or will die on a timer. i want to figure out how to keep track of how many of that item is still "alive" if it's less than the limit it needs to rez however many more.


also, the rezzed object will be moving in random directions within a certain distance from the rezzer, i want to make sure the targeted position won't be below the ground though. i looked at llGround, but i'm not sure i understand it, would it just be something like below?

vector tpos;
float height = llGround(llGetPos() - tpos);
if(height > tpos.z)//tpos is below the ground
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-24-2009 17:15
You could have the rezzed objects announce their births and deaths and have the rezzer listen for them. You could keep a list of rez times for the objects and work to that. Umm... that's all I've thought of so far.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-24-2009 17:29
If you call llGround (<0,0,0>;) , you get the ground height at *your* position, not at location 0,0 on the sim.

From: someone
float height = llGround(llGetPos() - tpos);

I think that might be backwards; should be tpos - llGetPos().

For example, if, ignoring .z, you're at <10, 10> and tpos is <50, 50>, you'd want to feed llGround a <40, 40>. Subtracting tpos from the current position gets you <-40, -40>.

edit:
For keeping track of stuff, that can be a little tricky if they're not temp. Some of my rezzer stuff goes off wandering and sometimes strays into no-script land. If you just relied on asking them their positions, you might get some that can no longer talk and you'd end up with too many.

Another possibility is to use the object_rez event and keep track of the keys of objects that are rezzed then use something like llGetObjectDetails to poll their positions. That probably doesn't work across sim lines and might actually return false positives after the objects die, though.. Not sure about that - you'd have to mess around with it.

Unless you're trying to keep things alive for more than a minute, use temp anyway. Even if you expect to call llDie earlier.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-24-2009 17:30
i thought about keeping a list of the keys, and on a timer event it would run a for loop checking llKey2Name against "" to see if the object still exists, if it doesn't it would rez a new one. the object_rez event is the only way i know of to automatically get the newly rezzed object's key, and i'm not sure if that would interrupt the for loop, or the event could even get skipped on the next iteration in the loop
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-24-2009 17:35
From: Ruthven Willenov
i thought about keeping a list of the keys, and on a timer event it would run a for loop checking llKey2Name against "" to see if the object still exists, if it doesn't it would rez a new one. the object_rez event is the only way i know of to automatically get the newly rezzed object's key, and i'm not sure if that would interrupt the for loop, or the event could even get skipped on the next iteration in the loop

Er.. For loop??

You can only be in one event at a time.. If you're using an infinite for loop (or any kind of loop) with sleeps to rez stuff, nothing else in that script will run. Ever.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-24-2009 18:01
it wouldn't be infinite lol. i guess what i could do is on the timer event, run the loop deleting any uuids from the list that don't exist anymore, then after the loop if the list length is less than the max number it will rez one object triggering the object_rez event, storing the new key, and checking the length again to see if it needs to rez another object triggering the object rez event again

ETA: i guess i would have to start that loop from the end of the list otherwise it wouldn't work correctly if i start deleting uuids from the beginning or middle of the list cause it would throw off the rest of the list indexes for the loop
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-24-2009 18:09
Or build up a new list as you go through them. Have a global list of the keys you know about and a local variable for a new list. In the timer, loop through the global list and any key that's still around, add to the new list. Once you're out of the loop, set the global list to the local one..
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left