LUA Default DG LUA Functions

flyer

Member
Joined
Jan 20, 2010
Messages
56
Reaction score
0
Points
6
Hi there, you will have to bear with me, I do not know C++ very well but I think I have a basic grasp of what is going on here.

My question is about the default DG LUA functions which seem to be present in the sample source code in the SDK. After looking at the help documentation about creating custom LUA commands for vessels I was looking around the SDK and saw a DGLua.cpp file.

I looked inside this and saw some familiar text. It seems that the big man has included a few commands for controlling some things on the DG. Things like opening doors, nosecone, speedbrake etc. From what I can gather, it seems these have been included but not mentioned in the documentation (possibly for future development).

My thinking is based on the fact that there seems to be the same (or similar) code that is in the help file for creating additional LUA commands.

The thing is I do not know what I need to type into the LUA window to make these functions work, it is not obvious to me from the code. I have tried various things that seem logical but nothing has worked so far.

At first I thought maybe this wasn't included in the compiled DG dll, but then I looked at the deltaglider.vcproj file (in notepad++) and it was mentioned in there. I am guessing that this means that when the thing is compiled in visual studio(?), the DGLua.cpp file will be included and the functionality will be there.

Please feel free to point at me and laugh if I have completely misunderstood the workings of dll's, C++ and visual studio. Also you may ridicule me if I have missed this somewhere obvious in the documentation!

If anyone can offer any guidance I would appreciate it. And I am slowly trying to learn C++, I think I can understand the basic logic of it but coming to terms with the syntax is another thing!

Thanks for reading this far!


flyer
 
it would be easier to write a code and leave it with the other LUa scripts, then you only run it once and it can update every value as it runs (pitch, thrust, and whatever else) rather than you having to change every value in real time

check the atlantis launch scrpit in Orbiter2010\Script\Atlantis for some ideas

then to run it, you simply type run('[filepath]') into the terminal MFD and get running!

*filepath has / instead of \

NOTE: i dont have any script experience... yet
 
Thanks for the reply, I'm relatively comfortable in using LUA and making scripts etc. I don't really understand what you are saying though.

I am asking about the LUA functions themselves. The LUA functions mentioned in the help documentation can only do limited things, having said that there are ALOT of functions which cover most of the major things, but not all of the oapi functions are included. Martins has said in the past that it is alot of work to provide LUA equivalents for ALL of the oapi functions so he is doing it in stages I guess.

The help documentation gives an example which (in theory) allows the user to type v:gear_up() into the LUA window/MFD and raise the gear of a ship. I think that this code (modified) is included in the default DG for doing a small amount of things like opening doors, airbrake, radiator etc. But I do not know the LUA commands to make this happen.

So to respond to you, I would like to write a LUA script which interacts with the default DG, but in order for this to happen, the DG has to provide the appropriate (extended) LUA commands.

Hopefully I've explained myself a bit better this time!

Cheers,


flyer
 
if i read you correctly, you want to know about the API functions, and how to write them into a LUA script. in which case the only place to look is either the SDK documentation (theres a huge PDF with a list of all the different functions) or by looking at existing scripts in the path Orbiter2010\Script\

from there, im afraid it may be trial and error
 
Yeah you're right, that's exactly what I'm trying to do, although I noticed that there may be an example of this in the DG code which I was hoping could help me to learn.

The way I think of it is that the oapi functions and documentation are only for use within dll's and using C++. The LUA functions make use of some of the oapi functions, but not all. There needs to be special functions and dedicated code that provide the LUA commands. Having ready made code to guide me through the process would be great to help me learn.

I'll keep chipping away at it, thanks for the responses though :thumbup:
 
Back
Top