August 23, 2011 at 6:04 am #58567DarkmanParticipant
I’m interested in learning how to write in lua for Pioneer and have never used it before.
Would these windows binaries be fine to use ?
Or would these http://luabinaries.sourceforge.net/ files be better to use ?
Also, some add-ons are available here:
How do I go about writing lua for Pioneer ? What does it involve ?
I am a newbie to this but not to programming as I wrote in C++ and BASIC years ago.
Shall we treat this thread as our main thread on lua scripting and pin this for other users new to lua ?August 23, 2011 at 7:18 am #82565BrianettaParticipant
[*:1ccufhoh]You need to learn the basic language. Docs are available online.
[*:1ccufhoh]You need to familiarise yourself with Pioneer in general.
[*:1ccufhoh]Lua is edited in a text editor, and there is an interpreter built in to Pioneer. The bare essentials are already there; you can download Lua for Windows if you want to practise with stand-alone example code.
[*:1ccufhoh]All .lua files in data/modules get loaded into the game and executed. It’s up to each Lua script to listen for events or attach itself to bulletin boards.
[*:1ccufhoh]Events, bulletin board functions and interfaces to game play are Pioneer’s additions to Lua (the API). You can find it documented
here, on RobN’s web server for now. The documentation applies to the latest master revision, and might be ahead of the alphas.
It’s recommended that you try to keep up to date. If there are big changes in the game, don’t wait for them to reach the next alpha release, which might be weeks away. Grab the latest nightly build from here.August 23, 2011 at 7:52 am #82566robnParticipant
Everything Brianetta said. A few notes/thoughts:
* I once started writing a Module API tutorial. I never got around to finishing it but its still relevant.
* The module API is by no means finished. I initially wrote as much as I thought would be useful, but as its being used we’re finding gaps which are quickly being filled. If you can’t figure out how to do something then do ask, as chances are you’ve found something missing that needs to be added.
* There’s a major gap in the documentation at the moment explaining how all the classes fit together. Things like the difference between abstract system objects and physics objects or dynamic vs static physics bodies is not clear for newcomers. I’m happy to answer questions but I don’t have time/inclination to fully document this just yet. I know there’s a few people starting to dabble with the module API with some success; it’d be great if we could get people contributing to a thread or FAQ as the knowledge gets out there.
* There’s other Lua code driving the models and custom systems. At the moment these run in a separate Lua context to the mission modules and the concepts really don’t carry over. I’m currently working to integrate custom systems into the module API (hopefully for alpha 14, definitely by 15). The model system is a whole other discussion though. You can ignore these other systems if you’re looking to build in-game stuff (ie missions).
* A good way to get started is with a simple script to customise your ship’s colour and registration. Even as a 3-5 line script it demonstrates most of the concepts you’ll need to know.
* Study the existing scripts. You don’t have to understand all of them to see what’s going on.
* RIght now you must tread carefully as every slight Lua hiccup will crash the game (redscreen). We’re slowly working towards having things fail more gracefully and we’re also planning an in-game console that you can use to run Lua commands directly and develop your script live. I don’t yet know when all this will happen. I mostly mention it in the hopes that you won’t be discouraged by the primitive state of things. Its still very early days!
Its very exciting to see all the recent interest in the module system. We’ve already had a significant contribution for alpha 14 in the form of inter-system delivery jobs, and I’m there’s also an advanced NPC trade script being written that I hope will be ready soon.August 23, 2011 at 7:56 pm #82567ollobrainParticipant
im holding off at the moment ( well just contributing mission ideas rather than writing) at least until things are a little bit more developed but by the sounds of it basic missions could be a go to start with the intrasystem missions were a good startAugust 23, 2011 at 9:13 pm #82568robnParticipantollobrain wrote:im holding off at the moment ( well just contributing mission ideas rather than writing) at least until things are a little bit more developed but by the sounds of it basic missions could be a go to start with the intrasystem missions were a good start
Further development is only going to come from people trying things and finding the shortcomings. If no one is writing to the Lua API then there’s no incentive to improve it. There’s too much other stuff in Pioneer that need love to be able to justify spending the time on something that nobody is using.
That said, people are recently trying out the API and are able to produce interesting things. New features have been added already in response to demands from mission authors. The process does work!August 23, 2011 at 9:51 pm #82569MarcelParticipant
Darkman, you can use a text editor, I do for simple stuff, but you probably need a real lua editor if you don’t have one already. Potsmoke66 turned me on to this one.August 24, 2011 at 1:54 pm #82570DarkmanParticipant
Thanks for the replies so far folks. Looks like it’s pretty straight forward to do by the sounds of it. I have a few ideas, one of which was posted in another thread about rescue missions and have plenty of variety with those. I will play around with what is there and see what I can develop, make suggestions for lua requests and post progress in my own topic.
Thanks for the link to the editor marcel I will grab that ! I’m familiar with Potsmoke as I have read a number of his posts over the years on Frontier and on here. I may not have posted many replies/topics yet but I have been reading quite a number of topics since I registered.
- You must be logged in to reply to this topic.