• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-2751
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Si Linden
Reporter: Moon Metty
Votes: 7
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

1.24: LSL events survive reset

Created: 05/Aug/08 03:30 PM   Updated: 15/Sep/08 10:24 AM
Return to search
Component/s: Scripts
Affects Version/s: Mono Beta, 1.24 Server
Fix Version/s: None

Environment:
Second Life 1.20.15 (93532) Aug 1 2008 15:59:25 (Second Life Release)
You are at 255741.0, 255335.6, 21.0 in Sandbox Goguen MONO located at sim3017.aditi.lindenlab.com (216.82.2.23:13002)
Second Life Beta Server 1.24.4.93464

You are at 270060.0, 257468.8, 400.8 in White Wolf located at sim4974.agni.lindenlab.com (216.82.27.185:13001)
Second Life Server 1.24.3.95195
Issue Links:
Duplicate
 
Relates
 

Linden Lab Issue ID: DEV-18897


 Description  « Hide
Add this script to a box and wear it:

default
{
state_entry()

{ llSay(0, "reset"); }

on_rez(integer dummy)

{ llSay(0, "rez"); llResetScript(); }

attach(key dummy)

{ llSay(0, "attach"); llResetScript(); }

}

Compiled in mono the output is:

[14:59] Mono: rez
[14:59] Mono: reset

Compiled in LSL it gives:

[15:00] LSL: rez
[15:00] LSL: reset
[15:00] LSL: attach
[15:00] LSL: reset



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Strife Onizuka added a comment - 18/Aug/08 04:15 PM - edited
That's interesting. I can imagine why it might have been done intentionally but I'm unsure if it is a good idea or not. It has the feel of 2004 about it. Ask Andrew Linden about it.

Lashek Todriya added a comment - 30/Aug/08 03:20 PM - edited
Sim Details:
You are at 270060.0, 257468.8, 400.8 in White Wolf located at sim4974.agni.lindenlab.com (216.82.27.185:13001)
Second Life Server 1.24.3.95195

I have noticed that since the MONO release, events are not being cleared after an llResetScript (This bug doesn't just affect attach scripts), some of my scripts using dataserver and notecard reading have been getting null keys after a reset. This has been occuring ever since the Mono release and worked perfectly before. I have gutted the script and changed it so that it can be triggered by touching. Too protect my games work, and all ^^;

Notecard is also in this message and is labelled "settings".

Script:

key player = "";
string objname = "";
string sittext = "";
string animation = "";
string loseanimation = "";
string winanimation = "";
integer timercount = 0;
integer minutestoend = 2;
integer winpercentage = 60;
integer loseanimlength = 11;
integer winanimlength = 12;
vector offset = < 0.0, 0.0, -0.1 >;

// for notecard reading
integer gLine = 0;
string gNotecard = "settings";
key dataserver_key = NULL_KEY;

next_line()
{
gLine++;
dataserver_key = llGetNotecardLine(gNotecard,gLine);
}

reset_script()
{
player = "";
timercount = 0;
llSetText(sittext, <1,1,1>, 1.0);
}

default {
state_entry() {
llSetText("Please wait, Initializing.", <1,1,1>, 1.0);

if(llGetInventoryName(INVENTORY_NOTECARD,0) == gNotecard)

{ gLine = 0; dataserver_key = llGetNotecardLine(gNotecard, 0); }

else

{ llSay(0, "Settings not detected! Auto-setting!"); objname = "Default Name"; sittext = "Sit on me for no reason!"; animation = "haruhi_loop"; loseanimation = "yatta"; winanimation = "carameldansen"; timercount = 0; minutestoend = 5; offset = < 0.0, 0.0, -0.1 >; }

llSitTarget(offset,ZERO_ROTATION);
}

touch_start(integer num_detected)

{ llUnSit(player); llResetScript(); }

run_time_permissions(integer perm)
{
if(perm == PERMISSION_TRIGGER_ANIMATION)

{ llStopAnimation("sit"); llStartAnimation(animation); }

}

changed(integer change) {
if (change & CHANGED_LINK) {
key av = llAvatarOnSitTarget();
if (av) { llRequestPermissions(av,PERMISSION_TRIGGER_ANIMATION); player = av; llStartAnimation(animation); }
else

{ llResetScript(); }

}

if (change & CHANGED_INVENTORY) { llSay(0, "Inventory change detected. Resetting script now. Please wait."); llResetScript(); }
}

dataserver(key queryid, string data)
{
if(queryid != dataserver_key)

{ llSay(0, "ERROR! Dataserver cannot read notecard!"); return; }

if(data != EOF)
{
if(llGetSubString(data,0,0) != "#")
{
if(llGetSubString(data,0,7) == "objname:")

{ objname = llGetSubString(data,9,-1); llSetObjectName(objname); next_line(); return; }

if(llGetSubString(data,0,7) == "sittext:")

{ sittext = llGetSubString(data,9,-1); llSetText(sittext, <1,1,1>, 1.0); next_line(); return; }

if(llGetSubString(data,0,9) == "animation:")

{ animation = llGetSubString(data,11,-1); next_line(); return; }

if(llGetSubString(data,0,12) == "winanimation:")

{ winanimation = llGetSubString(data,14,-1); next_line(); return; }

if(llGetSubString(data,0,13) == "loseanimation:")

{ loseanimation = llGetSubString(data,15,-1); next_line(); return; }

if(llGetSubString(data,0,6) == "offset:")
{
integer length = llStringLength(data);
if(llGetSubString(data,8,8) != "<" || llGetSubString(data,length - 1,length) != ">")

{ llSay(0,"Error: The numbers in the offset value lack the '<' and '>' signs. (Should be something like <3.0,1.0,6.0> )"); offset = <0,0,-0.10>; }

else
offset = (vector)llGetSubString(data,8,-1);

if(offset == <0,0,0>)
offset = <0,0,-0.10>;

next_line();
return;
}

if(llGetSubString(data,0,7) == "minutes:")

{ minutestoend = (integer)llGetSubString(data,9,-1); next_line(); return; }

if(llGetSubString(data,0,13) == "winpercentage:")

{ winpercentage = (integer)llGetSubString(data,15,-1); next_line(); return; }

if(llGetSubString(data,0,13) == "winanimlength:")

{ winanimlength = (integer)llGetSubString(data,15,-1); next_line(); return; }

if(llGetSubString(data,0,13) == "loseanimlength:")

{ loseanimlength = (integer)llGetSubString(data,15,-1); next_line(); return; }

next_line();
}
else
next_line();
}
}
}

Notecard (Must be named "settings"):

  1. objname is the name of the Object
  2. The script auto-sets the object name to this.
    objname: Fish Scooping
  1. sittext is the message that appears when no one is sitting on the object.
    sittext: Scoop Fishies!
  1. animation is the looping animation that plays until the timer is hit (Should be in inventory unless you know the key to the anim)
    animation: GoldfishingLook
  1. winanimation is the animation that plays when a camper wins (Should be in inventory unless you know the key to the anim)
    winanimation: GodlfishingWin
  1. loseanimation is the animation that plays when a camper loses (Should be in inventory unless you know the key to the anim)
    loseanimation: GoldfishingFail
  1. offset is the offset a player is set to when they sit on the object. Default should be fine if you adjust the height of the object.
    offset: < 0.0, 0.0. -0.10>
  1. minutes is the total number of minutes a player must wait in order to win (Default: 5)
    minutes: 1
  1. chance of winning in percentage (0-100%)
    winpercentage: 100
  1. Length of winning animation (in seconds)
    winanimlength: 12
  1. Length of losing animation (in seconds)
    loseanimlength: 11
  1. Message displayed when player wins
    winmessage: You win...
  1. Message displayed when player loses
    losemessage: You lose...

When the script is used in Mono, it gives the "ERROR! Dataserver cannot read notecard!" message while in Pre-Mono, it works perfectly.

To reproduce, put the settings notecard in an object and my script into an object and sit, then click on the prim to unsit and reset the script. It may produce an error about the animation not being found (because I didn't include them, of course), but that can be ignored.


Moon Metty added a comment - 30/Aug/08 06:58 PM
Hi Lashek,

I added your script and the settings note to a box, then I sat on the box. I didn't get that message in LSL, nor in Mono.

Then I tried this script:

// dataserver-event survives reset in LSL
key notecard_query;
default
{
state_entry()

{ // read the first line notecard_query = llGetNotecardLine("New Note", 0); }

dataserver(key queryid, string data)

{ // say data, and do a new query before resetting llSay(0, data); notecard_query = llGetNotecardLine("New Note", 1); llResetScript(); }

}

The notecard is called "New Note" and has 2 lines.

Output in Mono:

[18:40] Object: line 1
[18:40] Object: line 1
[18:40] Object: line 1
[18:40] Object: line 1
[18:40] Object: line 1
...

Output in LSL:

[18:40] Object: line 1
[18:40] Object: line 2
[18:40] Object: line 1
[18:40] Object: line 2
[18:40] Object: line 1
...

So, indeed the event survives a reset in LSL.
Thank you


Moon Metty added a comment - 30/Aug/08 10:44 PM
// LSL linked message survives reset
default
{
state_entry() { llMessageLinked(LINK_THIS, 1, "", ""); }

link_message( integer sender_num, integer num, string str, key id )

{ llSay(0, (string)num); llMessageLinked(LINK_THIS, 2, "", ""); llResetScript(); }

}

Mono:

[22:25] Object: 1
[22:25] Object: 1
[22:25] Object: 1
[22:25] Object: 1
[22:25] Object: 1
...

LSL:

[22:25] Object: 1
[22:25] Object: 2
[22:25] Object: 1
[22:25] Object: 2
[22:25] Object: 1
...


Strife Onizuka added a comment - 31/Aug/08 07:17 AM
I think the dataserver result can be explained by Mono just being faster, takes less time to read the notecard and queue the event, 0.1 seconds is plenty of time for a notecard line lookup and to queue a dataserver event.

I suspect in LSO event queuing is just slower then it is in Mono. The script reset may be slower in Mono.


Strife Onizuka added a comment - 31/Aug/08 07:22 AM
To test if it is a timing issue, put a llSleep(0.2) before the llResetScript() in both scripts and rerun the test. Hopefully during that time it will give the events in the LSL test time enough to queue.

Script reset could also work slightly differently on Mono. In LSO the event queue might be cleared early on during the reset, in Mono it might happen last.
Script reset on Mono should be slower, loading global variable initial values should be much easier in LSL (just copy the appropriate memory blocks all at once, instead of having to copy each individual value).


Lashek Todriya added a comment - 31/Aug/08 09:06 AM - edited
I originally thought that as well, so I put a 3 second sleep in front of my resets beforehand as well, and still, it doesn't have any effect.

While I know the goal of Mono is to make scripts faster and work better, it's actually broken alot of mine to the point that I have to recompile the scripts to reset them... and I can't use llResetScript anymore to do it effectively.

Recompiling actually resets the events for me while llResetScript doesn't even TOUCH the events.

Basically, in my script, the dataserver key is different then what it should be and this is ONLY when it gets reset. I went so far as to put llSleep's after just about everything (for about 1-3 seconds) and it still results with the same effect which NEVER occured in pre-mono days. This confirms to me that it's not something that can be fixed in the script by us ourselves but in the LSL engine itself and it is, indeed, a bug.


Moon Metty added a comment - 31/Aug/08 02:37 PM
Adding a llSleep(3) before the reset doesn't make any difference. Of course the script is inactive during the sleep, so I tried:

integer i;
for (i = 0 ; i < 10000 ; i ++)
{
string s = "Ehhh, what's up, doc?";
}

The results are the same.

=======

Why Lashek's script gives the message is unclear to me, because there is no llResetScript() inside the dataserver-event.
Also, the text "ERROR! Dataserver cannot read notecard!" does not describe what's happening.
A better message would be: "An unknown dataserver-query has been flushed."


Strife Onizuka added a comment - 01/Sep/08 12:28 AM
I had a flash of inspiration. I guessed you ran your tests in a dual LSO-Mono sim and not two different simulators.

You forgot to consider that LL might have broken llResetScript for LSO when they implemented Mono. It turns out if you run your LM and Dataserver test scripts in a Legacy Havok1 sim it returns the same results as your Mono tests. I performed the tests in Fame on the beta grid (Aditi).

llResetScript for LSO on Mono sims does not properly clear the event queue.

I'm believe that LL changed the implementation of llResetScript to support Mono and in the process partially dropped LSO support.

I'm raising the priority since this is a Major change in LSO VM behavior.


Strife Onizuka added a comment - 02/Sep/08 11:19 AM
It has been reported in SVC-2365 that they even survive script resets after script crashes!!!

Moon Metty added a comment - 05/Sep/08 05:13 PM
Good news everyone..

There is a fix running on Aditi for the reset.

I tried:

attach()
dataserver()
link_message()
link_message() + manual reset ( SVC-2980 )

All of these events are canceled by a reset in LSL scripts now.

=======

Note: Other problems with state-changes and timer are still there:

VWR-9023 llResetScript in touch_start() results in double touch_start() event (Mono & LSL)
SVC-2990 Listen events persist between states in LSL2 (LSL only)
SVC-2973 MONO - timer() event triggers before on_rez(), & state_entry() (Mono & LSL)

=======

Second Life 1.21.0 (94829) Aug 20 2008 23:45:42 (Second Life Public Nightly)
You are at 255723.5, 255341.4, 20.8 in Sandbox Goguen 1.24 BETA located at sim3008.aditi.lindenlab.com (8.2.33.220:13002)
Second Life Beta Server 1.24.4.95876


Periapse Linden added a comment - 15/Sep/08 10:24 AM
passed QA