Results 1 to 30 of 42

Thread: Can I use a script to end the turn?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    It occurs to me that I could use the same counter for both land and sea battles, and just create two separate triggers for activating that counter. I might do that, if only for the sake of efficiency.

    But getting rid of the battle results screen is the key concern. Do you think I could just nerf the entire UI while the script is running?

  2. #2
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    Here's the more efficient version. It also has an automatic scroll-closer implemented, but I still haven't figured out a way of automatically closing the battle results. Gah!

    script
    ;
    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
    console_command clear_messages
    console_command control greek_cities
    console_command add_money 40000
    end_monitor
    ;
    monitor_event FactionTurnStart FactionType greek_cities
    console_command clear_messages
    console_command control romans_julii
    console_command add_money 40000
    inc_counter loop 1
    end_monitor
    ;
    monitor_event PreBattlePanelOpen TrueCondition
    set_counter clickAutoResolve 1
    end_monitor
    ;
    monitor_event NavalAutoResolvePanelOpen TrueCondition
    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
    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
    ;
    monitor_event DiplomacyPanelOpen TrueCondition
    set_counter declineDiplomaticOffer 1
    end_monitor
    ;
    monitor_conditions I_CompareCounter declineDiplomaticOffer = 1
    select_ui_element confirm_quit_scroll

    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up
    end_monitor
    ;
    while I_CompareCounter loop < 5
    end_while
    ;
    console_command control egypt
    console_command clear messages
    ;
    end_script

  3. #3
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Can I use a script to end the turn?

    Sorry, I can't help you.

    Even I don't understand why the game changes the turn simply by changing the faction controlled.

    I wonder if the factions involved in this system of changes make any movement and when.

  4. #4
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default 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.

  5. #5
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default 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.

  6. #6
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default 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

  7. #7
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO