In regards to the Freeciv Lua reference manual at: http://freeciv.fandom.com/wiki/Lua_reference_manual
The event "turn_begin" is shown as having been introduced in Freeciv 3, which is why I didn't use that and instead used "turn_started" since I run Freeciv 2.6.4, however when I tried "turn_begin", I found that it does work in Freeciv 2.6.4 without error.
Freeciv Lua reference manual online - turn_begin
-
- Hardened
- Posts: 158
- Joined: Fri Jul 02, 2021 4:00 pm
Re: Freeciv Lua reference manual online - turn_begin
I checked current S2_6 sources, and no, there's no turn_begin there.
Where you've got your freeciv? If you have not compiled it yourself (from freeciv.org sources), maybe the distributor has backported "turn_begin"
Where you've got your freeciv? If you have not compiled it yourself (from freeciv.org sources), maybe the distributor has backported "turn_begin"
-
- Hardened
- Posts: 158
- Joined: Fri Jul 02, 2021 4:00 pm
Re: Freeciv Lua reference manual online - turn_begin
This in regarding your post at this link: http://forum.freeciv.org/f/viewtopic.php?p=108824
^ I changed the only occurrence of "turn_started" to "turn_begin" and it worked. After reading your last message, I changed it again to "lost_weekend", and that also worked. So it isn't that turn_begin is recognized by Freeciv 2.6.4, but rather that 2.6.4 doesn't error or complain regardless of what I use there. The script still runs successfully with either turn_begin or turn_started.cazfi wrote: ↑Sat Oct 14, 2023 5:23 pm Loaded these 7 scenarios with "--warnings" to freeciv-3.0, and the only notable warning was about lua signal deprecated in 3.0 in two of them. But as long as you want to keep these compatible with 2.6 too, can't really fix that.Code: Select all
2: Deprecated: lua signal "turn_started", deprecated since "3.0", used. Use "turn_begin" instead
^ That worked. So did turn_begin, and so did turn_started.end
signal.connect('lost_weekend', 'turn_callback')
$
vars=$
Re: Freeciv Lua reference manual online - turn_begin
Ok. So when you said "worked", it didn't mean that the functionality is there.
Yeah, it's not an error to connect to a signal that is not currently not defined. Not sure if we could make it an error - at least (AFAIK) there's no mechanism for user to define their own signals, so it shouldn't be like that we have to be prepared for signals appearing later.
Yeah, it's not an error to connect to a signal that is not currently not defined. Not sure if we could make it an error - at least (AFAIK) there's no mechanism for user to define their own signals, so it shouldn't be like that we have to be prepared for signals appearing later.
-
- Hardened
- Posts: 158
- Joined: Fri Jul 02, 2021 4:00 pm
Re: Freeciv Lua reference manual online - turn_begin
Yes, thank you. As for the error "turn_started", deprecated since "3.0" the easy fix is to use turn_begin since it isn't an error in 2.6.4 and is thus still compatible, and will avoid the 3.0 error message.
Re: Freeciv Lua reference manual online - turn_begin
Well, you are never receiving that signal in 2.6. That's leaving some scenario functionality out from 2.6.Molo_Parko wrote: ↑Sun Oct 15, 2023 2:38 pm Yes, thank you. As for the error "turn_started", deprecated since "3.0" the easy fix is to use turn_begin since it isn't an error in 2.6.4 and is thus still compatible, and will avoid the 3.0 error message.
If you want the scenario to work both on 2.6 and 3.0 (and all the way to current development version), you should actually keep on using turn_started. It's deprecated, but not yet obsoleted, and gives only a warning (not an error), and even that warning appears only with deprecation --warnings enabled (in practice; not to end-users, but only to people who really want to check such warnings)
-
- Hardened
- Posts: 158
- Joined: Fri Jul 02, 2021 4:00 pm
Re: Freeciv Lua reference manual online - turn_begin
Ahh, got it! Thank you again, that will save me from some future headaches.
-
- Posts: 1
- Joined: Tue Mar 05, 2024 6:10 am
- Contact:
Re: Freeciv Lua reference manual online - turn_begin
Was the usage of "turn_begin" in Freeciv 2.6.4 merely accepted without causing an error, or did it actually provide the intended functionality?