Temporary object that desapears in minutes. How?
|
|
Rodolfo Parker
Registered User
Join date: 7 Oct 2006
Posts: 11
|
03-27-2007 08:20
Hi pplz!
I want to put a sign that when an avatar click, it appears near that sign a temporary car, that he can drives and after a few minutes he desapears, with a text on chat saying something like "Thanks for testing..." or something like that. I tryied a few scripts but I didn't make it. Somobody have a solution for this?
Thanks!
|
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
03-27-2007 08:25
Try llSetTimerEvent() and llDie() From: someone llDie();
Deletes the object that contains the script. That means if the prim containing this script is part of a linkset, all the prims will be deleted, regardless of whether or not the prim is the root or a child in the linkset. To delete just one prim from a linkset, first detach it with llBreakLink. From: someone llSetTimerEvent(float sec)
Sets the timer event to be triggered every sec seconds. Passing 0.0 (or just 0) stops further timer events.
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
03-27-2007 08:28
Why not just use a 'temp-on-rez' object?
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
|
Rodolfo Parker
Registered User
Join date: 7 Oct 2006
Posts: 11
|
03-27-2007 08:51
Ok, guys. But I didn't understand something... I put a script at the object that is the "sign", and what will be for appear the vehicle near it? And then a script at the car for it desapears after X minutes? What kind of scripts is for bove?
Thanks!
|
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
03-27-2007 09:05
From: Kenn Nilsson Why not just use a 'temp-on-rez' object? From what I've read, you get no guarantee of when a temp object will be cleaned up by the sim. The best you can hope for is a rough estimate. Presumably you also wouldn't get to give a message about "thanks for trying" if the object and scripts have already been deleted, although I haven't tested this. @Rodolfo: You would use the timer and llDie() in the car itself. Using it in the sign would make your sign dissapear, and llDie does not return objects to your inventory (not even in trash). Possibly, you may wish to start the timer after a change event where the change is CHANGED_LINK. Use llAvatarOnSitTarget and you can give them 2 minutes or whatever after they actually sit on the car rather than 2 minutes after it is rezzed.
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
03-27-2007 09:29
From: Sys Slade From what I've read, you get no guarantee of when a temp object will be cleaned up by the sim. The best you can hope for is a rough estimate. But using temp-on-rez won't (in theory) go against the parcel prim count. I'd have the sign create the object with temp-on-rez and have a script in the object that calls llDie from a timer - that way, either the sim will clean the object up or the script itself will.
|
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
03-27-2007 09:31
There are limits to temp objects as well now. Can't remember the exact number, but it's listed somewhere on the forums.
|
|
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
|
03-27-2007 09:46
sign script default { state_entry() { llSetText(llGetObjectName(),<1.0, 1.0 ,1.0>, 1.0); } touch_start(integer total_number) { llRezAtRoot("car", llGetPos()+<1.0, 1.0, 0.0>, ZERO_VECTOR, ZERO_ROTATION, 1); } }
car script
key sitting_avatar;
myDemo() { llInstantMessage(sitting_avatar, "Thank you for testing this car."); llDie(); }
default { state_entry() { llSetText(llGetObjectName(),<1.0, 1.0 ,1.0>, 1.0); llSitTarget(<0.0, 0.0, 0.25>, ZERO_ROTATION); } changed(integer change) { if (change & CHANGED_LINK) { if (llAvatarOnSitTarget() != NULL_KEY) { sitting_avatar = llAvatarOnSitTarget(); llSetTimerEvent(300.0); // 5 minutes llInstantMessage(sitting_avatar, "You have 5 minutes to test this car before it disappears."); } else if (llAvatarOnSitTarget() == NULL_KEY) { myDemo(); } } } timer() { myDemo(); } }
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr
SL books http://astore.amazon.com/secondlife-sl-20/
Need a beta tester for quality assurance ? Need a translator for English, French, Spanish ?
|
|
Rodolfo Parker
Registered User
Join date: 7 Oct 2006
Posts: 11
|
03-27-2007 09:53
Thank a lot, Simil!
|
|
Tyann Toll
It went... where?!
Join date: 17 Dec 2006
Posts: 37
|
03-28-2007 05:49
Hmmm... what happens if the user TPs the car to an area where scripts dont work, then deletes the removal script?
*ponders*
Perhaps the temporary test script should be included in the vehicle script so that taking it out makes the vehicle useless?
Perhaps a better solution might be to make the vehicle llDie() if it is taken out of the sim?
Just being the devil's advocate here...
Edit: temporary objects last between 60 and 70 seconds
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-28-2007 05:57
From: Tyann Toll Hmmm... what happens if the user TPs the car to an area where scripts dont work, then deletes the removal script?
*ponders*
Perhaps the temporary test script should be included in the vehicle script so that taking it out makes the vehicle useless?
Perhaps a better solution might be to make the vehicle llDie() if it is taken out of the sim?
Just being the devil's advocate here...
Edit: temporary objects last between 60 and 70 seconds As you said yourself, you have to make sure that the removal script isnt directly visible, preferably by incorporating it into the main script. And of course make them no copy. One other option is to make it so that an item cannot be rerezzed, default {
on_rez(integer num) { if(num == 0) { llDie(); } }
}
And have your demo vendor always rez with a value other than zero.
|
|
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
|
03-28-2007 07:33
If the car is no modify the script can't be removed - I think.
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr
SL books http://astore.amazon.com/secondlife-sl-20/
Need a beta tester for quality assurance ? Need a translator for English, French, Spanish ?
|
|
Nexus Laguna
Registered User
Join date: 20 Dec 2006
Posts: 40
|
03-28-2007 08:15
From: Tyann Toll Hmmm... what happens if the user TPs the car to an area where scripts dont work, then deletes the removal script?
*ponders*
Perhaps the temporary test script should be included in the vehicle script so that taking it out makes the vehicle useless?
Perhaps a better solution might be to make the vehicle llDie() if it is taken out of the sim?
Just being the devil's advocate here...
Edit: temporary objects last between 60 and 70 seconds The vehicle will have to llDie() if tleported or crossing sim boundaries as the new server will refresh the temp-on-rez timer each time, so if a user was fast enough they could race the car over sim boundaries and have a car that NEVER disappears. Therefore using llSetTimerEvent() and llDie is the best option in this case and will provide the more reliable option. Also, if a user takes the vehicle into a land with no scripting the vehicle itself wont work anymore. If an object is no mod a script cant be removed from it.... Problems solved
|
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
03-28-2007 08:41
Temp rez might actually be better for this. If you have your sign anywhere near a sim border, and use llDie when crossing borders, your potential customers wont get very far in the demo. Also, there may be a parcel nearby that allows object entry but not scripting, which would leave your scripted, non-temp car permanently rezzed.
Edit: in response to above - even if they can race fast enough in a temp rez car, something will bring them to a stop sooner or later (ban lines, no object entry land, lag, general grid issues) and the car would be cleaned up.
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
03-28-2007 09:26
From: Sys Slade Edit: in response to above - even if they can race fast enough in a temp rez car, something will bring them to a stop sooner or later (ban lines, no object entry land, lag, general grid issues) and the car would be cleaned up. And with Simil's code above, it would poof when the stood up, too. If the manage to avoid the temp timeout by dragging a physical object across sim lines every minute and they never stand up, I say let them keep playing with it.
|