Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007835opensim[REGION] OpenSim Corepublic2016-03-05 19:572016-03-06 04:16
Reportercuteulala 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOpensim 0.9OSWin 10OS Version
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0007835: This Script lags the entire script engine to a crawl if used offten as i use the organ i built
DescriptionThis function lags the listeners and other scripts to a noticeable amount it causes my pipe organ to be much slower in responsiveness

turnPitch(float angle)
{
    llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, llEuler2Rot(<0,-angle * DEG_TO_RAD,0>)*llGetRot()]);
}
        
default
{
    state_entry()
    {
          llListen(12121211, "", "", "");

    }
    listen(integer channel, string name, key id, string msg) {
        if (msg == "52") {
          turnPitch(20);
        llSleep(0.3);
          turnPitch(-20);
        }
    }
}
Steps To Reproduceunknown i just notice it slows scripts down and reaction times for trigger sound and such
TagsNo tags attached.
Git Revision or version number
Run ModeStandalone (1 Region)
Physics EngineOther
Script Engine
EnvironmentMono / Windows
Mono VersionNone
Viewer
Attached Files

- Relationships

-  Notes
(0030063)
Mata Hari (reporter)
2016-03-05 20:37

What happens if you use a timer instead of the llSleep?

turnPitch(float angle)
{
    llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, llEuler2Rot(<0,-angle * DEG_TO_RAD,0>)*llGetRot()]);
}
        
default
{
    state_entry()
    {
        llListen(12121211, "", "", "");

    }
    listen(integer channel, string name, key id, string msg) {
        if (msg == "52") {
            turnPitch(20);
            llSetTimerEvent(0.3);
        }
    }
    timer()
    {
        llSetTimerEvent(0.0};
        turnPitch(-20);
    }
}
(0030064)
cuteulala (reporter)
2016-03-05 20:45

That works faster but it has a weird failure rate where if requested to fast the object will spin twice in one direction before getting a chance to return back to previous pos
(0030065)
JeffKelley (reporter)
2016-03-06 00:22
edited on: 2016-03-06 00:26

The object spins twice in one direction because the second listen() is received before the first timer() had fired. If you did not change MinTimerInterval in OpenSim.ini, the 0.5s default applies. If you did change MinTimerInterval, don't expect accurate, jitterless timing under 0.5s.

(0030066)
Mata Hari (reporter)
2016-03-06 04:16

What it suggests, though, is that the likely cause for the XEngine lag you're reporting is you're consuming all available threads (I assume you have 1 of these scripts active per key on a 100+ key organ, and are calling multiples of it on a regular basis. That's a ton of work for the available XEngine threads (not to mention 100+ global listeners) in addition to anything else that's running on the same simulator.

If you're likely to call this same key in a shorter period of time just add a flag to prevent it from moving if it's already in the moved position. Also, as Jeff says, you need the min timer value in [XEngine] to be set to a small enough value. I've found times down to around 0.2 seem fairly reliable and the minimum value it can take (that's meaningful) is 0.08 which is the frame resolution.

Revised script version to prevent double-moving the key (and also make it a little easier if you later want to tweak it):

float angle=20.0;
integer isDepressed;
float depressTime=0.3;

turnPitch()
{
    llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, llEuler2Rot(<0,-angle * DEG_TO_RAD,0>)*llGetRot()]);
    isDepressed=!isDepressed;
    angle*=-1;
}
        
default
{
    state_entry()
    {
        isDepressed=FALSE;
        llListen(12121211, "", "", "");

    }
    listen(integer channel, string name, key id, string msg) {
        if (msg == "52") {
            if (isDepressed) return;
            turnPitch();
            llSetTimerEvent(depressTime);
        }
    }
    timer()
    {
        llSetTimerEvent(0.0};
        turnPitch();
    }
}

- Issue History
Date Modified Username Field Change
2016-03-05 19:57 cuteulala New Issue
2016-03-05 20:01 cuteulala Priority high => normal
2016-03-05 20:37 Mata Hari Note Added: 0030063
2016-03-05 20:45 cuteulala Note Added: 0030064
2016-03-06 00:22 JeffKelley Note Added: 0030065
2016-03-06 00:26 JeffKelley Note Edited: 0030065 View Revisions
2016-03-06 00:26 JeffKelley Note Edited: 0030065 View Revisions
2016-03-06 04:16 Mata Hari Note Added: 0030066


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker