User Tools

Site Tools


Sidebar

 

anhelo

Club Audio Technics

(no brand)

furniture

others

en:docs:landing_helper_hud

FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

Landing Helper HUD

Landing Helper HUD

概要

 飛行場のデータを持ち歩けないかという発想から、自分用につくった HUD です。スクリプトを含めフルパーミッションで配布しています。よろしければお使いください。

主な機能

  • ノートカード編集による飛行場データの整理と、その情報の呼出
  • 複数ノートカード対応(例 » 大陸ごとに整理 など)
  • 高度計 / コンパス機能内蔵
  • HUD 上には以下の情報を表示
    • 滑走路の標高
    • 滑走路の向き
    • 着陸可能な飛行機の種類

※ 飛行場データはサンプル程度にしか入っていません。ご自身で加筆修正してください。

ソースコード

LSL

landing-helper.lsl
// ==================================================================================================
//                                 Landing Helper LSL ver.1.1.33
// ==================================================================================================
// Copyright (c) 2015, fk0724 Resident
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
// provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions
// and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials provided with
// the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ==================================================================================================
// -------------------------------------------------------------------------------- Customize Setting
list HUDColors = [  <0.31, 0.28, 0.28>          // <= Say "hudcolor 0" at command line
                ,   <1.00, 0.00, 0.50>          // <= Say "hudcolor 1" at command line
                ,   <0.00, 1.00, 1.00>          // <= Say "hudcolor 2" at command line
                ,   <1.00, 0.50, 0.00>          // <= Say "hudcolor 3" at command line
                ,   <0.00, 0.50, 0.50>          // <= Say "hudcolor 4" at command line
                ,   <0.00, 0.00, 0.00>          // <= Say "hudcolor 5" at command line
];
 
vector TextInitColor = <1.0, 1.0, 0.0>;         // <= floating text color when HUD is InitMode
vector TextErrorColor = <1.0, 0.0, 0.0>;        // <= floating text color when HUD has Error
float TextAlpha = 1.0;                          // <= floating text alpha
 
integer Debug = FALSE;                          // turn TRUE when use in DebugMode
 
// --------------------------------------------------------------------------------------------- Init
string MyName = "Landing Helper HUD";
string Version = "ver.1.1.33";
key QueryID;
key OwnerID;
 
uuInit(){
    llSetObjectName(MyName + " " + Version);
    uuDoCommand("hudcolor", "0");
    llSetText("Welcome !", TextColor, TextAlpha);
    uuSetNotecardNum();
    uuSetNotecardMaxPage();
    uuDebug("NotecardNum : " + (string)NotecardNum);
    OwnerID = llGetOwner();
    uuSetLinkNumber();
    uuChangeDisplay();
    if (NotecardNum){
        uuSetNotecards();
        CurrentNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
        uuReadLine(TRUE);
    }else{
        llSetText("ERROR : Notecard not found", TextErrorColor, TextAlpha);
    }
}
 
// -------------------------------------------------------------------------------------------- Debug
uuDebug(string str){
    if (Debug){
        llOwnerSay("[DEBUG] " + str);
    }
}
 
// ----------------------------------------------------------------------------------------- Notecard
integer NotecardNum;
list Notecards;
 
uuSetNotecardNum(){
    NotecardNum = llGetInventoryNumber(INVENTORY_NOTECARD);
}
 
uuSetNotecards(){
    Notecards = [];
    integer i;
    for (i=0; i<NotecardNum; i++){
        Notecards += [llGetInventoryName(INVENTORY_NOTECARD, i)];
    }
}
 
uuChangeNotecard(string name){
    CurrentNotecardName = name;
    uuReadLine(TRUE);
}
 
// ------------------------------------------------------------------------------------- Current Data
integer Current;
integer NotecardLine;
integer CurrentDataNum;
string CurrentNotecardName;
list CurrentAirportCodes;
list CurrentRegionNames;
list CurrentButtons;
list CurrentVectors;
list CurrentTaxiwayDists;
list CurrentTaxiwayAltFeets;
list CurrentTaxiwayAltMeters;
list CurrentEnables;
 
uuSetCurrent(){
    Current = llListFindList(Notecards, [CurrentNotecardName]);
}
 
uuReadLine(integer reset){
    if (reset){
        uuDataClear();
    }else{
        NotecardLine ++;
    }
    QueryID = llGetNotecardLine(CurrentNotecardName, NotecardLine);
}
 
uuDataClear(){
    NotecardLine = 0;
    AirportPage = 0;
    CurrentDataNum = 0;
    CurrentAirportCodes = [];
    CurrentRegionNames = [];
    CurrentButtons = [];
    CurrentVectors = [];
    CurrentTaxiwayDists = [];
    CurrentTaxiwayAltFeets = [];
    CurrentTaxiwayAltMeters = [];
    CurrentEnables = [];
}
 
uuPushData(string csv){
    list temp_list = llCSV2List(csv);
    CurrentAirportCodes += [llList2String(temp_list, 0)];
    CurrentTaxiwayDists += [llList2String(temp_list, 1)];
    CurrentButtons += [llList2String(temp_list, 0) + " :: " + llList2String(temp_list, 1)];
    list slurl_parse = llParseString2List(llList2String(temp_list, 2), ["/"], []);
    if (Debug){
        integer i;
        integer end = llGetListLength(slurl_parse);
        for (i=0; i<end; i++){
            uuDebug("slurl_parse(" + (string)i + ") => " + llList2String(slurl_parse, i));
        }
    }
    CurrentRegionNames += [llUnescapeURL(llList2String(slurl_parse, 3))];
    integer x = (integer)llList2String(slurl_parse, 4);
    integer y = (integer)llList2String(slurl_parse, 5);
    integer z = (integer)llList2String(slurl_parse, 6);
    CurrentVectors += [<x, y, z>];
    CurrentTaxiwayAltMeters += [(z - 20)];
    CurrentTaxiwayAltFeets += [(integer)((z - 20) * 3.2808)];
    integer temp_enable = (integer)llList2String(temp_list, 3);
    temp_enable += (integer)llList2String(temp_list, 4) * 2;
    temp_enable += (integer)llList2String(temp_list, 5) * 4;
    temp_enable += (integer)llList2String(temp_list, 6) * 8;
    temp_enable += (integer)llList2String(temp_list, 7) * 16;
    CurrentEnables += [temp_enable];
    CurrentDataNum ++;
    string text = "--- " + CurrentNotecardName + " ---\n" + (string)CurrentDataNum;
    text += " data(s) found\n Please wait...";
    llSetText(text, TextInitColor, TextAlpha);
}
 
// ----------------------------------------------------------------------------------- Target Airport
integer Target;
vector TextColor = <0.31, 0.28, 0.28>;
 
string TargetAirportCode(){
    return llList2String(CurrentAirportCodes, Target);
}
 
string TargetTaxiwayDist(){
    return llList2String(CurrentTaxiwayDists, Target);
}
 
string TargetRegionName(){
    return llList2String(CurrentRegionNames, Target);
}
 
vector TargetVector(){
    return llList2Vector(CurrentVectors, Target);
}
 
integer TargetTaxiwayAltMeter(){
    return llList2Integer(CurrentTaxiwayAltMeters, Target);
}
 
integer TargetTaxiwayAltFeet(){
    return llList2Integer(CurrentTaxiwayAltFeets, Target);
}
 
integer TargetEnable(){
    return llList2Integer(CurrentEnables, Target);
}
 
integer Button2Target(string button){
    return llListFindList(CurrentButtons, [button]);
}
 
uuSetTarget(string target){
    Target = Button2Target(target);
    LastText = "--- " + TargetAirportCode() + " :: " + TargetTaxiwayDist();
    LastText += " ---\n alt. " + (string)TargetTaxiwayAltFeet() + "ft (";
    LastText += (string)TargetTaxiwayAltMeter() + "m)";
    llSetText(LastText, TextColor, TextAlpha);
    uuChangeDisplay();
    uuDebug("RegionName : " + TargetRegionName());
    uuDebug("Vector : " + (string)TargetVector());
    llMapDestination(TargetRegionName(), TargetVector(), ZERO_VECTOR);
}   
 
// ----------------------------------------------------------------------------------------------- UI
integer Channel = -278;
integer Handle;
integer AirportPage;
integer AirportMaxPage;
integer NotecardPage;
integer NotecardMaxPage;
integer IsMain;
string LastText;
 
uuListen(integer sw){
    if (sw){
        Handle = llListen(Channel, "", "", "");
        llSetTimerEvent(60.0);
    }else{
        llSetTimerEvent(0.0);
        llListenRemove(Handle);
    }
}
 
uuMainDialog(){
    IsMain = TRUE;
    uuListen(TRUE);
    llDialog(OwnerID, CurrentNotecardName, AirportButtons(), Channel);
}
 
uuNotecardDialog(){
    IsMain = FALSE;
    uuSetNotecardNum();
    uuSetNotecards();
    uuListen(TRUE);
    llDialog(OwnerID, "Choose Notecard", NotecardButtons(), Channel);
}
 
list AirportButtons(){
    list buttons;
    if (AirportPage > AirportMaxPage){
        AirportPage = 0;
    }else if (AirportPage < 0){
        AirportPage = AirportMaxPage;
    }
    integer start = AirportPage * 9;
    integer end = start + 8;
    if (AirportMaxPage){
        buttons = ["<<", "Change", ">>"];
    }else{
        buttons = [" ", "Change", "  "];
    }
    buttons += llList2List(CurrentButtons, start, end);
    return buttons;
}
 
list NotecardButtons(){
    list buttons;
    if (NotecardPage > NotecardMaxPage){
        NotecardPage = 0;
    }else if (NotecardPage < 0){
        NotecardPage = NotecardMaxPage;
    }
    integer start = NotecardPage * 9;
    integer end = start + 8;
    if (NotecardMaxPage){
        buttons = [" << ", "Back", " >> "];
    }else{
        buttons = [" ", "Back", "  "];
    }
    buttons += llList2List(Notecards, start, end);
    return buttons;
}
 
uuSetAirportMaxPage(){
    AirportMaxPage = (integer)((CurrentDataNum - 1) / 9);
}
 
uuSetNotecardMaxPage(){
    NotecardMaxPage = (integer)((NotecardNum - 1) / 9);
}
 
uuDoCommand(string command, string option){
    if (command == "hudcolor"){
        vector new_color = llList2Vector(HUDColors, (integer)option);
        llSetLinkColor(LINK_SET, new_color, ALL_SIDES);
        llMessageLinked(LINK_SET, 15, (string)new_color, NULL_KEY);
        TextColor = new_color;
        llSetText(LastText, TextColor, TextAlpha);
    }
}
 
// --------------------------------------------------------------------------------------------- Icon
integer JetNum;
integer FighterNum;
integer ReciproNum;
integer HeliNum;
integer BoatNum;
 
integer IsJet = 1;
integer IsFighter = 2;
integer IsRecipro = 4;
integer IsHeli = 8;
integer IsBoat = 16;
 
uuSetLinkNumber(){
    integer i;
    integer end = llGetNumberOfPrims() + 1;
    string temp;
    for (i=0; i<end; i++){
        temp = llGetLinkName(i);
        if (temp == "jet"){
            JetNum = i;
        }else if (temp == "fighter"){
            FighterNum = i;
        }else if (temp == "recipro"){
            ReciproNum = i;
        }else if (temp == "heli"){
            HeliNum = i;
        }else if (temp == "boat"){
            BoatNum = i;
        }
    }
}
 
uuChangeDisplay(){
    integer flug = TargetEnable();
    llSetLinkAlpha(JetNum, (float)(flug & IsJet), ALL_SIDES);
    llSetLinkAlpha(FighterNum, (float)(flug & IsFighter), ALL_SIDES);
    llSetLinkAlpha(ReciproNum, (float)(flug & IsRecipro), ALL_SIDES);
    llSetLinkAlpha(HeliNum, (float)(flug & IsHeli), ALL_SIDES);
    llSetLinkAlpha(BoatNum, (float)(flug & IsBoat), ALL_SIDES);
}
 
// ------------------------------------------------------------------------------------------ Default
default{
    state_entry(){
        uuInit();
    }
 
    dataserver(key queryid, string data){
        if (queryid == QueryID){
            string head = llGetSubString(data, 0, 0);
            if (data != EOF){
                if (head != "#" && data != ""){
                    uuPushData(data);
                }
                uuReadLine(FALSE);
            }else{
                uuSetAirportMaxPage();
                LastText = "--- " + CurrentNotecardName + " ---\n" + (string)CurrentDataNum;
                LastText += " data(s) found\n Set Complete !";
                llSetText(LastText, TextColor, TextAlpha);
                uuMainDialog();
                llListen(0, "", OwnerID, "");
            }
        }
    }
 
    changed(integer change){
        if (change & CHANGED_OWNER){
            llResetScript();
        }
    }
 
    touch_start(integer total_number){
        uuMainDialog();
    }
 
    timer(){
        uuListen(FALSE);
    }
 
    listen(integer channel, string name, key id, string message){
        if (channel == 0){
            list temp = llParseString2List(message, [" "], []);
            uuDoCommand(llList2String(temp, 0), llList2String(temp, 1));
        }else{
            uuListen(FALSE);
            if (message == "<<"){
                AirportPage -= 1;
                uuMainDialog();
            }else if (message == ">>"){
                AirportPage += 1;
                uuMainDialog();
            }else if (message == " << "){
                NotecardPage -= 1;
                uuNotecardDialog();
            }else if (message == " >> "){
                NotecardPage += 1;
                uuNotecardDialog();
            }else if (message == "Back"){
                uuMainDialog();
            }else if (message == "Change"){
                uuNotecardDialog();
            }else if (llGetSubString(message, 0, 0) != " "){
                if (IsMain){
                    uuSetTarget(message);
                }else{
                    uuChangeNotecard(message);
                }
            }
        }
    }
}
compass.lsl
default{
    state_entry(){
        llSetTimerEvent(0.2);
    }
 
    timer(){
        rotation rot = llGetRootRotation();
        vector rotv = llRot2Euler(rot) * RAD_TO_DEG;
        llSetLocalRot(llEuler2Rot(<rotv.z - 90, 0.0, 0.0> * DEG_TO_RAD));
    }
}
altimeter.lsl
vector TextColor;
 
default{
    state_entry(){
        llSetTimerEvent(0.2);
    }
 
    timer(){
        vector pos = llGetPos();
        integer alt = (integer)((pos.z - 20) * 3.2808);
        llSetText((string)alt, TextColor, 1.0);
    }
 
    link_message(integer sender_num, integer num, string str, key id){
        if (num == 15){
            TextColor = (vector)str;
        }
    }
}

Notecard

SAMPLE
# ==================================================================
#            SAMPLE notecard for Landing Helper HUD v.1.1.xx
# ==================================================================
#
# ------------------------------------------------ Formatting Syntax
# <AC>, <DT>, <SLURL>, <EJ>, <EF>, <ER>, <EH>, <EF>
#                    ( Commas are reqired between paragraphs )
#
# * <AC> ... Airport Code (3 or 4 letters)
# * <DT> ... Direction of the taxiway
# * <SLURL> ... SLURL of the landing point
# * <EJ>... Enable Jet flug (1 : enable / 0 : disable)
# * <EF> ... Enable Fighter flug
# * <ER> ... Enable Reciprocating flug
# * <EH> ... Enable Helicopter flug
# * <EF> ... Enable Float flug
#
# ------------------------------------------------------------- Tips
# * The lines biginnning <#> and blank lines will be ignored
# * You can put multiple notecards into HUD !
#      ex) categorizing by continent
#
# ---------------------------------------------- For our firmament !
 
HLWD, TP, http://maps.secondlife.com/secondlife/Santa%20Catalina/136/253/22, 0, 0, 0, 0, 0
HLWD, 18L, http://maps.secondlife.com/secondlife/Santa%20Catalina/111/58/22, 1, 1, 1, 0, 0
HLWD, HP, http://maps.secondlife.com/secondlife/Santa%20Catalina/52/246/22, 0, 0, 0, 1, 0
HLWD, FL, http://maps.secondlife.com/secondlife/Santa%20Catalina/23/18/22, 0, 0, 0, 0, 1
 
SIA, TP, http://maps.secondlife.com/secondlife/GrandAnse%20Mahe%20Isle/127/179/29, 0, 0, 0, 0, 0
SIA, 09, http://maps.secondlife.com/secondlife/GrandAnse%20Mahe%20Isle/68/127/28, 1, 1, 1, 0, 0
SIA, FL, http://maps.secondlife.com/secondlife/Bancs%20Ferrari%20Isle/102/20/22, 0, 0, 0, 0, 1
 
SLBF, TP, http://maps.secondlife.com/secondlife/Courage/121/168/45, 0, 0, 0, 0, 0
SLBF, AR, http://maps.secondlife.com/secondlife/Courage/126/191/1201, 0, 0, 0, 0, 0
SLBF, 18L, http://maps.secondlife.com/secondlife/Courage/205/222/33, 1, 1, 1, 0, 0
SLBF, HP, http://maps.secondlife.com/secondlife/Courage/120/75/33, 0, 0, 0, 1, 0
SLBF, FL, http://maps.secondlife.com/secondlife/Courage/216/248/22, 0, 0, 0, 0, 1
 
SLCS, TP, http://maps.secondlife.com/secondlife/Venrigalli/69/57/86, 0, 0, 0, 0, 0
SLCS, 09R, http://maps.secondlife.com/secondlife/Venrigalli/35/194/86, 1, 1, 1, 0, 0
SLCS, 27R, http://maps.secondlife.com/secondlife/Venrigalli/222/226/86, 1, 1, 1, 0, 0
SLCS, HP, http://maps.secondlife.com/secondlife/Venrigalli/150/152/100, 0, 0, 0, 1, 0
SLCS, FL, http://maps.secondlife.com/secondlife/Venrigalli/250/208/22, 0, 0, 0, 0, 1
 
SLFF, TP, http://maps.secondlife.com/secondlife/Hyojong/46/118/47, 0, 0, 0, 0, 0
SLFF, 09, http://maps.secondlife.com/secondlife/Hyojong/24/187/47, 1, 1, 1, 0, 0
 
SLIA, TP, http://maps.secondlife.com/secondlife/Antilaghi/130/198/87, 0, 0, 0, 0, 0
SLIA, 27, http://maps.secondlife.com/secondlife/Antilaghi/236/14/87, 1, 1, 1, 0, 0
SLIA, HP, http://maps.secondlife.com/secondlife/Antilaghi/10/247/91, 0, 0, 0, 1, 0
SLIA, FL, http://maps.secondlife.com/secondlife/Antilaghi/97/18/22, 0, 0, 0, 0, 1
 
SLJA, TP, http://maps.secondlife.com/secondlife/Juneau%20South/180/84/32, 0, 0, 0, 0, 0
SLJA, 14, http://maps.secondlife.com/secondlife/Juneau%20South/140/232/32, 1, 1, 1, 0, 1
 
SLQA, TP, http://maps.secondlife.com/secondlife/Skynx/27/115/23, 0, 0, 0, 0, 0
SLQA, 27, http://maps.secondlife.com/secondlife/Skynx/14/233/23, 0, 1, 1, 0, 0
SLQA, 36, http://maps.secondlife.com/secondlife/Skynx/50/14/23, 0, 1, 1, 0, 0
 
SNO, TP, http://maps.secondlife.com/secondlife/SNO%20Terminal%20A/109/30/31, 0, 0, 0, 0, 0
SNO, 09R, http://maps.secondlife.com/secondlife/Vestnes/204/128/31, 1, 1, 1, 1, 1
 
SLTS, TP, http://maps.secondlife.com/secondlife/Tsurington/22/174/46, 0, 0, 0, 0, 0
SLTS, 28, http://maps.secondlife.com/secondlife/Tsurington/245/199/40, 0, 0, 1, 0, 0
 
SLWS, TP, http://maps.secondlife.com/secondlife/Jadu/18/188/31, 0, 0, 0, 0, 0
SLWB, 07, http://maps.secondlife.com/secondlife/Jadu/11/75/31, 0, 0, 1, 0, 0
SLWB, 09, http://maps.secondlife.com/secondlife/Jadu/21/113/31, 1, 1, 1, 0, 0
SLWB, FL, http://maps.secondlife.com/secondlife/Jadu/205/235/22, 0, 0, 0, 0, 1
en/docs/landing_helper_hud.txt · Last modified: 2015/05/11 03:33 by fk0724