News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

[command_x] The designated building can not be built

Started by Shirakami, July 17, 2017, 11:46:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shirakami

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)
}


Shirakami

Thanks for the advice!
However, I could not build a commercial building.

Shirakami

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.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Shirakami

I did not know how to write the correct parameters.
Thank you!  :)