Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

So I guess we need to start adding a means to reset nomod scripts that will be resold

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-20-2006 07:38
/139/e5/149985/1.html

It affects one script I have. A couple of others I made already have an On_Rez llResetScript function built in.

Maybe wahtever functions you aren't using in a script such as touch, Sit or On_Rez could be diverted to reset script if the script needs it. Have no idea what to do if those options are already assigned. Any other suggestions?
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-20-2006 07:51
well.. I think it may be possible to add a secondary script to objects, that might have a command to reset the other script. If all that script did was reset the main script.. I'm not sure it could become "not running" without a lot of help.

of course, adding a "reset" button to menus makes sense.. but if the script isn't running.. can you get the menus to come up? Same problem with touch or sit.

An additioanl question is.. if the script somehow gets "turned off" will on_rez even work?

isn't there a menu option under tools that says "Reset scripts in selection?"
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-20-2006 07:57
From: Winter Ventura
isn't there a menu option under tools that says "Reset scripts in selection?"


That is exactly the problem. If you own a nomod object you can not reset the script using the tools menu. There was an exploit tied to that capability and it has been stripped from us. You also can no longer remove a non functioning script from a nomod object and replace it with one that does work.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Niatachal Masukami
Registered User
Join date: 7 Oct 2006
Posts: 1
An idea...
11-26-2006 23:04
So, maybe I'm totally off my rocker here, which is possible... but why can't you use a changed event? Maybe I totally misunderstand, but wouldn't something like the following work? I haven't tested it, so let me know how it works out for you!


changed( integer change )
{
if( change & CHANGED_OWNER )
{
llResetScript();
}
}



You should be able to toss this in anywhere, and theoretically the first time the object is rezzed after being bought, or transferred, the script would reset itself. While this wouldn't take care of anything you've purchased already, maybe we can get the word out. Hopefully it works for you!

P.S. Sorry for the bad formatting.. I'm new to this :)
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
11-27-2006 00:41
From: Niatachal Masukami
So, maybe I'm totally off my rocker here, which is possible... but why can't you use a changed event? Maybe I totally misunderstand, but wouldn't something like the following work? I haven't tested it, so let me know how it works out for you!


changed( integer change )
{
if( change & CHANGED_OWNER )
{
llResetScript();
}
}



You should be able to toss this in anywhere, and theoretically the first time the object is rezzed after being bought, or transferred, the script would reset itself. While this wouldn't take care of anything you've purchased already, maybe we can get the word out. Hopefully it works for you!

P.S. Sorry for the bad formatting.. I'm new to this :)



it should, or you could use an on_rez event to do the same thing ...

as far as formating use the php and /php tags to open and close the script window in the forums ... surounded by [], id type it but its a pita to get it to not format automaticly :)

another thing i do is if threre is user input... make a reset command, if there is more than one script link message it (or whatever) to reset when a certian command comes tru
Kitty Barnett
Registered User
Join date: 10 May 2006
Posts: 5,586
11-27-2006 06:35
From: someone
Any other suggestions?
Why not simply make the object the script is contained in, mod? :confused:

"Please click the object to reset the contained scripts when it stops functioning" doesn't really make much sense to me.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-27-2006 07:04
From: Kitty Barnett
Why not simply make the object the script is contained in, mod? :confused:

"Please click the object to reset the contained scripts when it stops functioning" doesn't really make much sense to me.


Yep that does work but there are times when you have an object that you wish to sale as copy/no mod. Then it is impossible to reset the script unless:

A) A linden resets the script for you

B) The original creator resets the script for you

C) We script into it a way for the new owner to reset the script
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
11-27-2006 10:34
I have taken to adding llResetScript to the on_rez event. (also triggers when wearing (why?))
that forces it into the "state_entry" event at that point.

Only problem after that is....

How to turn on a script in a no_mod object that has become turned-off?
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
11-27-2006 11:34
From: Winter Ventura
I have taken to adding llResetScript to the on_rez event. (also triggers when wearing (why?))


Because "attaching" from inventory first has to rez the object into existence in the sim you are in, then it "attaches" where you tell it. It's basically a seamless operation in effect, but not as far as script events are concerned.

Note that on_rez does not fire if you attach an already-rezzed object to you (via right-click Attach..).
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-27-2006 13:04
I tend to have either a menu option or a changed event reset the script.
Sometimes you dont want things resetting when ever you rez them.

One idea that I did try was to have the scipt only reset if it detects a specifically named notecard in inventory. That way I could drop a notecard into the object and have the script reset itself and delete the notecard. it was only after I had it working I realised I had to have mod rights to be able to put the notecard in it in the first place.....
Kitty Barnett
Registered User
Join date: 10 May 2006
Posts: 5,586
11-27-2006 16:09
From: Jesse Barnett
Yep that does work but there are times when you have an object that you wish to sale as copy/no mod.
Maybe I'm just missing something, but if your script locks up (ie infinite loop), or simply crashes (ie stack/heap collision) then adding a touch() or on_rez() event that resets the script won't do a whole lot of good.

Adding a scripted way of resetting the script only works for predictable conditions, if your script is an unpredictable state (main reason for anyone wanting to reset it) I don't see how you can rely on your fail-safe to work.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
11-27-2006 16:43
Here's a little reset script I whipped up:

CODE

integer giListener = -1;
integer giResetChannel = 12345;
key gkOwner;

NewListener(key pkNewOwner) {
if (giListener >= 0)
llListenRemove(giListener);
giListener = llListen(giResetChannel,"",pkNewOwner,"reset");
}

ResetAllScripts() {
integer liIndex;
integer liCount;
string lsMyName;
string lsScriptName;

liCount = llGetInventoryNumber(INVENTORY_SCRIPT);
lsMyName = llGetScriptName();
for (liIndex = 0; liIndex < liCount; liIndex++) {
lsScriptName = llGetInventoryName(INVENTORY_SCRIPT,liIndex);
if (lsScriptName != lsMyName)
llResetOtherScript(lsScriptName);
}
}

default {
state_entry() {
gkOwner = llGetOwner();
NewListener(gkOwner);
}
on_rez(integer piParameter) {
if (gkOwner != llGetOwner()) {
gkOwner = llGetOwner();
NewListener(gkOwner);
}
}
changed(integer piChanged) {
if ((piChanged & CHANGED_OWNER) != 0) {
gkOwner = llGetOwner();
NewListener(gkOwner);
}
}
listen(integer piChannel, string psName, key pkID, string psMessage) {
ResetAllScripts();
}
}


Simply type /12345 reset and all scripts except this one will get reset.

Of course, this only works on any scripts in the prim itself; other prims with scripts you want to reset will require a copy in those prims as well.