Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

LIBRARY: Object Bleach (a more thorough scrubber script)

Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-20-2009 15:05
kills all those pesky settings that reside in prims, but are only settable from a script (and a few that you can set from edit) and removes all scripts in the object.

I think I have all the scripted access only stuff in here (pretty sure physics off kills any physics calls like buoyancy)

CODE

/*//( v7-D Object Bleach v1.0 )//*/

integer gIntChn;

uBleach(){
/*//-- Remove Other Scripts to prevent interference --//*/
integer vIntCnt = llGetInventoryNumber( INVENTORY_SCRIPT );
string vStrInv;
if (vIntCnt > 1){
while (--vIntCnt){
if (llGetScriptName() != (vStrInv = llGetInventoryName( INVENTORY_SCRIPT, vIntCnt ))){
llRemoveInventory( vStrInv );
}
}
}
/*//-- Restore Interaface Properties --//*/
llSetSitText( "" );
llSetTouchText( "" );
llSetClickAction( CLICK_ACTION_TOUCH ); //-- setable from edit
/*//-- Restore Audible Properties --//*/
llSetSoundQueueing( FALSE ); //-- may not be needed
llStopSound();
llStopSound(); //-- trigger again for saftey with prequeued loops
llAdjustSoundVolume( 1.0 ); //-- may not be needed
llCollisionFilter( "", "", TRUE );
llCollisionSound( "be582e5d-b123-41a2-a150-454c39e961c8", 1.0 );
/*//-- Restore Visual Properties --//*/
llSetTextureAnim( FALSE , ALL_SIDES, 1, 1, 0, 0, 0.0 );
llTargetOmega( ZERO_VECTOR, 0.0, 0.0 );
llSetText( "", ZERO_VECTOR, 0.0 );
llParticleSystem( [] );
/*//-- Restore Deep Script Behaviors --//*/
llSetCameraAtOffset( ZERO_VECTOR );
llSetCameraEyeOffset( ZERO_VECTOR );
llSetRemoteScriptAccessPin( FALSE );
llSitTarget( ZERO_VECTOR, ZERO_ROTATION );
llSetStatus( STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z | STATUS_CAST_SHADOWS, TRUE );
llSetStatus( STATUS_SANDBOX | STATUS_BLOCK_GRAB | STATUS_DIE_AT_EDGE | STATUS_RETURN_AT_EDGE, FALSE );

if (llGetLinkNumber() < 2){
llSleep( 1.0 );
llOwnerSay( "Object Bleached. All Scripts and scripted settings removed." );
}

llRemoveInventory( llGetScriptName() );
}

default{
state_entry(){
if (2 > llGetLinkNumber()){
gIntChn = (integer)("0xFFFF" + llGetSubString( llGetKey(), 0, 3 ));
llListen( gIntChn, "", llDetectedKey( 0 ), "" );
llDialog(
llGetOwner(),
"WARNING: Object Bleach will remove ALL scripts and all prim settings with script" +
" only access\n\nClick \"OK\" to continue, or \"CANCEL\" to remove just this script",
["OK", "CANCEL"],
gIntChn);
llSetTimerEvent( 45.0 );
}else{
uBleach();
}
}

on_rez( integer vInt ){
if (2 > llGetLinkNumber()){
llOwnerSay( "Please open 'Edit'(ctrl+3), left click this object, then go to the tools menu and choose the" +
"option 'Set Scripts to Running in Selection' to finish bleaching the object" );
llSetScriptState( llGetScriptName(), FALSE );
llSleep( 2.0 );
uBleach();
}
}

listen( integer vInt, string vStr, key vKey, string vStrMsg ){
if ("OK" == vStrMsg){
llSetTimerEvent( 0.0 );
llSetLinkPrimitiveParams( LINK_SET,
[PRIM_PHYSICS, FALSE,
PRIM_PHANTOM, FALSE,
PRIM_TEMP_ON_REZ, FALSE]
/*//-- optional properties to reset, comment out to ignore, setable from edit --//*/
+
[PRIM_GLOW, ALL_SIDES, 0.0,
PRIM_MATERIAL, PRIM_MATERIAL_WOOD,
PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
PRIM_POINT_LIGHT, FALSE, < 1.0, 1.0, 1.0 >, 0.0, 0.0, 0.0,
PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE]
/*//-- end: optional properties --//*/
);
integer vIntCnt = llGetNumberOfPrims();
while (1 < vIntCnt){
llGiveInventory( llGetLinkKey( vIntCnt-- ), llGetScriptName() );
}
llOwnerSay( "Take me to Inventory and ReRez me to continue the process" );
}else{
llRemoveInventory( llGetScriptName() );
}
}

timer(){
state sLK;
}
}

state sLK{
state_entry(){
state default;
}
}
/*//-- License Text --//*/
/*// Free to copy, use, modify, distribute, or sell, with attribution. //*/
/*// (C)2009 (CC-BY) [ http://creativecommons.org/licenses/by/3.0 ] //*/
/*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/
/*// All usages must contain a plain text copy of the previous 2 lines. //*/
/*//-- --//*/


if you find one I missed lemme know... I'll add it in.
_____________________
|
| . "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...
| -
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
08-06-2009 00:19
Hey Void, seems dandy, but I wanted to copy the script to inventory, and the "open" portion of the pie menu is greyed out on the prim after I re-rezzed it?

Ah, I see that the script deleted itself. I should still be able to open it, though. shouldn't I :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-06-2009 07:21
just create a new script in your inventory, not in an objects contents. it won't run if it's not in an object, so it won't delete itself. then when you need to use it, just drag it to the object
_____________________
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
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
The Eveready Bunny is ALIVE!
08-06-2009 08:06
Hey Void! I tried dumping a bunch of scripts in a prim to test Object Bleach, and here's one it doesn't touch. Any other script is deleted, hover text is wiped clean, llTargetOmega is removed, but this dumb little script keeps on ticking. Why? (BTW, I know it's a dumb little script. I don't even remember why I wrote it, but it was still kicking around in inventory so I decided it was good cannon fodder.)

CODE

// This script makes a prim disappear and then reappear repeatedly.

float period = 10.0; // Set this value to determine how long before the object changes state
// ----------------Don't mess with things below this line ------------
integer seen = 1;
default
{
on_rez(integer start_param)
{
llResetScript();
seen = 1;
}

state_entry()
{
if (seen != 0)
{
float x;
if (seen == 1)
{
llSetAlpha(1.0,ALL_SIDES);
llSleep(period);
state restart;
}
else if (seen == -1)
{
llSetAlpha(0.0,ALL_SIDES);
llSleep(period);
state restart;
}
}
else if (seen == 0)
{
llSetAlpha(1.0,ALL_SIDES);
state restart;
}
}
}

state restart
{
state_entry()
{
if (seen == 1)
{
float x = 0;
float step;
for (x; x <= 50.0; x++)
{
step = (50.0 - x) / 50.0;
llSetAlpha(step,ALL_SIDES);
llSleep(period/100.);
}
seen = -seen;
state default;
}
else if (seen == -1)
{
float x = 50.0;
float step;
for (x; x >= 0; x--)
{
step = (50.0 - x) / 50.0;
llSetAlpha(step,ALL_SIDES);
llSleep(period/100.);
}
seen = -seen;
state default;
}
else if (seen == 0)
{
state default;
}
}

}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-06-2009 08:57
Could be that nasty "scripts keep running after they're removed from sim" bug.

Might want to stop the scripts before removing them.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
08-06-2009 09:16
From: Ruthven Willenov
just create a new script in your inventory, not in an objects contents. it won't run if it's not in an object, so it won't delete itself. then when you need to use it, just drag it to the object
Right! Then it can't be compiled in MONO?
_____________________
From Studio Dora
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-06-2009 09:22
From: Dora Gustafson
Right! Then it can't be compiled in MONO?
Why would you care if this script is compiled in MONO or LSO?
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-06-2009 10:35
From: Argent Stonecutter
Could be that nasty "scripts keep running after they're removed from sim" bug.

Might want to stop the scripts before removing them.

I'll have to try that next time I can get in world. The script isn't just running, though. It's still in the object's inventory. In any case, if you have to know that you need to stop scripts before scrubbing, that makes this lovely scrubber a little more complicated for the average person to use easily.

It also occurs to me that the average user may also find it awkward to take a partially scrubbed object back to inventory and re-rez it to complete the operation -- some people will have trouble placing the scrubbed object exactly where it used to be. I wonder if it might be smart to code llGetPos() and llGetRot() into the scrubber and then include an on_rez event that snaps the object to those stored parameters... at least as an option.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-06-2009 10:43
From: Rolig Loon
I'll have to try that next time I can get in world. The script isn't just running, though. It's still in the object's inventory.
That shouldn't happen. Have the script check that the scripts it's removed are really removed.
From: someone
In any case, if you have to know that you need to stop scripts before scrubbing, that makes this lovely scrubber a little more complicated for the average person to use easily.
The scrubber can stop the scripts.

From: someone
It also occurs to me that the average user may also find it awkward to take a partially scrubbed object back to inventory and re-rez it to complete the operation
Why would you need to do that?
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-06-2009 11:02
From: Argent Stonecutter
That shouldn't happen. Have the script check that the scripts it's removed are really removed.

I know it shouldn't happen, but it does. That's why I mentioned it. I tried the experiment three times last night just to be sure. Not only does my dumb little script remain clearly in the inventory list, it keeps on doing its menial task .... gradually turning the prim's alpha off and on, off and on .....
From: someone
"It also occurs to me that the average user may also find it awkward to take a partially scrubbed object back to inventory and re-rez it to complete the operation."

Why would you need to do that?

Because that's the way this scrubber works. You drop it into the object, it does some of its scrubbing tasks, and then it tosses up a message that says, "Take me to Inventory and ReRez me to continue the process." When you do that, as soon as you re-rez the object, it says, "Please open 'Edit'(ctrl+3), left click this object, then go to the tools menu and choose the option 'Set Scripts to Running in Selection' to finish bleaching the object." The average user is going to find it annoying to take the object back to inventory, re-rez it to complete the scrubbing, and then fiddle around with putting it back where the pre-scrubbed object used to be.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
08-06-2009 13:17
Here's the one I have.

CODE
default {
state_entry() {
llSetTextureAnim(FALSE,0,0,0,0.0,0.0,0.0);
llSetText("",ZERO_VECTOR,0.0);
llParticleSystem([]);
llSetPayPrice(PAY_DEFAULT,[PAY_DEFAULT,PAY_DEFAULT,PAY_DEFAULT,PAY_DEFAULT]);
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
llTargetOmega(ZERO_VECTOR,0.0,0.0);
llStopSound();
llStopMoveToTarget();
llStopLookAt();
llCollisionFilter("", NULL_KEY, TRUE);
llForceMouselook(FALSE);
llPassCollisions(TRUE);
llPassTouches(TRUE);
llRemoveVehicleFlags(-1);
llSetVehicleType(VEHICLE_TYPE_NONE);
llSetRemoteScriptAccessPin(0);
llSetSitText("");
llSetTouchText("");
llSetBuoyancy(0.0);
llSetForceAndTorque(ZERO_VECTOR,ZERO_VECTOR,FALSE);
llSetPrimitiveParams([PRIM_POINT_LIGHT,FALSE,< 1.0,1.0,1.0 >,0.0,10.0,0.75]);
llSay(0,"Object Scrubbed!");
llRemoveInventory(llGetScriptName());
}
}
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-06-2009 13:27
From: Argent Stonecutter
Why would you care if this script is compiled in MONO or LSO?


exactly. it's only for temporary use, and isn't that big
_____________________
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
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
08-06-2009 13:46
From: Rolig Loon
Because that's the way this scrubber works. You drop it into the object, it does some of its scrubbing tasks, and then it tosses up a message that says, "Take me to Inventory and ReRez me to continue the process." When you do that, as soon as you re-rez the object, it says, "Please open 'Edit'(ctrl+3), left click this object, then go to the tools menu and choose the option 'Set Scripts to Running in Selection' to finish bleaching the object." The average user is going to find it annoying to take the object back to inventory, re-rez it to complete the scrubbing, and then fiddle around with putting it back where the pre-scrubbed object used to be.


That's because, to get scripts to run in other prims that are placed there via llGiveInventory, you have to take it into inventory first and re-rez it. Simply doing Tools->Set Scripts to Running in Selection doesn't work. It is annoying, but certainly not the script's fault in terms of design.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-06-2009 13:59
I know that. I'm not blaming the script design for anything. I'm answering Argent's question. He asked why you would want to take the object into inventory and re-rez it, so I told him. :rolleyes:

My observation still stands..... Because you have to take the object back into inventory and re-rez it, wouldn't it be smart to llGetPos and llGetRot first, save them, and then do llSetPos and llSetRot when the object is re-rezzed so that the scrubbed object ends up exactly where the dirty one used to be? It would save the user a bit of trouble.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
08-06-2009 14:05
So, add it. :)
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-06-2009 14:13
LOL..... ::banging head against wall:: :D

I will, in my own copy of it. Void's whole purpose for posting here was to share the script and get comments, so I commented. Time for another nap .........

ETA: And I still want to know why the scrubber didn't remove my dumb little test script.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
08-06-2009 14:19
Well, comments and refinements. It is why I posted mine, so she could add some of the stuff I do that she didn't do, and I can do that as well.

Though I normally use a separate distributor script to do multi-prim scrubbing. Works either way, though.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-07-2009 00:57
thanks for all the ideas.... (theres a few in there I didn't check like pay price and vehicle) I didn't mess with pos/rot because there's no guarantee that those weren't already off, and they can easily be changed by edit... just went after the ones that are a pita to get at w/o a script... great ideas all thank you.

I'm actually considering changing the remove scripts to just stopping them... and reporting which prim they are in.

as for why the every bunny is still going... hmmm... I'll have to look into that.

PS if you REALLY want to have it compiled in mono, simply uncheck running before saving, and then drag a copy to inventory.
_____________________
|
| . "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...
| -
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-21-2009 18:35
another thing you might want to add is the description field, if you simply hit backspace and leave it empty, it won't hold, it reverts to whatever the description was. same with the object name, but if you wanted to completely remove everything, wouldn't it be easier to just rez a new prim? lol
_____________________
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
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-21-2009 20:07
From: Ruthven Willenov
another thing you might want to add is the description field, if you simply hit backspace and leave it empty, it won't hold, it reverts to whatever the description was. same with the object name, but if you wanted to completely remove everything, wouldn't it be easier to just rez a new prim? lol

don't want to remove structure or textures, just hidden properties and scripts that may be setting them. I'm sort of meh on messing with the descriptions as those generally won't have any unusual impact on an object, and if you want to replace the scripts wiping those may have some bad side effects... also there's the thing that at least the root prim will get set to (no description) when it goes to inventory.
_____________________
|
| . "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...
| -
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
08-22-2009 14:07
From: Void Singer
also there's the thing that at least the root prim will get set to (no description) when it goes to inventory.

really? i've never noticed that, though i hardly use the description for storing info anyways
_____________________
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