I'm looking over the tutorial again and it's seeing issues since last time.
After #5619 / Implement manual docking with orbital, some of the script examples has stopped working.
We use onShipDocked to connect the simpler test scripts to the game. and this seem to no longer work.
Just save this in data/modules/ and start Pioneer.
print("This message will show up in the log")
local Comms = require 'Comms'
local Event = require 'Event'
local onShipDocked = function ()
Comms.Message ('This message will not show up in comms')
end
Event.Register("onShipDocked", onShipDocked)
This is not just an artifact of "onShipDocked" event not being triggered if starting a new game with ship already docked? (I beleive that change was made "recently")
Anyway, I applaude the effort of bringing the wiki more up to date
impaktor wrote: ↑Fri Jul 05, 2024 6:39 pm
This is not just an artifact of "onShipDocked" event not being triggered if starting a new game with ship already docked?
git bisect pointed to this PR but maybe that's where it happened. Any idea what other event could act as a substitute?
I see that sturnclaw already recommended creating a timer and I'll look into that method but I would like to try and find a simpler method for someone starting out with scripting.
In my mind what would be needed is an event from when the game clock starts running. What onGameStart sounded like to me when I started out.
impaktor wrote: ↑Fri Jul 05, 2024 8:48 pm
You could just add a note (and test that it is true): message will be shown next time player initiates docking / landing.
I would consider splitting onGameStart into two different events. In my mind when I see onGameStart I think of game time 0, when the clock start ticking away. Maybe split it into onGameLoad, for when a game is loaded, and onGameStart, which would be akin to a default timer set to go off at time 0? At least I think it would make sense for the scripting tutorials.
Btw, wiki code examples and such will sooner or later become obsolete.
I'd advice to add to the modding wiki, to encourage the student to look at simple modules we have, like the Advice module, 100 lines of code. then look at DonateToCranks for some menu interactions, and DeliverPackage for missions.