Here's the code I'm using now:

Spoiler Alert, click show to read: 

script

;This ends the turn, but doesn't keep working thereafter
;monitor_event FactionTurnStart FactionType romans_julii
;and I_TurnNumber < 5
;simulate_mouse_click lclick_down
;simulate_mouse_click lclick_up
;console_command add_money 10000
;terminate_monitor
;end_monitor

;Every time I run this script, it takes me to the very next turn, which is good
console_command control egypt
console_command add_money 1000
campaign_wait 60
console_command control romans_julii

end_script


There are two tasks that I still need to complete:

1. Figure out how to loop this script, so that it keeps advancing turns under AI control until it reaches a certain turn number.

2. Create triggers to switch control temporarily to another faction whenever a dialog box pops up (eg a treaty negotiation, or battle, or adoption box).

Can anyone help with #1? Please? I'm guessing it has something to do with monitors and whiles, but I just don't get it.