Topic: Get general statistics as variables

Sauss-Ente
Avatar
Topic Opener
Joined: 2025-06-15, 22:00 UTC+2.0
Posts: 7
OS: Windows 7 / Linux
Version: 1.2.1
Ranking
Pry about Widelands
Location: At the Elbe
Posted at: Yesterday 19:51 UTC+2.0

Is it possible to use all the values in the general statistics as a variable in a .lua script? For example military points or land. Does something like this exist: p1:get_militarysize? p1:get_landsize?

For context: I'm fiddling around with the script files of the second Atlantean campaign level. There we have a function being called "get_produced_wares_count", which sounds like it goes in the right direction. Where do I find a list of all possible kinds of functions? In the search on the Widelands documentation? https://www.widelands.org/documentation/search/?q=get_produced_wares_count doesn't show a result though.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07 UTC+1.0
Posts: 2169
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: Yesterday 21:09 UTC+2.0

The function can't be found by the search as it is unfortunately misspelled in its documentation face-surprise.png
Here it is: https://www.widelands.org/documentation/autogen_wl_game/index.html#wl.game.Player.produced_wares_count

The full reference is here: https://www.widelands.org/documentation/reference/
with the entries in "core functionality" describing the main built-in functionality, and "Auxiliary Scripts" additional Lua functions built on top of those.

IIRC not all statistics are currently accessible from Lua.


Top Quote