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?

    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.

  2. #2
    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

  3. #3
    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.

  4. #4

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

    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.
    Last edited by Bardo; 12-03-2007 at 11:52.

  5. #5
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default 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! )
    Not used mods before? Looking for something small and fun?!
    Download the:

  6. #6
    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?

    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:

    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.

  7. #7
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

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

    In addition to what you had with slight adjustment:
    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
    Not used mods before? Looking for something small and fun?!
    Download the:

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