Einzelnen Beitrag anzeigen
Alt 08.08.2007, 11:44   #4
Andragar
Inventar
 
Registriert seit: 19.04.2001
Alter: 55
Beiträge: 3.606


Andragar eine Nachricht über ICQ schicken
Standard

Hier mal ein Áuszug aus dem Script:

PHP-Code:
//---------------------------------------------------------------------------
// MODULE:  Navigation.ABL
//
// Version: 1.0
// Author:  Michael Garbers
//
// Beschreibung: 
//
// Dies ist das ABL Script zu einer Navigationsaufgabe in der Schweiz.
// 
//---------------------------------------------------------------------------

module sample;

//#debug_on
//#print_on

const
    
#include "script\lib\STDKonstants.abl";
    #include "messages\lib\tolerances.msg";

    
CheckPointCount 9;

    
SPTimeEstimated 100// Sec from start until pass SP (always the same)

    
Speed70 0;
    
Speed75 1;
    
Speed80 2;
    
Speed85 3;
    
Speed90 4;
    
Speed95 5;
    
Speed100 6;

var

    static 
number choosenSpeed;

    static 
number [CheckPointCountaLat;
    static 
number [CheckPointCountaLng;
    static 
number [CheckPointCountaLat2;
    static 
number [CheckPointCountaLng2;
    static 
number [CheckPointCountaHeading;

    static 
number [7,CheckPointCountaTimes;

    static 
number [CheckPointCountdtTimeRecord;

    
//Current Checkpoint to fly to
    
static number nCurrentCheckpoint;

    static 
number dtStartZeit

    static 
number nCountTooLow;
    static 
number nCountHeadingError;

    
// temp vars
    
static number nEntfernung;
    static 
number nRichtung;

    
string strTemp//Temp-String for Printing Messages

    
static number bTooLow;
    static 
number bBackcourse;
    
    
#include "script\lib\STDVars.abl";
    #include "script\lib\StringFns.abl";
    #include "script\lib\Math.abl";
    #include "script\lib\Messages.abl";
    #include "script\lib\Throttle.abl";
    #include "script\lib\SimQueue.abl";
    #include "script\lib\STDChkTolerances.abl";

    #include "script\lib\fnUserEvents.abl";

    

//---------------------------------------------------------------------------
// FUNCTION : init - One-time per-script init.
//
// SYNOPSIS : initializes variables
//---------------------------------------------------------------------------
function init;
var

code

    
#include "script\lib\STDInit";  

    
fnNormalMsg("So, gleich geht es los. Nach dem Start müssen Sie genau nach 100 Sekunden den SP überquert haben.");

    
//Set the target speed;
    
choosenSpeed aton(fltThisFlight.getScriptState("Speed"));
    
    
AP.Master FALSE;
    
nDoneFlag 1//set flag to indicate did not successfully complete lesson
    
bCrashCheck FALSE;

    
nCountHeadingError 0;
    
nCountTooLow 0;


    
//SP
    
aLat[0] = 47.17216667;
    
aLng[0] = 7.42116667;
    
aLat2[0] = 47.17186667;
    
aLng2[0] = 7.42136667;
:
:
:
:
    
// Setze maximale Strafpunktzahl bevor es max gibt
    
dtTimeRecord[0] = 100;
    
dtTimeRecord[1] = aTimes[choosenSpeed,1] + 152;
    
dtTimeRecord[2] = aTimes[choosenSpeed,2] + 152;
    
dtTimeRecord[3] = aTimes[choosenSpeed,3] + 152;
    
dtTimeRecord[4] = aTimes[choosenSpeed,4] + 152;
    
dtTimeRecord[5] = aTimes[choosenSpeed,5] + 152;
    
dtTimeRecord[6] = aTimes[choosenSpeed,6] + 152;
    
dtTimeRecord[7] = aTimes[choosenSpeed,7] + 152;
    
dtTimeRecord[8] = aTimes[choosenSpeed,8] + 152;

    
Writeln ("Finished with Init");

endfunction;

function 
checkGround(): NUMBER;
var
    
number nRet;
code
    nRet 
0;
    if (
nAltAGL    500then
        
if (bTooLow    == FALSEthen
            nCountTooLow 
nCountTooLow 1;
            
nRet 1;
        endif;
        
bTooLow    TRUE;
    else
        
bTooLow    FALSE;
    endif;
    return(
nRet);
endfunction;

function 
checkHeadingSoll(number nHeadingSoll): NUMBER;
var
    
number nRet;
code
    nRet 
0;

    if ((
diff360(nYaw,nHeadingSoll)) > 90then
        
if (bBackcourse    == FALSEthen
            nCountHeadingError 
nCountHeadingError 1;
            
nRet 1;
        endif;
        
bBackcourse    TRUE;
    else
        
bBackcourse    FALSE;
    endif;
    return(
nRet);
endfunction;

:
:
:

//================================================================
code

    
#include "script\lib\STDHousekeeping.abl";

    //strTemp = "Heading nach CP6: ";
    //Concat (strTemp,ntoa(posHere.BearingTo(aLat[6], aLng[6])));
    //print(strTemp);

    //strTemp = "Entfernung nach CP6: ";
    //Concat (strTemp,ntoa(posHere.DistanceTo(aLat[6], aLng[6])));
    //print(strTemp);

    
switch (nState)
        
#include "script\lib\STDCases.abl";
        
case CaseTalk1:
            
fnSQ_NormalMsg("Jetzt aber! Wir haben Startfreigabe.",0);
               
fnSQ_ChangeState(100);
            
fnSQ_Synchronize;
        
endcase;
        case 
100//Abflug, Abhebezeit
            
if (bWOW == FALSEthen
                nCountTooLow 
0;
                
nCountHeadingError 0;
                
dtStartZeit nElapsedTime// Merke Startzeit
                
nEntfernung 0.464//Setze Messradius
                
bCrashCheck TRUE//Turn Crash Check on

                
nCurrentCheckpoint 0;

                
fnSQ_NormalMsg("Ab jetzt zählts, drück auf die Stoppuhr!",0);
                   
fnSQ_ChangeState(110);
                
fnSQ_Synchronize;
            endif;
        
endcase;
        case 
110//Test bis SP
            
if (navTest(nCurrentCheckpoint) == 1then 
                    
                    strTemp 
"Wir haben den ";
                    if (
nCurrentCheckpoint == 0then
                        Concat 
(strTemp,"SP");
                    else
                        
Concat (strTemp,"CP");
                        
Concat (strTemp,ntoa(nCurrentCheckpoint));
                    endif;
                    
Concat (strTemp," erreicht, ich habe ");
                    
Concat (strTemp,ntoa(round(dtTimeRecord[nCurrentCheckpoint])));
                    
Concat (strTemp," Sekunden gemessen.");
                    
fnSQ_NormalMsg(strTemp,5);

                
nCurrentCheckpoint nCurrentCheckpoint 1;
                
nEntfernung 0.464//Setze Messradius

                
if (CheckPointCount == nCurrentCheckpointthen
                    fnSQ_ChangeState
(500);
                endif;
                
fnSQ_Synchronize;
            endif;
        
endcase;

        case 
500//End it all

                
bCrashCheck FALSE//Turn Crash Check off

                
strTemp calculateReport;

                
fnSQ_NormalMsg(strTemp,30);
                
fnSQ_ChangeState(510);
                
fnSQ_Synchronize;
        
endcase;
    endswitch;

    
fnMsgDisplay;

endmodule
Andragar ist offline   Mit Zitat antworten