CODE
integer display = TRUE;
vector pos;
string altitude;
string altitude_sea;
string text;
vector Euler;
integer heading;
integer afterburner;
vector velocity;
string speed;
string throttle;
vector fwd;
rotation rot;
default
{
state_entry()
{
llSetText(" ", <1.0, 1.0, 1.0>, 0.0);
afterburner = FALSE;
}
link_message(integer sender, integer num, string str, key id)
{
if (str == "start") {
state active;
} else if (str == "throttle") {
throttle = (string)num;
} else if (str == "display off") {
display = FALSE;
} else if (str == "display on") {
display = TRUE;
}
}
}
state active
{
state_entry()
{
if (display) {
llSetTimerEvent(0.5);
}
}
state_exit()
{
llSetTimerEvent(0.0);
}
on_rez(integer sparam)
{
state default;
}
timer()
{
if (display) {
pos = llGetPos() + (llGetVel() / 2.0);
pos = llGetPos();
if (afterburner) {
text = "Throttle: AFTERBURNER";
} else {
text = "Throttle: " + throttle + "%";
}
velocity = llGetVel();
speed = (string)llVecMag(velocity);
speed = llGetSubString(speed, 0, llSubStringIndex(speed, ".") + 3);
text += " - Speed: " + speed + " m/s";
rot = llGetRot();
fwd = llRot2Up(rot * llRotBetween(llRot2Fwd(rot), <0.0, 0.0, 1.0>)) * -1.0;
heading = llFloor((llAtan2(fwd.x, fwd.y) * RAD_TO_DEG) + 0.5);
if (heading < 0) {
heading += 360;
}
text += " - Heading: " + (string)heading + " degrees";
text += "\n----------";
altitude = (string)pos.z;
altitude = llGetSubString(altitude, 0, llSubStringIndex(altitude, ".") + 3);
altitude_sea = (string)(pos.z - llWater(ZERO_VECTOR));
altitude_sea = llGetSubString(altitude_sea, 0, llSubStringIndex(altitude_sea, ".") + 3);
text += "\nAltitude (abs): " + altitude + " meters";
text += "\nAltitude (sea): " + altitude_sea + " meters";
text += "\nCoordinates: " + (string)llFloor(pos.x) + ", " + (string)llFloor(pos.y) + " (" + llGetRegionName() + ")";
if(llGetAgentInfo(llGetOwner())& AGENT_MOUSELOOK) // added
{
llSetText(text + "\n ", <0.25, 0.25, 1.0>, 1.0); //added
}
} else {
llSetTimerEvent(0.0);
llSetText(" ", <0.25, 0.25, 1.0>, 0.0); //added
}
}
}
link_message(integer sender, integer num, string str, key id)
{
if (str == "stop" || str == "crash") {
state default;
} else if (str == "throttle") {
throttle = (string)num;
} else if (str == "afterburner_hud") {
afterburner = TRUE;
} else if (str == "afterburner_hud_off") {
afterburner = FALSE;
} else if (str == "display off") {
display = FALSE;
} else if (str == "display on") {
display = TRUE;
llSetTimerEvent(0.25);
}
}
}
i was also trying to wire the mouselook with display integers and had no luck
