The FDR script

## **FDR**

**It is quite simple, and is activated each time our vehicle (airplane, boat, car, train ...) crosses a region, giving a predetermined information, although it can be increased according to our interests.**

**The effect is that of a black box, similar to that of airplanes and other vehicles, being complemented with the data recorded in the chat itself (which can be copied and pasted into a note for later study).**

**In my case, I am interested in searching for simple flight routes, although on many occasions I find security orbs, which the owners put just for annoyances, since with a margin of fifteen seconds to get us expelled from a parcel is enough , But they activate it to activate the instant expulsion.**

**In the case of the ban lines, you can define a plot, in its outline, and a maximum altitude of 100 meters, but there are owners that activate it up to the maximum height (4000 meters).**

**Well, here I leave the script, and just indicate that it has to be put inside the vehicle, in the scripts area and in the root prim (if your vehicle is protected, you have to ask the manufacturer to put it on. If you like test first, only need put it into an object, attach to your hand, and cross some regions for see how function.**

**The meaning of the initials you can see in the reports is as follows:**

**T: TIME (SL Time or Pacific Time)**

**R: REGION (the region name)**

**S: SPEED (m/s)**

**A: ALTITUDE (m)**

**H: HEADING (compass degrees)**

**S: SLOPE (inclination from +70º to -70º)**

## **The Script**

       **string ConvertWallclockToTime()**

       **{**

    **integer now = (integer)llGetWallclock();**

    **integer seconds = now % 60;**

    **integer minutes = (now / 60) % 60;**

    **integer hours = now / 3600;**

    **return llGetSubString("0" + (string)hours, -2, -1) + ":"**

    **+ llGetSubString("0" + (string)minutes, -2, -1) + ":"**

    **+ llGetSubString("0" + (string)seconds, -2, -1);**

    **}**

    **default**

    **{**

    **changed(integer change)**

    **{**

    **vector pos = llGetPos();**

    **float Z = pos.z;**

        **list Details = llGetObjectDetails(llGetOwner(), [OBJECT\_POS]);**

        **vector OwnerPos = llList2Vector(Details, 0);**

        **float Distance = llVecDist (pos, OwnerPos);**

        **float time = llGetWallclock();**

        **vector Speed = llGetVel();**

        **float RealSpeed = llVecMag(Speed);**

        **//compass**

        **rotation currRot=llGetRot();**

        **vector currEuler=llRot2Euler(currRot);**

        **float zRotAngle=currEuler.z;**

        **float heading=PI\_BY\_TWO-zRotAngle;**

        **while (heading<0) heading+=TWO\_PI;**

        **heading=heading\*RAD\_TO\_DEG;**

        **integer evenHeading = llRound(heading);**

        **//pitch**

        **float xRotAngle=currEuler.x;**

        **float picht=PI\_BY\_TWO-xRotAngle;**

        **while (picht<0) picht+=TWO\_PI;**

        **picht=picht\*RAD\_TO\_DEG;**

        **integer evenPicht = 90 - llRound(picht);**

        **//roll**

        **float yRotAngle=currEuler.y;**

        **float roll=PI\_BY\_TWO-yRotAngle;**

        **while (roll<0) roll+=TWO\_PI;**

        **roll=roll\*RAD\_TO\_DEG;**

        **integer evenRoll = 90-llRound(roll);**

        **if (evenHeading >= 316 && evenHeading <= 44)**

        **{**

        **evenPicht = evenPicht;**

        **}**

        **if (evenHeading >= 45 && evenHeading <= 135)**

        **{**

        **evenPicht = - evenRoll;**

        **}**

        **if (evenHeading >= 136 && evenHeading <= 220)**

        **{**

        **evenPicht = - evenPicht;**

        **}**

        **if (evenHeading >= 221 && evenHeading <= 315)**

        **{**

        **evenPicht = evenRoll;**

        **}**

    **if (change & CHANGED\_REGION)**

     **{**

     **llOwnerSay("Flight Data Recorder (FDR)"+"/T:"+(string)ConvertWallclockToTime()+"/R:"+(string) llGetRegionName()+"/S:"+(string) llRound (RealSpeed)+"/A:"+(string)llRound (Z)+"/H:"+(string) llRound (heading)+"/S:"+(string) evenPicht);**

    **}}}**