Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

The need to reset scripts

Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
11-09-2007 08:20
I built a scripted wishing well that accepts monetary donations as well as inventory items including gifts and well-wishes on note cards. Everyone who contributes to the well is given a small gift of appreciation. The gift is accompanied by an llSay message that says "so-and-so thanks you for your gift." The name is derived from the UUID that the owner puts on a config note card inside the well.

On numerous occasions I have had complaints that the well "isn't doing anything." Scoping out the issue firsthand reveals that the script seems to be totally unresponsive. When you rez the well, the first thing it's supposed to do is make sure you are okay with it debiting your account. After that, it responds with various messages based on your interactions with it. Also, the owner can say "well reset" to kind of kick-start the script.

When I happen upon clients having problems none of these behaviors present themselves. Even re-rezzing does nothing. The only thing that works is having the owner edit the well, go to contents, double-click the script - to which they have no mod access - and pressing the "RESET" button.

Once they do that all is well. Does anybody have any idea what may be causing the script to just shut down to the extent where a reset is necessary? Are there any work-arounds that I could add to the script to keep this from happening? Is this just an "SL thing" that happens every now and then?

Sincerely,
Bartiloux Desmoulins
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
11-09-2007 08:39
One very nasty cause of this can be memory fragmentation.

Essentially, if you have a lot of variables whose lengths often change, your script can run out of memory very fast, and resetting it appears to be the only solution.
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
11-09-2007 09:32
But Yumi, wouldn't running out of memory give a script error? I assume the OP would have mentioned it if there were actual errors to be seen ...

Would this also be the behavior if the script had some sort of timing window that caused a deadly embrace or infinite loop?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-09-2007 14:15
From: Nika Talaj
But Yumi, wouldn't running out of memory give a script error? I assume the OP would have mentioned it if there were actual errors to be seen ...

Would this also be the behavior if the script had some sort of timing window that caused a deadly embrace or infinite loop?


OP was showing up at the well after the fact though and the only one who would have seen the stack heap collision message would have been some poor user.

To the OP. You either have an infinite loop in the script or if you are keeping the names of the people contributing in a list then that would be the cause. If the names aren't cleared on a regular basis then you are going to run out of room. If that is the case then you are going to have to put in one or more extra scripts into the well to take the extra names or start sending the data to an sql database.
_____________________
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
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-09-2007 16:40
when adding to lists you can limit them by using this
//-- add new item to front of list, clip end of list if already maxSize
//-- it's - 2 beacuse -1 for last index, -1 more for clipping
myList = (list)Item2Add + llList2List( myList, 0, maxSize - 2 );

that will prevent stack/heap collision from occuring with lists that can grow infintely

if you're reporting the names somehow, the other way to do it is

if (llGetListLength( myList ) == maxSize){
//-- insert reporting code
myList = [];
}
//-- code to add to list

or modify it further to report on a regular basis, say in a timer

//-- after the normal add to list code
if (llGetListLength( myList ) == maxSize - 1){
llSetTimerEvent( .01 )
}

//in the timer
llSetTimerEvent( normalReportingPeriod );
//-- insert repoting code
myList = [];
_____________________
|
| . "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...
| -
AlexAlex Yifu
Registered User
Join date: 2 Jun 2007
Posts: 17
11-10-2007 02:34
Does the script keep on working after the new owner has reset it? Does it include the changed event to respond to the owner change? or maybe it's in the wrong state when transferred / rezzed and needs to be reset because of that? (I assume the new owner is not trying to run it in a no scripting area ;) ).