Updating the wiki mission scripting tutorial

impaktor
Posts: 1012
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Updating the wiki mission scripting tutorial

Post by impaktor »

No, as you've no doubt noticed there's plenty of obsolete code examples on the wiki, because we've changed how things are done, how modules are imported, etc.

However, the code that pioneer runs on is always valid (ehum, except when there's bugs in them). Either way, it's good to point a reader to modules that are a good place to start reading code, that are simple.
zonkmachine
Posts: 40
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

impaktor wrote: Wed Jul 10, 2024 12:34 pm No, as you've no doubt noticed there's plenty of obsolete code examples on the wiki, because we've changed how things are done, how modules are imported, etc.
Yes, well, I'm updating it now. This time it became obsolete a bit faster because I erroneously relied on onShipDocked to work in a certain way.
impaktor wrote: Wed Jul 10, 2024 12:34 pm However, the code that pioneer runs on is always valid (ehum, except when there's bugs in them). Either way, it's good to point a reader to modules that are a good place to start reading code, that are simple.
Sure, I can do more of that.
sturnclaw
Posts: 83
Joined: Tue Sep 18, 2018 12:20 am

Re: Updating the wiki mission scripting tutorial

Post by sturnclaw »

zonkmachine wrote: Wed Jul 10, 2024 11:27 am
impaktor wrote: Tue Jul 09, 2024 8:20 pm Btw, wiki code examples and such will sooner or later become obsolete.
Why, what? You mean the move to markdown?
The modder/developer-facing side of the wiki is *also* planned to be obsoleted / removed entirely and migrated to Markdown, but it's been a matter of "not enough hours in the day" so far on that front. We have one major "quadrant" of the wiki migrated at this point, and are slowly building out the "workflow" section (perhaps we should rename it to Content Creation?). Feel free to look at pioneer-developer-docs if you're interested in helping to migrate content.
zonkmachine
Posts: 40
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

2025

Scripting tutorial have been updated.

* Missions and the mission list have been updated and given it's own page: https://wiki.pioneerspacesim.net/wiki/M ... ssion_list
* Links have been updated.
* Code have been updated to be up to date with the next release.
* General fixes - Grammar, spelling and layout.

The only real question mark is the first half of the Surviving a reload page. The two complete modules on the end miraculously work. However, it's not at all obvious with the shorter examples in the beginning and apart from the first hello-world example they don't really work out of the box.
sturnclaw
Posts: 83
Joined: Tue Sep 18, 2018 12:20 am

Re: Updating the wiki mission scripting tutorial

Post by sturnclaw »

A few corrections / informational notices:

- On the main Introduction page: assignments to global variables without explicitly accessing _G are not visible to other scripts. Pioneer gives each Lua file a separate "environment" (the Lua _ENV variable) which "shadows" the actual global table. If you want to export something to other scripts, you have to assign it as _G.SomeExport = MyValue. This is done so that inadvertent omissions of the "local" keyword don't break the execution environment of other scripts.
- Also on that same page, we no longer have Lua-based model file definitions and are deprecating Lua-based custom systems, so there are only two distinct Lua interpreters now - one for faction definitions and one for the main game.
- The link to the CodeDoc on the Event page should probably directly link to the codedoc page for data/libs/Event.lua as it contains a list of available events...

I like the mission list page, good work! It neatly captures what has to be done to interact with the mission API and is very easy to understand.

The Surviving a Reload page would definitely need some work. It's not written as a step-by-step tutorial for new programmers, only shows the "skeleton" of a mission module, and assumes familiarity with the existing mission structure. Ideally a new version should be written which builds off of the code shown in the BBS Forms and Mission List articles and combines it together into a finished module.

I unfortunately do not have nearly enough time at current to rewrite the article, but the underlying concepts are fairly simple to interact with - you're entirely welcome to write a new version!
zonkmachine
Posts: 40
Joined: Mon Sep 20, 2021 3:18 pm

Re: Updating the wiki mission scripting tutorial

Post by zonkmachine »

Thank you for the feedback!
sturnclaw wrote: Thu Jan 16, 2025 10:24 pm - On the main Introduction page: assignments to global variables without explicitly accessing _G are not visible to other scripts. Pioneer gives each Lua file a separate "environment" (the Lua _ENV variable) which "shadows" the actual global table. If you want to export something to other scripts, you have to assign it as _G.SomeExport = MyValue. This is done so that inadvertent omissions of the "local" keyword don't break the execution environment of other scripts.
- Also on that same page, we no longer have Lua-based model file definitions and are deprecating Lua-based custom systems, so there are only two distinct Lua interpreters now - one for faction definitions and one for the main game.
- The link to the CodeDoc on the Event page should probably directly link to the codedoc page for data/libs/Event.lua as it contains a list of available events...
OK. Can you edit the wiki? I wouldn't know how to word this.
sturnclaw wrote: Thu Jan 16, 2025 10:24 pm The Surviving a Reload page would definitely need some work. It's not written as a step-by-step tutorial for new programmers, only shows the "skeleton" of a mission module, and assumes familiarity with the existing mission structure. Ideally a new version should be written which builds off of the code shown in the BBS Forms and Mission List articles and combines it together into a finished module.

I unfortunately do not have nearly enough time at current to rewrite the article, but the underlying concepts are fairly simple to interact with - you're entirely welcome to write a new version!
OK. I'll try and see if I can come up with something better.
Post Reply