General Question Set animation from scenario file

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,880
Reaction score
2,132
Points
203
Location
between the planets
Usually a vessel will persist its animation states (unless they're default) in the scenario files, so in general, yes. How to do it exactly depends on the particular vessel, though.
 

johnnymanly

Donator
Donator
Joined
Mar 17, 2008
Messages
55
Reaction score
23
Points
8
Location
Southwest Pennsylginia
This is a vessel that I created.
Sometimes I'd like to start a scenario with the gear up and sometimes down.
Lua vessels don't currently save their animation states between saving and loading(at least I don't know how to do it).
I was hoping I could manually edit a scenario to do what I want.
It's easy enough to do this with the config file but with the scenario file it would be more convenient.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Hi @johnnymanly ,
I am not sure what exactly you mean by "a lua vessel".

If the vessel (class) itself was written in lua, there should be something like these callback methods:
C++:
    void SaveState (FILEHANDLE scn);
    bool ParseScenarioLine (const char *line);
(these are the C++ API, but names should be similar)

It has been looong time since I last visited any lua code in Orbiter, so I am not sure if such a thing (callbacks) is implemented for a lua-vessels.
To be honest, I doubt it :unsure:
 

johnnymanly

Donator
Donator
Joined
Mar 17, 2008
Messages
55
Reaction score
23
Points
8
Location
Southwest Pennsylginia
Hi @johnnymanly ,
I am not sure what exactly you mean by "a lua vessel".

If the vessel (class) itself was written in lua, there should be something like these callback methods:
C++:
    void SaveState (FILEHANDLE scn);
    bool ParseScenarioLine (const char *line);
(these are the C++ API, but names should be similar)

It has been looong time since I last visited any lua code in Orbiter, so I am not sure if such a thing (callbacks) is implemented for a lua-vessels.
To be honest, I doubt it :unsure:
Yes the vessel class is written in Lua.
I believe the methods for saving to a scenario are not implemented.
After some thought I realize my initial question is moot anyway.
Lua vessel classes don't have "consumebufferedkey" so I'm retracting and extending the gear via altitude not keystroke.
It doesn't matter where I put the gear at the start of a scenario it will always be down below a certain altitude and up above.
 

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,927
Reaction score
340
Points
98
Location
Sparta
Yes the vessel class is written in Lua.
I believe the methods for saving to a scenario are not implemented.
After some thought I realize my initial question is moot anyway.
Lua vessel classes don't have "consumebufferedkey" so I'm retracting and extending the gear via altitude not keystroke.
It doesn't matter where I put the gear at the start of a scenario it will always be down below a certain altitude and up above.

While it's true that there is no consumebufferedkey implemented in lua, you can detect pressed keys with this.
(There is v:send_bufferedkey(keycode) method which is described in the section Orbiter Scripting→Reference→Class methods→Vessel methods in the Orbiter.chm file, but you can only send keys, not detect them).
 
Last edited:
Top