Request Script Vessels Update to Open Orbiter

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
670
Reaction score
89
Points
43
Location
Happy Wherever
Hi All,

It would be really great if someone versed in Lua could update these scripts to OO.
https://www.orbiter-forum.com/resou...-v0-01-cruiser-operations-script-vessel.1668/
and
https://www.orbiter-forum.com/resou...-v0-03-carrier-operations-script-vessel.3116/

Thunder Chicken would be a prime candidate . 👏 👏

Is BEEP still around d'you know / been seen since November?

Do you know if there are any known bugs? There are not too many changes to Lua, rather many extensions.
 
Do you know if there are any known bugs? There are not too many changes to Lua, rather many extensions.
Hi, the script vessels lose propulsion (thrust) and a kinda generic message is displayed.
1736439941343.png
 
set_animation: argument 1: Invalid type (expected number) nil given
is a pretty good description of what went wrong:
a call to set_animation was done with the 1st argument being nil
It should be pretty easy to find the code that lead to this.
 
set_animation: argument 1: Invalid type (expected number) nil given
is a pretty good description of what went wrong:
a call to set_animation was done with the 1st argument being nil
It should be pretty easy to find the code that lead to this.
I've never programmed using script so not sure what prompts this.
All I know is that it works fine in 2016, so what's different in OO that stops the script?
 
I've never programmed using script so not sure what prompts this.
All I know is that it works fine in 2016, so what's different in OO that stops the script?
Close Orbiter, delete the Orbiter.log file, then reopen Orbiter and get the error again. Post the Orbiter.log here.

What pops up on the display may not be the precipitating error. The Orbiter.log might give more information.
 
Close Orbiter, delete the Orbiter.log file, then reopen Orbiter and get the error again. Post the Orbiter.log here.

What pops up on the display may not be the precipitating error. The Orbiter.log might give more information.
Code:
000052.430:
000052.431: **** Creating simulation session
000052.471: D3D9: [DirectX 9 Initialized]
000052.474: D3D9: 3D-Adapter.............. : Intel(R) HD Graphics 4000
000052.492: D3D9: MaxTextureWidth......... : 8192
000052.493: D3D9: MaxTextureHeight........ : 8192
000052.494: D3D9: MaxTextureRepeat........ : 8192
000052.495: D3D9: VolTexAddressCaps....... : 0x3F
000052.507: D3D9: NumSimultaneousRTs...... : 4
000052.509: D3D9: VertexDeclCaps.......... : 0x37F
000052.511: D3D9: MiscCaps................ : 0x2FCCF2
000052.513: D3D9: Separate AlphaBlend..... : Yes
000052.516: D3D9: Shadow Mapping.......... : Yes
000052.517: D3D9: D3DFMT_A16B16G16R16F.... : Yes
000052.518: D3D9: Vertex_A16B16G16R16F.... : Yes
000052.561: D3D9: Vertex_A32B32G32R32F.... : Yes
000052.562: D3D9: Vertex_R16F............. : Yes
000052.563: D3D9: Vertex_R32F............. : Yes
000052.564: D3D9: D3DFMT_A32B32G32R32F.... : Yes
000052.565: D3D9: D3DFMT_D32F_LOCKABLE.... : No
000052.566: D3D9: D3DFMT_A2R10G10B10...... : Yes
000052.567: D3D9: D3DFMT_L8............... : Yes
000052.568: D3D9: D3DDTCAPS_DEC3N......... : No
000052.568: D3D9: D3DDTCAPS_FLOAT16_2..... : Yes
000052.569: D3D9: D3DDTCAPS_FLOAT16_4..... : Yes
000052.570: D3D9: Runs under WINE......... : No
000052.571: D3D9: D3D9Build Date.......... : 0
000052.733: D3D9: Available Texture Memory : 1783 MB
000052.866: D3D9: [3DDevice Initialized]
000076.557: Loaded 41057 records from star database
000081.249: D3D9: [D3D9Client Initialized]
000082.712: Module Sun.dll ............... [Build 241231, API 241231]
000082.827: VSOP87(E) Sun: Precision 1.0e-06, Terms 554/6634
000082.970: Module Mercury.dll ........... [Build 241231, API 241231]
000083.037: GRAVITY MODEL: GravityModels\jgmess_160a_sha.tab LOADED, Terms 65/13040
000083.125: VSOP87(B) Mercury: Precision 1.0e-05, Terms 167/7123
000083.255: Module Venus.dll ............. [Build 241231, API 241231]
000083.366: GRAVITY MODEL: GravityModels\mod_shgj120p.a01 LOADED, Terms 65/7380
000083.452: Module VenusAtm2006.dll ...... [Build 241231, API 241231]
000083.453: Loading module VenusAtm2006 (legacy interface)
000083.501: VSOP87(B) Venus: Precision 1.0e-05, Terms 79/1710
000083.981: Module Earth.dll ............. [Build 241231, API 241231]
000084.145: GRAVITY MODEL: GravityModels\egm96_to360.tab LOADED, Terms 65/65340
000084.258: Module EarthAtmJ71G.dll ...... [Build 241231, API 241231]
000084.259: Loading module EarthAtmJ71G (legacy interface)
000084.330: VSOP87(B) Earth: Precision 1.0e-08, Terms 2564/2564
000095.559: Module Moon.dll .............. [Build 241231, API 241231]
000095.619: GRAVITY MODEL: GravityModels\jgl165p1.sha LOADED, Terms 65/13860
000095.670: ELP82: Precision 1.0e-05, Terms 116/829
000095.907: Module Mars.dll .............. [Build 241231, API 241231]
000096.057: GRAVITY MODEL: GravityModels\jgmro_120f_sha.tab LOADED, Terms 65/7380
000096.123: Module MarsAtm2006.dll ....... [Build 241231, API 241231]
000096.123: Loading module MarsAtm2006 (legacy interface)
000096.229: VSOP87(B) Mars: Precision 1.0e-05, Terms 405/6400
000096.778: Module Phobos.dll ............ [Build ******, API 060425]
000096.959: Module Deimos.dll ............ [Build ******, API 060425]
000097.047: GRAVITY MODEL: GravityModels\JGDWN_VES20H_SHA.TAB LOADED, Terms 65/230
000097.216: Module Galsat.dll ............ [Build 241231, API 241231]
000097.254: Module Jupiter.dll ........... [Build 241231, API 241231]
000097.358: VSOP87(B) Jupiter: Precision 1.0e-06, Terms 1624/3625
000097.581: Module Io.dll ................ [Build 241231, API 241231]
000097.915: Module Europa.dll ............ [Build 241231, API 241231]
000098.088: Module Ganymede.dll .......... [Build 241231, API 241231]
000098.218: Module Callisto.dll .......... [Build 241231, API 241231]
000098.526: Module Satsat.dll ............ [Build 241231, API 241231]
000098.653: Module Saturn.dll ............ [Build 241231, API 241231]
000098.965: VSOP87(B) Saturn: Precision 1.0e-06, Terms 2904/6365
000099.161: Module Mimas.dll ............. [Build 241231, API 241231]
000099.199: SATSAT Mimas: Terms 113
000099.329: Module Enceladus.dll ......... [Build 241231, API 241231]
000099.330: SATSAT Enceladus: Terms 33
000099.880: Module Tethys.dll ............ [Build 241231, API 241231]
000099.881: SATSAT Tethys: Terms 101
000099.987: Module Dione.dll ............. [Build 241231, API 241231]
000099.988: SATSAT Dione: Terms 59
000100.104: Module Rhea.dll .............. [Build 241231, API 241231]
000100.105: SATSAT Rhea: Terms 68
000100.180: Module Titan.dll ............. [Build 241231, API 241231]
000100.181: SATSAT Titan: Terms 100
000100.447: Module Iapetus.dll ........... [Build 241231, API 241231]
000100.448: SATSAT Iapetus: Terms 605
000100.549: Module Uranus.dll ............ [Build 241231, API 241231]
000100.625: VSOP87(B) Uranus: Precision 1.0e-06, Terms 1827/5269
000100.723: Module Miranda.dll ........... [Build ******, API 060425]
000100.818: Module Ariel.dll ............. [Build ******, API 060425]
000100.878: Module Umbriel.dll ........... [Build ******, API 060425]
000101.005: Module Titania.dll ........... [Build ******, API 060425]
000101.094: Module Oberon.dll ............ [Build ******, API 060425]
000101.178: Module Neptune.dll ........... [Build 241231, API 241231]
000101.224: VSOP87(B) Neptune: Precision 1.0e-06, Terms 391/2024
000101.333: Finished initialising world
000102.228: Module ScriptVessel.dll ...... [Build 241231, API 241231]
000102.441: Module LuaInline.dll ......... [Build 241231, API 241231]
000102.442: Loading module LuaInline
000102.551: ============================ ERROR: ===========================
000102.551: Config/Vessels/ScriptTiconderogaCG.cfg:1955: add_animationcomponent: argument 5: invalid type (expected handle) nil given
stack traceback:
    [C]: in function 'add_animationcomponent'
    Config/Vessels/ScriptTiconderogaCG.cfg:1955: in function 'crearadar0anim'
    Config/Vessels/ScriptTiconderogaCG.cfg:479: in function <Config/Vessels/ScriptTiconderogaCG.cfg:293>
000102.552: [ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 262]
000102.553: ===============================================================
000102.750: ============================ ERROR: ===========================
000102.751: Config/Vessels/ScriptNimitzCV.cfg:3880: add_animationcomponent: argument 5: invalid type (expected handle) nil given
stack traceback:
    [C]: in function 'add_animationcomponent'
    Config/Vessels/ScriptNimitzCV.cfg:3880: in function 'crearadar0anim'
    Config/Vessels/ScriptNimitzCV.cfg:1056: in function <Config/Vessels/ScriptNimitzCV.cfg:961>
000102.751: [ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 262]
000102.752: ===============================================================
000102.968: Module J-F-35B.dll ........... [Build 250109, API 241231]
000104.185: -------------------------- OBSOLETE: --------------------------
000104.185: Obsolete API function used: VESSEL::CreateVariableDragElement
000104.186: At least one active module is accessing an obsolete interface function.
000104.187: Addons which rely on obsolete functions may not be compatible with
000104.187: future versions of Orbiter.
000104.188: ---------------------------------------------------------------
000104.239: Finished initialising status
000104.240: Finished initialising camera
000104.283: Finished setting up render state
000104.287: D3D9: [Scene Initialized]
000105.023: XRSound 3.00 RC2 [32-bit Release], Build Date : Dec 31 2024 initialized using sound driver DirectSound8; irrKlang version = 1.6.0.  XRSound UpdateInterval = 0.050 (20.0 updates per second)
000105.418: [XRSound INFO] Vessel 'J-F-35B' built with XRSound API version 3.00
000105.996: Finished initialising panels
000106.881: ============================ ERROR: ===========================
000106.882: Config/Vessels/ScriptTiconderogaCG.cfg:1087: set_animation: argument 1: invalid type (expected number) nil given
stack traceback:
    [C]: in function 'set_animation'
    Config/Vessels/ScriptTiconderogaCG.cfg:1087: in function 'setshipanim'
    Config/Vessels/ScriptTiconderogaCG.cfg:609: in function <Config/Vessels/ScriptTiconderogaCG.cfg:500>
000106.971: [ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 262]
000106.972: ===============================================================
000106.973: ============================ ERROR: ===========================
000106.974: Config/Vessels/ScriptNimitzCV.cfg:3793: set_animation: argument 1: invalid type (expected number) nil given
stack traceback:
    [C]: in function 'set_animation'
    Config/Vessels/ScriptNimitzCV.cfg:3793: in function 'setdoorsrightanim'
    Config/Vessels/ScriptNimitzCV.cfg:1325: in function <Config/Vessels/ScriptNimitzCV.cfg:1135>
000106.974: [ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 262]
000106.975: ===============================================================
000106.978: -------------------------- OBSOLETE: --------------------------
000106.979: Obsolete API function used: VESSEL::GetShipAirspeedVector
000106.979: At least one active module is accessing an obsolete interface function.
000106.980: Addons which rely on obsolete functions may not be compatible with
000106.981: future versions of Orbiter.
000106.981: ---------------------------------------------------------------
 
It seems that add_animationcomponent on lines 1955 and 3880 are looking for some parent animation handles that haven't been created or referenced properly.

You also seem to still have some API code in your script. You'll have to update VESSEL::GetShipAirspeedVector to vi:get_airspeedvector(REFFRAME.<FRAME>), and VESSEL::CreateVariableDragElement to vi:create_variabledragelement().
 
It seems that add_animationcomponent on lines 1955 and 3880 are looking for some parent animation handles that haven't been created or referenced properly.

You also seem to still have some API code in your script. You'll have to update VESSEL::GetShipAirspeedVector to vi:get_airspeedvector(REFFRAME.<FRAME>), and VESSEL::CreateVariableDragElement to vi:create_variabledragelement().
Could this be one? It's in section. 1941 - 1956
Code:
function crearadar0anim()
    radar0anim_1 = vi:create_animation(0)
    

    rot = {
    type = 'rotation',
    mesh = 1,
    grp = {0},
    ref={x=0,y=0,z=0},
    axis={x=0,y=1,z=0},
    angle = 2* math.pi
    }

    hAnim_8Comp_1 = oapi.create_animationcomponent( rot )
    vi:add_animationcomponent(radar0anim_1,0,1,hAnim_8Comp_1,hParnt_1Comp_1)
end

(The API code is from the J-F-35B.dll)
 
Could this be one? It's in section. 1941 - 1956
Code:
function crearadar0anim()
    radar0anim_1 = vi:create_animation(0)
   

    rot = {
    type = 'rotation',
    mesh = 1,
    grp = {0},
    ref={x=0,y=0,z=0},
    axis={x=0,y=1,z=0},
    angle = 2* math.pi
    }

    hAnim_8Comp_1 = oapi.create_animationcomponent( rot )
    vi:add_animationcomponent(radar0anim_1,0,1,hAnim_8Comp_1,hParnt_1Comp_1)
end

(The API code is from the J-F-35B.dll)
Probably. Where is hParnt_1Comp1 defined? That's the missing parent animation that needs to be defined.
 
  • Like
Reactions: JMW
Probably. Where is hParnt_1Comp1 defined? That's the missing parent animation that needs to be defined.
It's in here:

Code:
function creashippitchanim()

    shipanim_1 = vi:create_animation(.5)

    rot = {
    type = 'rotation',
    mesh = 0,
    grp = {0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20},
    ref= shipbnkmetcntr, --metacenter
    axis = {x=0,y=0,z=1}, --Bank
    angle = maximum_roll_rot_angle
}
    hAnim_1Comp_1 = oapi.create_animationcomponent( rot )
    hParnt_1Comp_1= vi:add_animationcomponent(shipanim_1,0,1,hAnim_1Comp_1)

        rot = {
    type = 'rotation',
    mesh = 0,
    grp = {0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20},
    ref= shipptcmetcntr, --Metacenter
    axis = {x=1,y=0,z=0}, --Pitch
    angle = maximum_pitch_rot_angle
}
    hAnim_1Comp_2 = oapi.create_animationcomponent( rot )
    vi:add_animationcomponent(shipanim_1,0,1,hAnim_1Comp_2)

end
 
Where are these functions being called? hParnt_1Comp_1 needs to be created before it is referenced by the child animation.
 
Where are these functions being called? hParnt_1Comp_1 needs to be created before it is referenced by the child animation.
It seems to be.
It's called before this.
Code:
function crearadar0anim()
    radar0anim_1 = vi:create_animation(0)
    

    rot = {
    type = 'rotation',
    mesh = 1,
    grp = {0},
    ref={x=0,y=0,z=0},
    axis={x=0,y=1,z=0},
    angle = 2* math.pi
    }

    hAnim_8Comp_1 = oapi.create_animationcomponent( rot )
    vi:add_animationcomponent(radar0anim_1,0,1,hAnim_8Comp_1,hParnt_1Comp_1)
end
What I don't understand is why it works fine in 2016, but fails in OO if there's been no major Lua changes there....
 
What I don't understand is why it works fine in 2016, but fails in OO if there's been no major Lua changes there....
There has been a lot of expansion work to enable more Lua script features in OpenOrbiter and Orbiter2024. However I am not seeing anything in your code that should cause problems due to version compatability.
 
There has been a lot of expansion work to enable more Lua script features in OpenOrbiter and Orbiter2024. However I am not seeing anything in your code that should cause problems due to version compatability.
Thanks for your help Thunder Chicken.
To be clear, this is not my code but is an extract from one of two great addons by BEEP for 2016.
https://www.orbiter-forum.com/resou...-v0-01-cruiser-operations-script-vessel.1668/
and
https://www.orbiter-forum.com/resou...-v0-03-carrier-operations-script-vessel.3116/
Hopefully they can be updated to work in 2024.
 
Error handling as been modified so some code that would fail silently before can now cause this kind of issue.
I'll take a look and see what happens, but there in no license associated with it so I'm not sure what we'll do when we have a solution...
 
  • Like
Reactions: JMW
It's in here:

Code:
function creashippitchanim()

    shipanim_1 = vi:create_animation(.5)

    rot = {
    type = 'rotation',
    mesh = 0,
    grp = {0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20},
    ref= shipbnkmetcntr, --metacenter
    axis = {x=0,y=0,z=1}, --Bank
    angle = maximum_roll_rot_angle
}
    hAnim_1Comp_1 = oapi.create_animationcomponent( rot )
    hParnt_1Comp_1= vi:add_animationcomponent(shipanim_1,0,1,hAnim_1Comp_1)

        rot = {
    type = 'rotation',
    mesh = 0,
    grp = {0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20},
    ref= shipptcmetcntr, --Metacenter
    axis = {x=1,y=0,z=0}, --Pitch
    angle = maximum_pitch_rot_angle
}
    hAnim_1Comp_2 = oapi.create_animationcomponent( rot )
    vi:add_animationcomponent(shipanim_1,0,1,hAnim_1Comp_2)

end
Taking another look at this, I realized that you are reinitializing the transformation table 'rot' several times and trying to make parent-child animations from them. Give them distinct names, even if only rot1, rot2, etc..
 
  • Like
Reactions: JMW
creashippitchanim() which initializes hParnt_1Comp_1 is called after crearadar0anim() which needs it :
Code:
    --Animations
    --************
    crearadar0anim2()
    crearadar0anim()

...

    creaJBDleftanim2()
    creaJBDleftanim()

    creaJBDrightanim2()
    creaJBDrightanim()

    creashippitchanim()
 
  • Wow
Reactions: JMW
creashippitchanim() which initializes hParnt_1Comp_1 is called after crearadar0anim() which needs it :
Code:
    --Animations
    --************
    crearadar0anim2()
    crearadar0anim()

...

    creaJBDleftanim2()
    creaJBDleftanim()

    creaJBDrightanim2()
    creaJBDrightanim()

    creashippitchanim()

YES!! Script for CG now works. Thanks guys. :cheers: 👏👏

Now have same problem/simular message for CV Carrier, but that code is far more complicated (for me) so can't see how to apply same fixes:oops:
Also getting radar disc on the deck....
Can you be really kind cos these are super neat addons..... 🙏
1736785110386.png
 
YES!! Script for CG now works. Thanks guys. :cheers: 👏👏

Now have same problem/simular message for CV Carrier, but that code is far more complicated (for me) so can't see how to apply same fixes:oops:
Also getting radar disc on the deck....
Can you be really kind cos these are super neat addons..... 🙏
1736959207141.png
Yesseee!! With a bit of brain pain, this one works now too.
Thanks for your experience Scripters.:salute::salute: :salute:
 
Last edited:
Back
Top