Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Verbal reset of scripts

Tigsen Fairplay
Registered User
Join date: 23 Aug 2004
Posts: 16
09-03-2004 00:37
I found myself wanting to quickly turn off some of my scripts that were running on an object I was working on, so I wrote the following short script that I thought others might find useful. The object owner says "reset" and the script will reset all other scripts in the inventory of the same object.

CODE

// Script reset by Tigsen Fairplay
// Object owner simply says "reset" and all scripts in the
// same inventory as this one will be reset.

// Great for stopping run-away scripts or long-running
// scripts that you've seen enough output from.
default
{
state_entry()
{
// Listen only to the object's owner.
llListen( 0, "", llGetOwner(), "" );
}

listen(integer iNotUsed, string sNotUsed, key kNotUsed, string sMessage)
{
if (sMessage == "reset")
{
// We'll be iterating through all scripts in this
// object's inventory, starting with 0.
integer iIndex = 0;

// Get the name of the first script found.
string sScriptName = llGetInventoryName(INVENTORY_SCRIPT , iIndex);
while (sScriptName != "")
{
// As long as the script found isn't this one, reset it.
if (sScriptName != llGetScriptName())
{
llSay(0, "Resetting: " + sScriptName);
llResetOtherScript(sScriptName);
}

// Increment our index and get the next script name.
iIndex = iIndex + 1;
sScriptName = llGetInventoryName(INVENTORY_SCRIPT , iIndex);
}

llSay(0, "Reset complete.");
}
}
}


Enjoy,
Tigsen
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-21-2004 08:34
Is there a way to traverse sub-objects in a linked object?

Example:

The main prim does not have a script in it, but three objects have scripts in them that are linked to the main prim. Can a script look for prims linked to it, and create a reset for those objects as well (without resetting willy-nilly)?
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
09-21-2004 22:29
I'd like to encourage the use of non-0 channels, especially in this case. Too many regions of SL are already very laggy from listens, and filtering on channel number is a great performance improvement.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
LandRaider Ayoob
Registered User
Join date: 18 Sep 2004
Posts: 1
11-01-2004 15:49
From: Samhain Broom
Is there a way to traverse sub-objects in a linked object?

Example:

The main prim does not have a script in it, but three objects have scripts in them that are linked to the main prim. Can a script look for prims linked to it, and create a reset for those objects as well (without resetting willy-nilly)?


Might be kind of late for an answer, but what I did was create several "remote reset" scripts. The main script (posted above) would send a linked message to all prims in the object to reset. The remote reset scripts would pick up that linked message and then do the same thing as the main script, resetting every script in the same prim as the remote reset script. I actually just updated mine so that the remotes and main script can suspend other scripts, let them continue running, or reset them.

Tigs