Hi, I have a couple of questions.
1) I read somewhere that wait shouldn't be used inside a monitor. Is this correct? It might have been a RTW thread that I read that in.
2) I have seen some examples of I_TimerElapsed being used that goes something like this...
(If advisor is showing and has been for 10+ seconds then flash its dismiss button.)Code:monitor_event {...} {...stuff...} restart_timer Campaign_Map_Timer while I_AdvisorVisible monitor_conditions I_TimerElapsed Campaign_Map_Timer > 10000 ui_flash_start advisor_dismiss_button terminate_monitor end_monitor end_while end_monitor
I'm wondering why the embedded monitor_conditions. Is it simply a more elegant way of doing the following? (i.e. Uses less lines of code and no extra counter.)
Also, is it bad practice to have something like the following in campaign_script?Code:monitor_event {...} {...stuff...} restart_timer Campaign_Map_Timer set_event_counter dismiss_is_flashing 0 while I_AdvisorVisible if I_EventCounter dismiss_is_flashing == 0 and I_TimerElapsed Campaign_Map_Timer > 10000 ui_flash_start advisor_dismiss_button set_event_counter dismiss_is_flashing 1 end_if end_while end_monitor
This monitor_conditions never terminates but only does something when a flag is set. It seems like a bad idea to me because the monitor_conditions is being evaluated however-many-times-per-second even if its conditions don't evaluate to true, which would add CPU overhead for the lifetime of the campaign. Am I correct in that?Code:declare_timer my_timer monitor_event {...} restart_timer my_timer set_event_counter test_if_timer_has_elapsed 1 end_monitor monitor_conditions I_EventCounter test_if_timer_has_elapsed == 1 and I_TimerElapsed my_timer > 5000 set_event_counter test_if_timer_has_elapsed 0 {...do something...} end_monitor
I tried it while watching Task Manager and it didn't seem to increase CPU usage, but I can't say for sure.
Any help is appreciated. Thanks.




Reply With Quote





