Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trying to make something rez at sunset, die at sunrise

Muskie Marquette
Registered User
Join date: 15 Aug 2006
Posts: 6
01-15-2009 21:00
(FYI: I'm newish at trying to write my own scripts, and very very oldish, as in extremely rusty, at programming in general. When I last earned my living as a programmer, we used punched cards and batch processing).)

What I'm trying to do is to rez several objects at sunset (perm, not temp, rez), and delete them at sunrise. My problem is that my gawdafully rusty programming brain wants to do it with a timer checking llGetSunDirection() from time to time, and then rez if sun.z <0. That would of course lead to the object being rezzed over and over.

Is there a way for a script to check if the object is rezzed without doing evil things to the sim? Should I resign myself to the fact that this all works better as temp-on-rez and figure out some other way of handling those prims which must be perm prims (like, say, rez on touch with a watch the sun and die at sunrise script inside them)? Or are there much better approaches to this problem altogether?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
01-15-2009 21:14
There's a sample script at http://lslwiki.net/lslwiki/wakka.php?wakka=llGetSunDirection that you can modify to rez your object at sunset. Then all you have to do is put the same script, or one like it, into the rezzed object and tell it to llDie() at sunrise.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-15-2009 21:15
have an intermediate check variable. when you rez, only rez if the variable is true, then immediately set it to false, only reset it to true when night comes back around.

essentially
CODE

if ( nothingRezzed ){
if ( isNotDaylight ){
nothingRezzed = False;
//-- rez the thing
}
}else{
if ( !isNotDaylight ){
nothingRezzed = True;
//-- send message for rezzed object to die
}
}


or you could just switch states after rezzing or sending a kill message
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-15-2009 21:17
The best idea that comes to my mind is to capture the UUID's of the rezzed objects through the object_rez event. (Or even just one of the objects, since they'd be dying as a group based on the same event?)

Whenever the Rezzer checks for sun position, before rezzing it checks if the previously rezzed object still exists first, through llGetObjectDetails with any parameter.

Alternatively, you can have the rezzed objects send a message to the rezzer just before they die to say "Hey I'm gone, you can rez again."

EDIT: Beaten to the punch by probably better ideas. :D
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-16-2009 00:13
IOW you want to change levels into edge triggers. Well, for that you need some kind of memory, to remember what the level was LAST time you checked.... ;)
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
01-16-2009 19:09
OK, some help please. I read this and was intrigued. I have a script that check the suns's position to identify sun rise and sun set. The script checks once every 5 minutes. Adding the Rez_Object command works great but I need a way to Rez it once. Also, I not quite sure how to "send" the Die command to it.

Thanks, not s scripter but am trying to learn.
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
01-16-2009 20:48
thought I'd start with the Wiki expample which works as is. But now tried to pre-identify the object. This script does NOT work. the object i want the details on the called tester.
Wish my brain thought like a programer's

-----
string object = "tester";
default
{
touch_start(integer total_number)
{
list a = llGetObjectDetails(object, ([OBJECT_NAME,
OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY,
OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR]));
llWhisper(0,"UUID: " + (string)object +
"\nName: \"" + llList2String(a,0) + "\"" +
"\nDescription: \"" + llList2String(a,1) + "\"" +
"\nPosition: " + llList2String(a,2) +
"\nRotation: " + llList2String(a,3) +
"\nVelocity: " + llList2String(a,4) +
"\nOwner: " + llList2String(a,5) +
"\nGroup: " + llList2String(a,6) +
"\nCreator: " + llList2String(a,7));
}
}

--------
Cappy Frantisek
Open Source is the Devil!
Join date: 27 Oct 2006
Posts: 400
01-17-2009 02:58
From: Wyatt Weatherwax
Wish my brain thought like a programer's

No you don't! Stay sane! :)
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-17-2009 13:23
welcome to club masochism, tonights delight, programming.... in LSL!!!!!
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-17-2009 15:38
llGetObjectDetails calls for a UUID, you're trying to use a Name.

You need to catch the UUID in object_rez.
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
01-17-2009 15:58
so the object name can't be used as in other kinds of scripts? Since this is in my inventory, I click on Copy UUID but when I past that I get nothing but 0000000s.
Could some paste an example of using a known object's UUID?

Faust if you want to talk about this out of forum, I'm open to that too.

Thanks
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-17-2009 16:06
llGetObjectDetails only works on Rezzed Objects or Avatars in the Same Sim, that's why you can't call it by name.
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
01-17-2009 16:13
Ok, this is a rezzed object but maybe it can't be done this way. Object 1 monitors the SL Sun's position and rezzes an object (Object 2) from it's inventory. Unfortunately is will rez it over and over again every 5 minutes as it checks the sun's position. It would be nice if Object 1 could check to see if Object 2 exists InWorld and not rez another. The last step is to tell Object 2 to Die at Sun rise (haven't figured that part out yet either, no point if I can't get the first step to work).

Thanks
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-17-2009 16:27
Rezzing object2 triggers the "object_rez" event in object1, where you can save the ID parameter to a global variable.