Bardzo proszę o przejrzenie mojego skryptu obsługującego panel mcp. Pojawia się dziwny problem. Jeśli ruszę któryś z przycisków na wirtualnym panelu (myszą na przykład), lub jeśli zostanie on automatycznie przełączony (np. kiedy wyłączam autothrottle to automatycznie wyłącza się też Hold speed), to HSC nie potrafi ponownie wysłać rozkazu z mojego kopitu (z mjoya).
Pojawia się błąd: # FSDataOutput : Błąd (10) podczas wysyłania wartości do symulatora.
Tak jakby HSC nie potrafił nadpisać zmiennej, która posiada już taką samą wartość. Ale piszę "jakby" bo wydaje mi się, że mój skrypt zabezpiecza przed taką sytuacją.
variable_changed $MJ16_przycisk_006
{
Log( "Hold Heading:" );
Log( $HdgHoldStatus );
if ( $MJ16_przycisk_006 == true )
{
if ( $HdgHoldStatus == 0 )
{
SetWithSignal( $controlHdgHold , 1);
}
else
{
SetWithSignal( $controlHdgHold , 0);
}
}
}
Czyli, jeśli HOLD HDG jest włączony, to wyłącz, jeśli nie to włącz... Nie powinno być więc problemów. Czyżby HSC nie było na bieżąco z danymi z symulatora? Powinienem w jakiś sposób pobierać wartość zmiennej przed wysłaniem rozkazu? Sam nie wiem. Jeśli "aktywuję" przycisk na wirtualnym panelu - tzn. włączę i wyłączę, to dalej skrypt działa jak należy...
Poniżej cały skrypt - niestety nie mogę dodać załącznika, bo forum nie przyjmuje.
// skrypt symulujący panel mcp
// 8.10.2010
// mcd(at)interia.eu
script "FS - cockpit"
{
// zmienne tekstu wyświetlanego na wyświetlaczu
// zmienna przechowująca ustawienie świateł landing lights
variable $i
{
type = int;
}
variable $testowa_line_1
{
module = "TestModule";
id = "out:string_00";
type = string;
direct = out;
}
variable $LandLights
{
module = "FSDataInput";
id = "028C";
type = int;
direct = in;
}
variable $AutopilotMasterStatus
{
module = "FSDataInput";
id = "07BC";
type = int;
direct = in;
}
variable $AutoThrottleStatus
{
module = "FSDataInput";
id = "0810";
type = int;
direct = in;
}
variable $AltHoldStatus
{
module = "FSDataInput";
id = "07D0";
type = int;
direct = in;
}
variable $AltValue
{
module = "FSDataInput";
id = "07D4";
type = int;
direct = in;
}
variable $HdgHoldStatus
{
module = "FSDataInput";
id = "07C8";
type = int;
direct = in;
}
variable $HdgValue
{
module = "FSDataInput";
id = "07CC";
type = int;
direct = in;
}
variable $FDStatus
{
module = "FSDataInput";
id = "2EE0";
type = int;
direct = in;
}
variable $AirSpeedHoldStatus
{
module = "FSDataInput";
id = "07DC";
type = int;
direct = in;
}
// zmienna do której zapisujemy rozkazy dla symulatora
variable $controlAutopilotMaster
{
module = "FSDataOutput";
id = "07BC";
type = int;
direct = out;
}
variable $controlAutoThrottle
{
module = "FSDataOutput";
id = "0810";
type = int;
direct = out;
}
variable $controlAltHold
{
module = "FSDataOutput";
id = "07D0";
type = int;
direct = out;
}
variable $controlAltValue
{
module = "FSDataOutput";
id = "07D4";
type = int;
direct = out;
}
variable $controlHdgHold
{
module = "FSDataOutput";
id = "07C8";
type = int;
direct = out;
}
variable $controlHdgValue
{
module = "FSDataOutput";
id = "07CC";
type = int;
direct = out;
}
variable $controlFD
{
module = "FSDataOutput";
id = "2EE0";
type = int;
direct = out;
}
variable $controlAirSpeedHold
{
module = "FSDataOutput";
id = "07DC";
type = int;
direct = out;
}
// zmienne przycisków i enkoderów joystick'a
// - przycisk reset - 4 przycisk w swmapper czyli 003 tutaj
variable $MJ16_przycisk_003
{
module = "GameControllersInput";
id = "MJ16:przycisk_003";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_003
{
if ( $MJ16_przycisk_003 == true )
{
SetWithSignal( $controlAltHold , 0);
SetWithSignal( $controlAutopilotMaster , 0);
SetWithSignal( $controlAutoThrottle , 1);
SetWithSignal( $controlHdgHold , 0);
SetWithSignal( $controlAirSpeedHold , 0);
}
}
variable $MJ16_przycisk_000
{
module = "GameControllersInput";
id = "MJ16:przycisk_000";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_000
{
if ( $MJ16_przycisk_000 == true )
{
if ( $AltHoldStatus == 0 )
{
SetWithSignal( $controlAltHold , 1);
}
else
{
SetWithSignal( $controlAltHold , 0);
}
}
}
variable $MJ16_przycisk_001
{
module = "GameControllersInput";
id = "MJ16:przycisk_001";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_001
{
if ( $MJ16_przycisk_001 == true )
{
if ( $AutopilotMasterStatus == 0 )
{
SetWithSignal( $controlAutopilotMaster , 1);
}
else
{
SetWithSignal( $controlAutopilotMaster , 0);
}
}
}
//================FLIGHT DIRECTOR
variable $MJ16_przycisk_088
{
module = "GameControllersInput";
id = "MJ16:przycisk_088";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_088
{
if ( $MJ16_przycisk_088 == true )
{
if ($FDStatus == 0)
{
SetWithSignal( $controlFD , 1);
}
}
}
variable $MJ16_przycisk_080
{
module = "GameControllersInput";
id = "MJ16:przycisk_080";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_080
{
if ( $MJ16_przycisk_080 == true )
{
if ($FDStatus == 1)
{
SetWithSignal( $controlFD , 0);
}
}
}
//================AUTO THROTTLE
variable $MJ16_przycisk_081
{
module = "GameControllersInput";
id = "MJ16:przycisk_081";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_081
{
if ( $MJ16_przycisk_081 == true )
{
if ($AutoThrottleStatus == 0)
{
SetWithSignal( $controlAutoThrottle , 1);
}
}
}
variable $MJ16_przycisk_089
{
module = "GameControllersInput";
id = "MJ16:przycisk_089";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_089
{
if ( $MJ16_przycisk_089 == true )
{
if ($AutoThrottleStatus == 1)
{
SetWithSignal( $controlAutoThrottle , 0);
}
}
}
//================================HDG HOLD
variable $MJ16_przycisk_006
{
module = "GameControllersInput";
id = "MJ16:przycisk_006";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_006
{
Log( "Hold Heading:" );
Log( $HdgHoldStatus );
if ( $MJ16_przycisk_006 == true )
{
if ( $HdgHoldStatus == 0 )
{
SetWithSignal( $controlHdgHold , 1);
}
else
{
SetWithSignal( $controlHdgHold , 0);
}
}
}
//================================AIR SPEED HOLD
variable $MJ16_przycisk_005
{
module = "GameControllersInput";
id = "MJ16:przycisk_005";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_005
{
if ( $MJ16_przycisk_005 == true )
{
if ( $AirSpeedHoldStatus == 0 )
{
//if ( $AutoThrottleStatus == 1)
//{
SetWithSignal( $controlAirSpeedHold , 1);
//}
}
else
{
SetWithSignal( $controlAirSpeedHold , 0);
}
}
}
//================================HEADING KNOB - enkoder
//================================ w prawo
variable $MJ16_przycisk_098
{
module = "GameControllersInput";
id = "MJ16:przycisk_098";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_098
{
if ( $MJ16_przycisk_098 == true )
{
$testowa_line_1 = ToString( FormatNumber( $HdgValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlHdgValue , $HdgValue + 182);
}
}
variable $MJ16_przycisk_106
{
module = "GameControllersInput";
id = "MJ16:przycisk_106";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_106
{
if ( $MJ16_przycisk_106 == true )
{
$testowa_line_1 = ToString( FormatNumber( $HdgValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlHdgValue , $HdgValue + 1820);
}
}
//================================ w lewo
variable $MJ16_przycisk_096
{
module = "GameControllersInput";
id = "MJ16:przycisk_096";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_096
{
if ( $MJ16_przycisk_096 == true )
{
$testowa_line_1 = ToString( FormatNumber( $HdgValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlHdgValue , $HdgValue - 182);
}
}
variable $MJ16_przycisk_104
{
module = "GameControllersInput";
id = "MJ16:przycisk_104";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_104
{
if ( $MJ16_przycisk_104 == true )
{
$testowa_line_1 = ToString( FormatNumber( $HdgValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlHdgValue , $HdgValue - 1820);
}
}
//================================ALTITUDE KNOB - enkoder
//================================ w prawo
variable $MJ16_przycisk_102
{
module = "GameControllersInput";
id = "MJ16:przycisk_102";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_102
{
if ( $MJ16_przycisk_102 == true )
{
$testowa_line_1 = ToString( FormatNumber( $AltValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlAltValue , $AltValue + 1997537);
}
}
variable $MJ16_przycisk_110
{
module = "GameControllersInput";
id = "MJ16:przycisk_110";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_110
{
if ( $MJ16_przycisk_110 == true )
{
$testowa_line_1 = ToString( FormatNumber( $AltValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlAltValue , $AltValue + 19975370);
}
}
//================================ w lewo
variable $MJ16_przycisk_100
{
module = "GameControllersInput";
id = "MJ16:przycisk_100";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_100
{
if ( $MJ16_przycisk_100 == true )
{
$testowa_line_1 = ToString( FormatNumber( $AltValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlAltValue , $AltValue - 1997537);
}
}
variable $MJ16_przycisk_108
{
module = "GameControllersInput";
id = "MJ16:przycisk_108";
type = bool;
direct = in;
}
variable_changed $MJ16_przycisk_108
{
if ( $MJ16_przycisk_108 == true )
{
$testowa_line_1 = ToString( FormatNumber( $AltValue , "0" ) );
//$i= $HdgValue;
//$i=$i +1;
SetWithSignal( $controlAltValue , $AltValue - 19975370);
}
}
variable_changed $HdgValue
{
$testowa_line_1 = ToString( FormatNumber( $HdgValue , "0" ) );
}
variable_changed $AltValue
{
$testowa_line_1 = ToString( FormatNumber( $AltValue , "0" ) );
}
}
Zresztą już trzeci raz piszę tego posta - bo engine forum gubi treść, jeśli wystąpi błąd...