The problem in both of the above scripts is that 'if' statements only accept conditions with I_ in front of them. The reason is that the monitor doesn't send information to contained 'if' or 'while' statements, so this line:
Code:
if SettlementBuildingExists = fairground
Doesn't know which settlement, if any, is being referred to, since it isn't getting the information it needs from the monitor. The conditions which start with I_, the most common of which is I_EventCounter, all specify their own parameters and are this Independent of a monitor(not sure if that's what the I means, but it's a fine way to remember it). This enables them to work within each other and within monitors since they demand that you provide all the information they need to determine if the condition is true or false.
So for the above you'd need separate monitors for every settlement for every building level, if you wanted to handle it in that way.
Another problem which is a common misconception is that the EDB, or any file besides scripts for that matter, can read counters or event counters besides 0/1. If an event counter is > 0 as far as the EDB/EDCT/EDA/etc. are concerned it's 1. To remedy this you'd need something along the lines of:
Code:
declare_counter smo_tra_lvl
; do the above line elsewhere outside a monitor
set_event_counter smo_tra_lvl_1 0
set_event_counter smo_tra_lvl_2 0
set_event_counter smo_tra_lvl_3 0
set_event_counter smo_tra_lvl_4 0
set_event_counter smo_tra_lvl_5 0
set_event_counter smo_tra_lvl_6 1
if I_CompareCounter smo_tra_lvl == 1
set_event_counter smo_tra_lvl_1 1
end_if
if I_CompareCounter smo_tra_lvl == 2
set_event_counter smo_tra_lvl_2 1
end_if
if I_CompareCounter smo_tra_lvl == 3
set_event_counter smo_tra_lvl_3 1
end_if
if I_CompareCounter smo_tra_lvl == 4
set_event_counter smo_tra_lvl_4 1
end_if
if I_CompareCounter smo_tra_lvl == 5
set_event_counter smo_tra_lvl_5 1
end_if
if I_CompareCounter smo_tra_lvl == 6
set_event_counter smo_tra_lvl_6 1
end_if
I recommend using counters for things which don't directly translate to the EDB or other files. It's not necessarily proven but is logically assumable that they take up less memory than event counters. If that were not the case they may as well have been deprecated when event counters got more streamlined. They're also automatically logged in the script log.
Are those buildings you want to base it off separate trees or buildings within the same tree? If they're separate trees you can do all of that directly in the EDB. If separate buildings in the same tree, then it would be a lot more complex and probably not worth the effect, especially since I'm unsure how it's supposed to act on itself.