Topic: Understanding Lua Scripts
toptopple Topic Opener |
Posted at: 2016-06-16, 21:27
I like to understand Lua scripts better. For instance if we take the following function
1) "--" is a comment line? 2) How does "consume=coal iron planks" exactly work, including any programmed delays? Top Quote |
kaputtnik |
Posted at: 2016-06-16, 22:06
Yes.
This is just a list of wares which the building/worker consumes to produce the spear. Other weapons/tools may require more resources. F.e.you will find in empire/weaponsmithy:
Producing a war spear will cost 2 coal, 1 gold, 2 iron and one plank. Delays are managed through the values in "sleep=32000", and "animate=working 45000" (4500). But i am not sure though Fight simulator for Widelands: |
SirVer |
Posted at: 2016-06-18, 18:11
Some quick history: before we had Lua scripting, we had our own configuration file language. We invented the command syntax that is listed under I think you should start skimming through the documentation which touches on Widelands engine and on scripting: https://wl.widelands.org/docs/wl/. For convenience, here are direct links:
Top Quote |
toptopple Topic Opener |
Posted at: 2016-06-19, 14:27
Thank you for the hints, I had a brief look at it! I have developed in my spare time a script solution for what I regard the "notorious production delays" in the smelting-works and the various smithies! I found the current situation not desirable and even not intended. I filed a bug report long time ago but basically found the same situation again. E.g. smelting-works: if you supply only iron ore (provided coal is amply available) you reach productivity of max. 70% which correlates to the 2 iron calls vs. 1 gold call in a single action round. Likewise I predict - though not tested - that you reach only 40 % productivity when only gold is supplied. Similar delays occur in the smithies which likewise produce multiple products in dependence of various input constraints. In my solution both the smithies and the smelting-works operate incessantly, undelayed. The solution has a backlash as statistics don't work correctly and don't reflect the new industriousness. So statistics would have to be readjusted somehow. I can't add to the "how" because I don't understand them. If you are interested in this solution I could open a separate thread for it. If on the other hand you say "no, this is ok as it is" then I will drop it. Top Quote |
GunChleoc |
Posted at: 2016-06-20, 19:42
It would be interesting to have a link to the bug and to see your solution so far Busy indexing nil values Top Quote |