I found this thread being relevant to a coding problem I had, namely that CurrentContent was not sufficient and i had to refactor and give more context information than I think is good. The idea to "anchor" to a reference object an to refer to that one in a macro sounds like it would have solved that problem.Geoff the Medio wrote:Yes, but I'd like to see a realistic example that can't be done with existing functionality... Like picking a reference object non-reproducibly, then selecting objects within some distance of the reference object as the scope, then doing something to the scope objects dependent on some property of the reference object. Or some combination of conditions in the scope that require the same other object that must be determined in a non-reproducible way.
Were such to be implemented, I'd probably have a separate reference_object = () line in the script, which is evaluated before the scope, and can be referenced in the scope condition, or within the effect scripts.
I wanted to write a ENQUEUE_BUILD_ONE_PER_EMPIRE which checks that a building is not enqueued somewhere else in the empire.
If there is a working alternative to CurrentContent i couldnt find it.
Check this commit diff, especially enqueue.macros - it shows how i had to add the name as a parameter
Should I open a feature request or something to allow collecting more examples?