Essentially the end state I want to reach is to create scenarios with more scripting, and working with the tutorial seems like a good base because all the scripts seem to work there.
Some scripts seem to work in other scenarios, but not reliably. For example, if I take the 1750 Start scenario and put this script:
function tutorial_turn_callback(turn, year)
if turn == 1 then
notify.event(nil, nil, E.SCRIPT,
_("Welcome to Freeciv. You lead a civilization. Your\ntask is to conquer the world! You should start by\nexploring the land around you with your explorer,\nand using your settlers to find a good place to build\na city. Use the number pad to move units around."))
end
end
signal.connect('turn_begin', 'tutorial_turn_callback')
in the
[script]
code=$
…
$
It won't execute if pasted into the 1750 start scenario. More testing indicated that it doesn't seem to work in any scenario other than the tutorial scenario, where most other scripts seem to work fine. What might be getting in the way of this?
What I *really* want to do is re-create the old World of Jules Verne from Civ 2 inside FreeCiv, and the only real barrier I can see to that is unlocking the secret of scripting in FreeCiv.
I'm aware of the
https://freeciv.fandom.com/wiki/Event_Scripting page, and it's great. All the code there can be pasted in reliably and it will function. But the fact I can't take the turn == 1 code from the tutorial to create a basic 'welcome' message in a scenario is something I find vexing.
I've attached the file as a rar if you want to look at it.