Hello!
I wanted to create a script that uses AI scripts to simulate the building of multiple tile city buildings.
Specifically, it is a script that divides the building of two tiles into two, building one building when building one building, and building the other building next to it.
But with the current function, you can not specify the name of the building.
Will you be able to specify the name of the building in the future?
Place a script to build the specified building at the specified location.
function step()
{
local pos = square_x(80, 80).get_ground_tile()
local w = command_x(tool_build_house)
local buildingName = "myHouse"
local err = w.work(pl, pos, buildingName)
}
If the building allows renaming you can call set_name.
http://dwachs.github.io/simutrans-sqapi-doc/group__rename__func.html
Thanks for the advice!
However, I could not build a commercial building.
As a result of searching, I found out that by changing the code below.
simtool.cc / line 5265
- const char *c = default_param+2;
+ const char *c = default_param;
With this I can build the building I want.
Thanks for posting! Would be interesting to see your script in action :)
The default parameter for the build_house tool is
I + R + "name"
where
I = one character: '1' to ignore climate requirements, all other chars: respect climate requirements
R = one character indicating rotation of building: '0'-'3' specific rotation, '#' random rotation, 'A' automatic alignment to roads for city buildings
name = name of building
If you replace the call to work by
local err = w.work(pl, pos, "0#" + buildingName)
you should be on the safe side.
I did not know how to write the correct parameters.
Thank you! :)