Orbiter Forum » Orbiter Lua Scripting
2 FOLLOWERS
Orbiter Forum is an orbiter and space flight discussion board. Find support, share snippets and general discussion around using the Lua engine in Orbiter, discuss implementing keypress detection in Lua, learn to set vessels' position in Lua, ask questions on calculations and times execution, and more.
Orbiter Forum » Orbiter Lua Scripting
3M ago
I'm trying to use "del_animation" like this:
Code:
function clbk_poststep(simt,simdt,mjd)
if vi:get_groundcontact() == true then
vi:del_animation(anim_Chute)
end
end
I'm expecting the animation to be deleted and the mesh groups to revert to their initial state but that's not what happens.
The animation is scaling. The chute scales up when it's supposed to but doesn't scale back down upon ground contact even though the animation is deleted.
From the docs:
Before the animation is...
Click to expand...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
3M ago
I'm trying to use "del_animation" like this:
Code:
function clbk_poststep(simt,simdt,mjd)
if vi:get_groundcontact() == true then
vi:del_animation(anim_Chute)
end
end
I'm expecting the animation to be deleted and the mesh groups to revert to their initial state but that's not what happens.
The animation is scaling. The chute scales up when it's supposed to but doesn't scale back down upon ground contact even though the animation is deleted.
From the docs:
Before the animation is...
Click to expand...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
4M ago
While I have been in the Orbiter community since the M6 days, and Lua scripting has been a feature since at least Orbiter 2010 if not earlier, I've only recently started tinkering with it in Orbiter 2016 within the last year to make add-ons as it is easier to work than trying to setup C++ on a Linux machine. As Orbiter is now open source, I am wondering if any further development of Lua scripting is being done? Is Lua at a dead-end in Orbiter? Lua does seem to be an excellent way to...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
4M ago
More Lua adventures.
So I have a waypoint autopilot that takes lat/long data from the Orbiter Cities.mkr file and converts it to a table of tables that is searchable by index, so the user can scroll through the cities and select the desired waypoint.
The resulting table has a number of tables in it that is the same as the number of cities (n_cities) listed in the Cities.mkr file. As an example, it looks something like this (not exact numbers, just making up an example):
Code:
city_waypoints...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
5M ago
I am looking for a way to get base and city lat/long data into an script MFD waypoint autopilot like what is available to the stock Map MFD function. I am not seeing a ready way to access this information through the API. I am aware the marker files are available in Orbiter 2016/Config/Earth/Marker, but really wanted to avoid trying to do file I/O through Lua. Does anybody know if this is possible through an API script function ..read more
Orbiter Forum » Orbiter Lua Scripting
5M ago
So I am trying to make an autopilot feature that will navigate to VOR stations. I have the following Lua code that pulls the table for the transmitter in the vessel NAV1 receiver.
Code:
hnav = vi:get_navsource(0)
nav_table = oapi.get_navdata(hnav)
I can print this table out to the screen using the annotation function:
Code:
note:set_text(nav_table)
I've verified this as a table using:
Code:
note:set_text(type(nav_table))
which returns 'table'. All well and good...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
6M ago
I am trying to draw text and rectangles on the main camera view from the cockpit using Sketchpad objects. In the Help Lua documentation there is this statement:
In the following, skp is assumed to refer to a valid Sketchpad object.
But I have not seen how to make a "valid Sketchpad object" in Lua, so I am a little lost. It seems that skp is already defined if you are working with MFD scripts, but that does not appear to be the case for cockpit views from vessel scripts ..read more
Orbiter Forum » Orbiter Lua Scripting
6M ago
Do equivalents to oapiReadScenario_nextline(scn, line) and oapiWriteScenario_int(scn, "status", status) and scenario callback functions exist for Lua in Orbiter 2016 to read and write animation and vessel status and states to the scenario file? I tried "Lua-fying" the Orbiter API equivalents with no luck, and I have not seen any of these features documented anywhere ..read more
Orbiter Forum » Orbiter Lua Scripting
6M ago
Yep, me again. I have my jet engine code completely converted into Lua, and I have annotations that indicate the status of the afterburner on the screen. The final thing I want to implement is to replicate the landing gear indicators like is done in the DG.
I can put text annotations into the screen, but in order to put the three rectangles in I would need to implement a Sketchpad object (I think), and it seems that I can't make a Sketchpad object outside of the context of a...
Read more ..read more
Orbiter Forum » Orbiter Lua Scripting
6M ago
Is there a ShiftCG or ShiftCentreofMass capability in Lua? I saw a link to ShiftCentreofMass in the Help files but it doesn't link to anything ..read more