Hi, script lovers
I think that I have the correct syntax for a script that allows the espionage of technologies from a more developed civilization.

This is my currently working script:
Code:
script

declare_counter loop
declare_counter wall_dacia
set_counter wall_dacia 1

monitor_event CharacterTurnEnd AgentType = spy
	and FactionType dacia
	and SettlementBuildingExists >= stone_wall

	set_counter wall_dacia 2
	console_command toggle_perfect_spy

	terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType dacia
	and I_CompareCounter wall_dacia = 2

	advance_advice_thread Stone_Wall_Tech_Thread no_dismiss
	campaign_wait 30

	terminate_monitor
end_monitor

monitor_conditions I_CompareCounter wall_dacia = 2
	and I_SettlementOwner Mediolanium = dacia

		console_command create_building Mediolanium wall_tech

	terminate_monitor
end_monitor

monitor_conditions I_CompareCounter wall_dacia = 2
	and I_SettlementOwner Segesta = dacia

		console_command create_building Segesta wall_tech

	terminate_monitor
end_monitor

while I_CompareCounter loop = 0
end_while

terminate_script
In the test, Mediolanium was owned by dacians, but Segest not. The spy arrived to Rome in the second turn, but there was no message at all. It was at the beginning of the next turn when the advisor appeared. (I think I also succeeded in finding the correct parameters for the advice to appear in each campaign). The prerequisite building was built in Mediolanium, but not in Segesta (toggle_perfect_spy is only to be sure of that point). I gathered an important army and conquered Segesta from the romans hands, and immediately the prerequisite building was there.

Now it would be necessary to put the monitor_condition for all the settlements in the campaign map. After that it would be necessary to declare one new counter for each faction and repeat the whole thing as many times as factions are in the campaign map.

At the moment there is only one problem that strikes me:
the prerequisite building is present in one settlement, but it is the symbol for a technology owned by the faction. However, when the settlement is conquered by other faction, this prerequisite already exists, although this new faction hasn't the technology.
Could this building be authomatically destroyed if the settlement is lost by the faction?