All Olive Experimenters Read This!
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-16-2003 23:24
I was just in a major experiment with a fallen building in olive, and parts of it were flung all the way into mocha 128 128! Heres a script for all people in olive who are experimenting with stuff THATS SUPPOSED TO STAY IN OLIVE (dont put this in anything your taking out). This will derez the prim its on if that prim goes out of the sim the script was activated on. default { state_entry() { llSetStatus(STATUS_DIE_AT_EDGE,TRUE); vector INITCorner = llGetRegionCorner(); while(TRUE) { if(llGetRegionCorner() != INITCorner) { llDie(); } } } }
Note: I am not responsible for any mistakenly derezzed prims due to this script. I hope this helps all you experimenters! (and the ppl living near them). -Chris EDIT: Coloured Version! 
|
Derek Jones
SL's Second Oldest Monkey
Join date: 18 Mar 2003
Posts: 668
|
08-18-2003 08:08
Hey man thanks! This will help when I decide to do my towers again. Been kinda not in the mood from the response of the people in Slate lol. Luckily it's down to two that are still mad at me P.S. Couldn't you set it so when it rezzes, it resets the script? From: someone (dont put this in anything your taking out).
_____________________
The fact that a believer is happier than a skeptic is no more to the point than the fact than a drunken man is happier than a sober one
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-18-2003 13:37
There is a slight problem with it... Linked objects dont properly derez with this script, its a bug, dunno if its known however. Heres the code that will reset if you put the object in inventory and take it out again (derez --> rez again). default { on_rez(integer param) { llResetScript(); } state_entry() { llSetStatus(STATUS_DIE_AT_EDGE,TRUE); vector INITCorner = llGetRegionCorner(); while(TRUE) { if(llGetRegionCorner() != INITCorner) { llDie(); } } } }
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
08-18-2003 17:41
Since llResetScripts() used to be expensive to call you could do this. of course it doesn;t really matter since it is only getting called once per object per rez, just no viral objects please  init() { llSetStatus(STATUS_DIE_AT_EDGE,TRUE); vector INITCorner = llGetRegionCorner(); while(TRUE) { if(llGetRegionCorner() != INITCorner) { llDie(); } } }
default { on_rez(integer param) { init(); } state_entry() { init(); } }
_____________________
i've got nothing. 
|
Xylor Baysklef
Scripting Addict
Join date: 4 May 2003
Posts: 109
|
08-18-2003 20:13
I would make one suggestion... using while (TRUE) in a public script (even one that will only run on Olive) could start a lot of lag... Why not use a llSetTimerEvent(5.0); ? There really isn't any rush to have the lost object die. Even llSetTimerEvent(10.0) should be good. Perhaps something along the lines of: float TIMER_REFRESH = 5.0;
vector gInitCorner;
Init() { gInitCorner = llGetRegionCorner(); llSetStatus(STATUS_DIE_AT_EDGE, TRUE); llSetTimerEvent(TIMER_REFRESH); }
default { state_entry() { Init(); }
on_rez() { Init(); }
timer() { if (llGetRegionCorner() != gInitCorner) llDie(); } }
Another approach is to just put an llSleep(5.0); or so in the while(TRUE) loop. Xylor
|
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
|
08-19-2003 08:16
Yikes, a while(TRUE) without a sleep or rest?!
Also nice is llSetStatus(STATUS_SANDBOX, TRUE);
_____________________
Sarcasm meter: 0 |-----------------------*-| 10 Rating: Awww Jeeze!
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-19-2003 09:53
llResetScript() is server intensive? Eep... we really need a guide for these things... Im thinking of creating a database of how long each LL function takes.. I cant really measure the effect it actually has on the server however, not accurately... LL would be better at it then me... ::hint,hint  :: -Chris PS. ty for the info Nada, good idea consolidating the script into a function, and just having the on_rez() and state_entry() events call that function.
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-20-2003 20:55
Yes WG, STATUS_SANDBOX is nice, but limiting.. If I want to build a 300 m tower, then collapse it, most of the dramatic effect (such as falling more then the 10-20 meters allowed by STATUS_SANDBOX) would be lost.
-Chris
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-23-2003 21:26
Xylor, llSetTimerEvent probobally takes more out of a sim, since it fires an event. I believe a loop would be less intensive.
|
ZHugh Becquerel
Registered User
Join date: 24 Oct 2003
Posts: 68
|
Self-destruction script
10-30-2003 06:53
I'm playing round with Orcs, and they keep running off... Here's how to stop them from eating up all your money! : float LastTimeOwnerDetected; key owner;
TellOwner( string Message ) { // llWhisper( 0, "Trace: " + Message ); llInstantMessage(owner, (string)llGetPos() + " " + Message ); }
Init() { owner = llGetOwner(); LastTimeOwnerDetected = llGetTimeOfDay(); llSetTimerEvent(10.0); llSensorRepeat( "", "", AGENT, 50, PI, 10.0 ); } SelfDestructNow() { llSay(0, "Too far from owner. Self-destructing..."); llInstantMessage(owner,"Too far from owner. Self-destructing..."); llDie(); }
default { state_entry() { Init(); } on_rez(integer start_param) { Init(); } timer() { if( llGetTimeOfDay() - LastTimeOwnerDetected > 60 ) { //TellOwner( (string)llGetTimeOfDay() + " " + (string)LastTimeOwnerDetected ); SelfDestructNow(); } else if( llGetTimeOfDay() - LastTimeOwnerDetected > 30 ) { TellOwner( "Self destructing in 30 seconds..." ); } } sensor(integer num_detected) { integer i; integer near_owner; near_owner = FALSE; for( i=0;i<num_detected;i++) { //TellOwner("Sensed:" + llDetectedName(i)); if( llDetectedKey(i) == owner) { //TellOwner( "You're close"); near_owner = TRUE; } } if( near_owner == TRUE ) { LastTimeOwnerDetected = llGetTimeOfDay(); } } }
Basically, checks whether you're within 50 meters. If you're not it issues an IM warning you after 30 seconds, and dies after 60 seconds.
|