Re: Can I use a script to end the turn?
Quote:
Originally Posted by Monkwarrior
I wonder if the factions involved in this system of changes make any movement and when.
They do. The script wouldn't have much point otherwise.
I wrote a couple of drafts to try and explain why it works, but they all got a bit cumbersome. Briefly, there's an order in which factions take their turns, and it loops. What happens in this mod is:
1. The AI plays for any faction that isn't you until it's your turn.
2. The script waits until it's your turn, and then makes "you" into someone else who is later in the turn sequence.
3. The AI plays for any faction that isn't you until it's your turn.
Rinse, lather, repeat. Every faction has "its turn" played by the AI. The only weakness is that if someone does something to your faction when it's not your faction's turn and you have to respond... well, you're still in charge of the faction and you have to respond.
I've more or less finished dealing with this weakness, though. The script now autoresolves battles and dismisses diplomacy windows.
Re: Can I use a script to end the turn?
Incidentally, I did a whole bunch of experiments with the -ai command line. I think what makes it weird is that a game started under -ai can't load any scripts.
Re: Can I use a script to end the turn?
nor can you continue a game after starting it with the -ai command, you can after taking some actions, but you cant just press the turnbutton after disabling the AI again, or at least I couldnt after freezing the AI using the "halt_ai (optional; faction)" as the players turn would end but the AI never actually started its turn ....
G
Re: Can I use a script to end the turn?
If you use "console_command control faction" rather than halt_ai, the ai seems to keep playing turns for all of the other factions.
I've been trying to figure out whether the -ai switch turns off something that can be turned on again, so far as getting scripts running again goes. No progress yet.
Re: Can I use a script to end the turn?
Quote:
Incidentally, I did a whole bunch of experiments with the -ai command line. I think what makes it weird is that a game started under -ai can't load any scripts.
I can confirm that you can use a background_script with the -ai command if you launch it automatically using the Campaign script. You know:
Quote:
advance_advice_thread Background_Script_Thread no_dismiss
wait 1
select_ui_element advisor_portrait_button
simulate_mouse_click lclick_up
So then, you can use the script to halt the game the turn you want to control any faction using the command:
"console_command control faction"
I posted it in a similar thread of this forum when I discovered it, I'm sorry I have not read this topic before to explain it here.
I have been using this way to debug my scripts and the campaign balance for long time now, with great results.
BTW, as Red Spot always says, I can also confirm that you don't need to use the combo with "simulate_mouse_click lclick_down", just needed the click_up.
Re: Can I use a script to end the turn?
mrtwisties, apologies if I've slightly lost track of where you've got to with this.
Does your version give you an autosave you can re-load do you know?
I'm running testing at the moment with script automatically launched from campaign script and then also triggering ER's year jump script to go on 200 turns (BI mod), that works fine for balance issues, but I'm getting occassional CTD about 140 turns in which is probably script generated unfortunately. It autosaves whilst on year jump but save doesn't seem to know who you are so crashes if trying to re-load. I could really do with being able to re-load before CTD as never manage to be watching campaign at right point to see what problem area is otherwise. (watching campaign prevents CTD occuring, it just happens as soon as you get distracted! :wall: )
Re: Can I use a script to end the turn?
Hey Makanyane. It's neither implemented nor tested yet, but for that very reason I've mocked up some code that auto-saves once every four turns.
I'm still working on getting the core module working. I've reworked it so that hopefully it can be spliced into another script (like the EB background script) and still function, but I still need to find a way to auto-resolve diplomacy and auto-dismiss the battle results screen. Here's what the script looks like:
Quote:
script
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Jumpity Jumpity Jump Jump Jump
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare_counter loop
declare_counter clickAutoResolve
declare_counter DismissScroll
declare_counter declineDiplomaticOffer
set_counter loop 0
set_counter clickAutoResolve 0
set_counter DismissScroll 0
set_counter declineDiplomaticOffer 0
;
monitor_event FactionTurnStart FactionType romans_julii
and I_CompareCounter loop < 4
console_command clear_messages
console_command control greek_cities
end_monitor
;
monitor_event FactionTurnStart FactionType greek_cities
and I_CompareCounter loop < 4
console_command clear_messages
console_command control romans_julii
inc_counter loop 1
end_monitor
;
monitor_event PreBattlePanelOpen TrueCondition
and I_CompareCounter loop < 4
set_counter clickAutoResolve 1
end_monitor
;
monitor_event NavalAutoResolvePanelOpen TrueCondition
and I_CompareCounter loop < 4
set_counter clickAutoResolve 1
end_monitor
;
monitor_conditions I_CompareCounter clickAutoResolve = 1
set_counter clickAutoResolve 0
select_ui_element prebattle_auto_resolve_button
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up
end_monitor
;
monitor_event ScrollOpened ConditionTrue
and I_CompareCounter loop < 4
set_counter DismissScroll 1
end_monitor
;
monitor_conditions I_CompareCounter DismissScroll = 1
set_counter DismissScroll 0
select_ui_element confirm_quit_scroll
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up
end_monitor
;
;None of this diplomacy stuff works
;
;monitor_event ScrollOpened diplomacy_scroll
;set_counter declineDiplomaticOffer 1
;end_monitor
;
;monitor_event DiplomacyPanelOpen TrueCondition
;set_counter declineDiplomaticOffer 1
;end_monitor
;
;monitor_conditions I_CompareCounter declineDiplomaticOffer = 1
;set_counter declineDiplomaticOffer 0
;select_ui_element confirm_quit_scroll
;simulate_mouse_click lclick_down
;simulate_mouse_click lclick_up
;end_monitor
;
monitor_conditions I_CompareCounter loop = 4
console_command control egypt
console_command clear messages
terminate_monitor
end_monitor
while loop < 5
end_while
end_script
I can't even get the diplomacy or battle-result monitors working, at the moment. Haven't really had a chance to make any progress in the last few days, though.
Re: Can I use a script to end the turn?
In addition to what you had with slight adjustment:
Quote:
monitor_event DiplomacyPanelOpen TrueCondition
set_counter declineDiplomaticOffer 1
end_monitor
monitor_conditions I_CompareCounter declineDiplomaticOffer = 1
set_counter declineDiplomaticOffer 0
select_ui_element diplomacy_decline_offer_button
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up
end_monitor
declines the diplomacy offer, I just can't figure out how to quit the scroll
I think the one you're trying to use
select_ui_element confirm_quit_scroll
is actually the "do you really want to leave the game, yes or no" scroll
but can't figure out what button for just escaping scroll actually is :wall:
Re: Can I use a script to end the turn?
I know what you mean. Have mostly got the monitors working. But I think I've tried every single ui_element that looks even vaguely like it might work to close those scrolls. I've even been making up names!
Am no longer convinced that this approach can work. Might try:
1. Using another utility to automate pressing "enter" and "esc" every few seconds. These keypresses would be sufficient to kick things along, but I don't think you'd be able to do anything else with the computer while the year jump was taking place. Not sure, I've never used a utility like that before. Hmmm, I haven't actually tried telling the RTW script to press keys, so maybe that's also worth a go. There do seem to be some key names in descr_shortcut.txt.
2. Using campaign scripts to try and unlock the features that are suppressed by the -ai switch. Using "console_command control factionname" in a campaign script does give you control - but it means that show_me scripts don't work thereafter. Maybe there's a way of fixing that? It'd be good if there was.
3. Killing a faction, switching control to it and then having that faction "re-emerge" (ie "capture_settlement") later in the game. Clearly a sub-optimal solution.
4. Using emergent factions and ER's BI-based year jump mod. My least favourite approach.
Re: Can I use a script to end the turn?
Quote:
Originally Posted by mrtwisties
3. Killing a faction, switching control to it and then having that faction "re-emerge" (ie "capture_settlement") later in the game. Clearly a sub-optimal solution.
Not really sure if that will work, afaik once a faction is dead it can be respawned, but so far I've been unable to "re-activate" it (they're arent doing a thing ...)
G
Re: Can I use a script to end the turn?
Quote:
1. Using another utility to automate pressing "enter" and "esc" every few seconds. These keypresses would be sufficient to kick things along, but I don't think you'd be able to do anything else with the computer while the year jump was taking place. Not sure, I've never used a utility like that before. Hmmm, I haven't actually tried telling the RTW script to press keys, so maybe that's also worth a go. There do seem to be some key names in descr_shortcut.txt.
not sure on external utility - if you hit esc when there isn't screen to close you'll be going in and out of the menu screen. If you can do it inside script it would work though with a wait after the resolve event but within the same monitor.
Quote:
4. Using emergent factions and ER's BI-based year jump mod. My least favourite approach.
Well, that was where I was, works to test balance to end of fixed period (assuming you have spare factions), is compatible with background script if you launch year jump from trigger in bg script. Just doesn't get you usable autosave :wall:
That seems to be main snag - to get a usable save it has to be legitimately your turn, if its your (human controlled) turn you get the closing scroll problem.
Re: Can I use a script to end the turn?
Quote:
Originally Posted by Makanyane
not sure on external utility - if you hit esc when there isn't screen to close you'll be going in and out of the menu screen. If you can do it inside script it would work though with a wait after the resolve event but within the same monitor.
Have been busy for the last few days, but was thinking of "stealing" the escape key, except for when one of those pesky scrolls pops up.