Warnung: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php (Zeile 156)

Warnung: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php (Zeile 156)

Warnung: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php (Zeile 156)

Warnung: Use of undefined constant VB_FRAMEWORK - assumed 'VB_FRAMEWORK' (this will throw an Error in a future version of PHP) in ..../includes/functions.php (Zeile 8101)

Warnung: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php (Zeile 456)
Script: Höhe über Grund via dataref auslesen? [Archiv] - X-Plane Schweiz

PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Script: Höhe über Grund via dataref auslesen?



Learjet56
09.03.2018, 15:58
Für ein kleines Script (mein erstes!) brauche ich die Höhe über Grund (NICHT Höhe über Meer!).

Gibt es dazu ein dataref?

Gruss
Bernhard

Dietmar
09.03.2018, 17:19
Ja, ist vom Typ Fließkomma:

sim/flightmodel/position/y_agl
(http://www.xsquawkbox.net/xpsdk/phpwiki/index.php?sim/flightmodel/position/y_agl)

Learjet56
10.03.2018, 06:42
Ja, ist vom Typ Fließkomma:

Danke Dietmar!
Hätte ich nie gefunden - habe weder ein Manual zu "Script" noch zu den datarefs ...

Dies ist mein Resultat (habe natürlich hier und dort abgekupfert - bin ja in Thailand):

agl_value = dataref_table("sim/flightmodel/position/y_agl")
vis_value = dataref_table("sim/weather/visibility_reported_m")


local VAL_akt_time = os.clock()


function set_visibility()
if os.clock() > VAL_akt_time + 10 then
if agl_value[0] < 2000 then
vis_value[0] = 15000
elseif agl_value[0] < 5000 then
vis_value[0] = 40000
elseif agl_value[0] < 10000 then
vis_value[0] = 70000
else
vis_value[0] = 90000
end
VAL_akt_time = os.clock()
end
end

do_sometimes("set_visibility()")

Das Script macht was es soll, aber die "Pause" scheint nicht zu funktionieren. Ich möchte, dass die Funktion set_visibility nur alle 10 sec ausgeführt werden soll. Aber mich dünkt, der PC rechnet immer sofort, wenn ich die Höhe des Flugzeuges ändere ..... Eigentlich habe ich ja 2 Pausen eingebaut - nützt aber auch nichts.
Was kann ich tun?

Gruss
Bernhard