Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004873opensim[REGION] Script Functionspublic2010-07-15 07:222010-07-15 10:30
Reporteraiaustin 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004873: Possible problem with radar script?
DescriptionI have spotted a problem on the 0.7 post fixes version. It may be a recently introduced issue.

A simple avatar radar that shows the avatars in the area and their distance from the object usually works fine.

But if Opensim.exe is brought down while users are logged in, and then restarted, the avatar text shows the avatars LAST present before the system was brought down and back up. See attached image where one avatar (Ai Austin) is 1m from object and "Be Austin" is not logged on... though avatar radar indicates settings for both at distance they were from object at time of last termination of Opensim.exe.

The script seems not to restart and resense properly when the simulator is brought back up whereas it used to and should. If I reset the script manually it starts again fine.

Script attached.

Repeat the process as follows:

1. [CHANGED] it seems that this only applies to existing objects, new objects or duplicated objects do not show the behaviour]
2. log in an avatar near the radar object. do not log this user off.
3. bring down your opensim.exe
4. restart opensim.exe and log back in the avatar.
5. the radar object is "stuck" on the previous avatar(s) in the area and the distance they were from the object at that time. Script though shows as running. Walk towards and away from it and it does not alter. Log off and back on and again it does not alter. Log on as second avatar and again no change.
6. Reset script manually and it works fine immediately.

But I see it now shows the avatar that were
Additional Information// Basic Radar
// Created by Water Rogers for IBM/Opensource

// Purpose
// --------------------------------------------------------------
// This is a basic example of how you can create a simple radar
// to detect Avatars within a given distance around the object
// that this script resides in. Names will be viewed above the
// object along with distance (in meters).

// Requirements
// --------------------------------------------------------------
// A single prim is all that is necessary for this example.



// GLOBAL VARIABLES
// --------------------------------------------------------------

float g_Range = 96.0; // The range of the sensor in meters
float g_Arc = PI; // The arc of the sensor
float g_Rate = 1.0; // The repeat rate of the sensor in seconds
vector g_TextColor = <1,1,1>; // Text color <1,1,1> = White



// EVENTS
// --------------------------------------------------------------

default
{
    state_entry()
    {
        // ------------------------------------------------------
        // This is the entry-point of the script. After a script
        // has been saved or reset, this event will fire off first
        // ------------------------------------------------------
        
        // We call llSetText() first to "clear" the text above the object
        // passing an empty string into the text parameter.
        llSetText("", g_TextColor, TRUE);
        
        // We then call the llSensorRepeat() function to start detecting
        // avatars. This function will raise the sensor() event handle
        // at a rate of g_Rate seconds.
        llSensorRepeat("", NULL_KEY, AGENT, g_Range, g_Arc, g_Rate);
        
        // Since we passed an empty string and key value to the sensor,
        // this tells the sensor that we want to look for any name with
        // any key as long as it's an AGENT, which is a fancy name for
        // Avatar. If we wanted to look for a specific person only, we
        // could simply pass their name and/or key into these arguments.
    }

    sensor(integer num_detected)
    {
        // ------------------------------------------------------
        // This event will fire off at the rate of g_Rate in seconds
        // after being called by either llSensor() or llSensorRepeat()
        // ------------------------------------------------------
        
        // First we start out by declaring a local variable "output". This
        // variable will store information we want in a string until we
        // are ready to display it at the end.
        string output;
        
        // The next variable sets up the for loop
        integer x;
        
        // This next section will loop through each one of the num_detected
        // items properly sensed (in this case, it will be AGENTS or Avatars)
        // and store the results into the output string.
        for(x = 0 ; x < num_detected ; x++)
        {
            // Using llVecDist(), we can quickly figure out the distance
            // between 2 objects in 3D space. To make it more readable, we
            // store it as an integer so it truncates any decimal placements
            integer distance = (integer)llVecDist(llGetPos(), llDetectedPos(x));
            output += llDetectedName(x) + " (" + (string)distance + "m)\n";
            
            // output += llDetectedName(x)...
            // is the same as using
            // output = output + llDetectedName(x)...
            // The "\n" at the end is an escape sequence used for llSetText()
            // to declare a new line.
        }
        
        // When we have all the information collected, we can display it
        // above the object using llSetText()
        llSetText(output, g_TextColor, TRUE);
    }
}
TagsNo tags attached.
Git Revision or version number0.7 post-fixes
Run Mode Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
Physics EngineODE
Script Engine
EnvironmentUnknown, .NET / Windows32
Mono VersionNone
Viewer
Attached Files

- Relationships

-  Notes
(0016073)
aiaustin (developer)
2010-07-15 07:26
edited on: 2010-07-15 08:00

Image is at http://www.aiai.ed.ac.uk/~ai/img/2010-07-15-avatar-radar-stuck.jpg [^]

Text of active running avatar radar objects shows 2 avatars present at wrong distances, when only one is in world and closer. It is stuck in state it was in when Opensim.exe was shutdown while avatars were still logged in.

Needs manual reset to correct this.

Note that the Opensim.exe server shutdown was a proper "shutdown" command... and the SL viewers as usual indicated the server had gone down.

(0016074)
aiaustin (developer)
2010-07-15 07:47
edited on: 2010-07-15 08:17

Ah, a newly set up object with the radar script performs fine over server shutdowns while avatars are logged in. It is just the radar objects that were in world already that seem to get stuck.

Interestingly, if I DUPLICATE the object that gets stuck, the duplicate also exihibits the stuck behaviour over server shutdowns. So it may be some sort of state of properties of the existing objects that are faulty? Were there any recent changes that could be causing this, as I assume it could affect similar scripts and not just this one.

(0016075)
Marck (reporter)
2010-07-15 09:28

The script will probably work as you expect when you add a changed event handler:

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

The root cause of the observed behaviour probably is that the llSensorRepeat is not restored with the script's state. I am not sure if it is supposed to restore such reoccuring events; llSetEventTimer() might behave similar, for example.

The above event handler will reset the script after a region has been restarted and thus restart the llSensorRepeat.
(0016077)
aiaustin (developer)
2010-07-15 10:30
edited on: 2010-07-15 10:32

Thanks Marck. And that could make it more robust I agree. Remember though that a NEW object with the same script in it actually works fine.

I believe this behaviour seems to have changed between 0.6.9 ad 0.7 post-fixes... and possibly quite recently in the 0.7 testing/fixing process? Can anyone confirm that?

By the way, I think Opensim, has still not implemented the CHANGED_REGION_START for compatibility with LL Second Life LSL scripts. I is named CHANGE_REGION_RESTART as you have noted in your fix suggestion. A compatible constant would help people to port code. See mantis 3974


- Issue History
Date Modified Username Field Change
2010-07-15 07:22 aiaustin New Issue
2010-07-15 07:22 aiaustin Git Revision => 0.7 post-fixes
2010-07-15 07:22 aiaustin SVN Revision => 13296
2010-07-15 07:22 aiaustin Run Mode => Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
2010-07-15 07:22 aiaustin Physics Engine => ODE
2010-07-15 07:22 aiaustin Environment => Unknown, .NET / Windows32
2010-07-15 07:22 aiaustin Mono Version => None
2010-07-15 07:26 aiaustin Note Added: 0016073
2010-07-15 07:26 aiaustin Reproducibility sometimes => always
2010-07-15 07:26 aiaustin Description Updated
2010-07-15 07:47 aiaustin Note Added: 0016074
2010-07-15 07:48 aiaustin Note Edited: 0016073
2010-07-15 07:48 aiaustin Note Edited: 0016074
2010-07-15 07:53 aiaustin Description Updated
2010-07-15 07:54 aiaustin Description Updated
2010-07-15 07:59 aiaustin Note Edited: 0016073
2010-07-15 08:00 aiaustin Note Edited: 0016073
2010-07-15 08:16 aiaustin Note Edited: 0016074
2010-07-15 08:17 aiaustin Note Edited: 0016074
2010-07-15 09:28 Marck Note Added: 0016075
2010-07-15 10:30 aiaustin Note Added: 0016077
2010-07-15 10:32 aiaustin Note Edited: 0016077


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker