LlGetObjectMass Test

From Second Life Wiki
Jump to navigation Jump to search

[LLGetObjectMassTest]

[VERSION] 0.1

[LENGTH] 00:10

[TESTERS] 1

[OVERVIEW] This test has been designed to test the llGetObjectMass lsl function.

[SETUP] Tester must be in an area where scripts are enabled.

[*]

[LLGetObjectMass Test 1]

[INV] GetObjectMassA

[INV] GetObjectMassB

[INV] GetObjectMassC

[INV] GetObjectMassD

[0010] GetObjectMassB will say the UUID of GetObjectMassB.

[0020] GetObjectMassD will say the UUID of GetObjectMassD.

[0030] Modify LLGetObjectMassScriptA to include the UUID that GetObjectMassB says.

[0040] Modify LLGetObjectMassScriptC to include the UUID that GetObjectMassD says.

[0050] Touch cube A & B, the numbers they say should match.

[0060] Stretch GetObjectMassB and touch both again. The numbers should change and still match.

[0070] Stretch GetObjectMassA and touch both again. The numbers should NOT change and still match.

[0080] Touch cube C & D, the numbers they say should match.

[0090] Stretch GetObjectMassD and touch both again. The numbers should change and still match.

[0100] Stretch GetObjectMassC and touch both again. The numbers should NOT change and still match.

[Wash, rinse, repeat]

[END]


[LLGetObjectMassScriptA]

default
{

    touch_start(integer num)
    {

        llSay(0,(string)llGetObjectMass("put ObjectB"s UUID here"));

    }

}


[LLGetObjectMassScriptB]

default
{

    state_entry()
    {

        llSay(0,(string)llGetKey());

    }
    on_rez(integer start_param)
    {

        llSay(0,(string)llGetKey());

    }

    touch_start(integer num)
    {

        float llCurrentMass = llGetMass();
        vector llSize = llGetScale();
        float llVolume = llSize.x * llSize.y * llSize.z;
        float llDensityOfB = llVolume / llCurrentMass;
        // Reporting
        // I am not doing anything special yet with prims other than cubes for deep
        // testing, other than running the same script in those other prims to verify
        // consistency in the function. Not to mention 'Hollow', etc.
        llSay(0,(string)llCurrentMass);
        llSay(0,"Scale of this object is " + (string)llSize + ".");
        llSay(0,"The x variable of this object is " + (string)llSize.x);
        llSay(0,"The y variable of this object is " + (string)llSize.y);
        llSay(0,"The z variable of this object is " + (string)llSize.z);
        llSay(0,"The Volume of this object is " + (string)llVolume);
        llSay(0,"The Density of this object is " + (string)llDensityOfB);

    }

}


[LLGetObjectMassScriptC]

default
{

    touch_start(integer num)
    {

        llSay(0,(string)llGetObjectMass("put ObjectD"s UUID here"));

    }

}


[LLGetObjectMassScriptD]

default
{

    state_entry()
    {

        llSay(0,(string)llGetKey());
        llSetBuoyancy(1);
    }
    on_rez(integer start_param)
    {

        llSay(0,(string)llGetKey());
        llSetBuoyancy(1);
    }

    touch_start(integer num)
    {
        float llCurrentMass = llGetMass();
        vector llSize = llGetScale();
        float llVolume = llSize.x * llSize.y * llSize.z;
        float llDensityOfB = llVolume / llCurrentMass;
        // Reporting
        // I am not doing anything special yet with prims other than cubes for deep
        // testing, other than running the same script in those other prims to verify
        // consistency in the function. Not to mention 'Hollow', etc.
        llSay(0,(string)llCurrentMass);
        llSay(0,"Scale of this object is " + (string)llSize + ".");
        llSay(0,"The x variable of this object is " + (string)llSize.x);
        llSay(0,"The y variable of this object is " + (string)llSize.y);
        llSay(0,"The z variable of this object is " + (string)llSize.z);
        llSay(0,"The Volume of this object is " + (string)llVolume);
        llSay(0,"The Density of this object is " + (string)llDensityOfB);

    }

}