Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007305opensim[REGION] Scripting Enginepublic2014-08-17 13:542017-11-27 02:38
ReporterLuisillo_Contepomi 
Assigned ToLuisillo_Contepomi 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformAllOSLinux WindowsOS Version8.0
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0007305: Assignment /= fail
Descriptiontarget/=source fail when compile with syntax error

Steps To ReproduceIntroduce this script in a prim as door.
Code source from http://wiki.secondlife.com/wiki/Smooth_Rotating_Door [^]


// Smooth Door Script - Version 1.2.1
// by Toy Wylie
// Distributed under the following licence:
// - You can use it in your own works
// - You can sell it with your work
// - This script must remain full permissions
// - This header notice must remain intact
// - You may modify this script as needed
 
float openingTime=3.0; // in seconds
float openingAngle=90.0; // in degrees
float autocloseTime=15.0; // in seconds
integer steps=4; // number of internal rotation steps
integer world=TRUE; // align to world or root prim rotation
 
string soundOpen="door_open";
string soundClose="door_close";
string soundClosing="door_closing";
 
float omega=0.0;
 
vector axis;
rotation closedRot;
rotation openRot;
 
integer swinging;
integer open;
 
sound(string name)
{
    if(llGetInventoryType(name)==INVENTORY_SOUND)
        llTriggerSound(name,1.0);
}
 
openDoor(integer yes)
{
    if(yes)
        sound(soundOpen);
    else
        sound(soundClosing);
 
    vector useAxis=axis;
    open=yes;
 
    if(!yes)
        useAxis=-axis;
 
    llSetTimerEvent(openingTime/(float) steps);
    llTargetOmega(useAxis,omega,1.0);
}
 
go()
{
    if(swinging==0)
    {
        if(!open)
        {
            axis=<0.0,0.0,1.0>/llGetRootRotation();
 
            closedRot=llGetLocalRot();
 
            if(world)
                openRot=llGetRot()*llEuler2Rot(<0.0,0.0,openingAngle>*DEG_TO_RAD)/llGetRootRotation();
            else
                openRot=closedRot*llEuler2Rot(<0.0,0.0,openingAngle>*DEG_TO_RAD);
        }
        swinging=steps;
        openDoor(!open);
    }
}
 
rotation slerp(rotation source,rotation target,float amount)
{
   return llAxisAngle2Rot(llRot2Axis(target/=source),amount*llRot2Angle(target))*source;
}
 
default
{
    state_entry()
    {
        swinging=0;
        open=FALSE;
        omega=TWO_PI/360*openingAngle/openingTime;
        llTargetOmega(ZERO_VECTOR,1.0,1.0);
    }
 
    touch_start(integer dummy)
    {
        go();
    }
 
    collision_start(integer dummy)
    {
        go();
    }
 
    timer()
    {
        if(swinging>0)
        {
            swinging--;
            if(swinging!=0)
            {
                float amount=(float) swinging/(float) steps;
                if(open)
                    amount=1.0-amount;
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,slerp(closedRot,openRot,amount)]);
                return;
            }
 
            llTargetOmega(axis,0.0,0.0);
            if(open)
            {
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,openRot]);
                llSetTimerEvent(autocloseTime);
            }
            else
            {
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,closedRot]);
                sound(soundClose);
                llSetTimerEvent(0.0);
            }
        }
        else // autoclose time reached
        {
            llSetTimerEvent(0.0);
            openDoor(!open);
            swinging=steps;
        }
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineBulletSim
EnvironmentMono / Linux64
Mono Version3.1
Viewer
Attached Files

- Relationships

-  Notes
(0026850)
Luisillo_Contepomi (reporter)
2014-09-21 06:13

Please can somebody confirm this?
(0026854)
Mata Hari (reporter)
2014-09-21 11:21

Yes, fails when I test it.

I don't see any reason at all for that command though since there's no need to store an updated value for target.

In Opensim it generally doesn't like assigments inside of other calculations so if you really wanted to do it I guess you could change that section to:

rotation slerp(rotation source,rotation target,float amount)
{
    target/=source;
   return llAxisAngle2Rot(llRot2Axis(target),amount*llRot2Angle(target))*source;
}

But since target isn't being used at all beyond this it's simpler just to do:

rotation slerp(rotation source,rotation target,float amount)
{
   return llAxisAngle2Rot(llRot2Axis(target/source),amount*llRot2Angle(target))*source;
}

Both of those compile and work perfectly
(0026870)
Luisillo_Contepomi (reporter)
2014-09-30 10:28

Thank you Mata!
(0032463)
Luisillo_Contepomi (reporter)
2017-11-27 02:37

Is not a bug.

- Issue History
Date Modified Username Field Change
2014-08-17 13:54 Luisillo_Contepomi New Issue
2014-08-17 13:56 Luisillo_Contepomi Steps to Reproduce Updated View Revisions
2014-09-21 06:13 Luisillo_Contepomi Note Added: 0026850
2014-09-21 11:21 Mata Hari Note Added: 0026854
2014-09-30 10:28 Luisillo_Contepomi Note Added: 0026870
2017-11-27 02:37 Luisillo_Contepomi Note Added: 0032463
2017-11-27 02:37 Luisillo_Contepomi Status new => resolved
2017-11-27 02:37 Luisillo_Contepomi Resolution open => fixed
2017-11-27 02:37 Luisillo_Contepomi Assigned To => Luisillo_Contepomi


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker