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?

    The -ai thing totally works. I just took over a Julii campaign in 168 BCE. Then I saved it. Then I closed RTW. Then I loaded it and played for a bit.

    Totally. Works.

  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?

    afaik the -ai switch will not work properly ...

    at least I've ran a zillion games with the -ai switch and there is always "something" that makes me believe there is some diff. (dont ask me what, I just wouldnt risk it, the -ai switch clearly hasnt been intended to jump a campaign ... my advise, dont use it as such)


    also about the "simulate_mouse_click lclick_down/up" ... afaik you do not need both, dont know where people got the 2nd command from but I'm not using it and have the same results ...


    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?

    You're right. When I implemented the -ai switch in EB, I couldn't get the EB background script to work, even when I turned the ai switch off and reloaded the game.

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

    just wondering, what are you trying to do?

    make some sort of randomised start?

    if so, there are easier ways imo, wich again leave slightly more of the control in your hands ...

    like I've partially set up my game, take traits and ancillaries, I've made a few hidden traits, where one is used only in descr_strat, it is given to starting families wich than at characterturnstart get a random collection of traits

    like so;
    Code:
    ;------------------------------------------
    Trigger game_startup2
        WhenToTest CharacterTurnStart
    
        Condition IsGeneral
              and Trait RS_StartGame >= 1
    
        Affects RS_StopGame  1  Chance  100 
        Affects RS_Management  1  Chance  30 
        Affects RS_Influence  1  Chance  30 
        Affects RS_Law  1  Chance  30 
        Affects RS_Trading  1  Chance  30 
        Affects RS_TaxCollection  1  Chance  30 
        Affects RS_TrainingAgents  1  Chance  30 
        Affects RS_TrainingUnits  1  Chance  30
    the stopgame trait prevents it giving traits again as its the startgame trait's antitrait, together with some random augmentation of the traits the generals get in descr_strat
    wich together wich some other settings creates a mild feel of a diff game each "turn 0" (gamestart), scripts can even do the same with entire factions


    G

  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?

    Hi RedSpot, I explained what I'm trying to do a bit more clearly in posts 9 and 11. It's not just about a randomised start - it's about starting the game at a whole new point in history, when the factions are a little more developed.

    Since the -ai switch seems a bit buggy, I'm having another crack at my original script. What I'd really like to do now is to set up code to have the AI deal with battles and diplomacy.

    Here's my script at the moment:

    script

    declare_counter loop
    set_counter loop 0

    monitor_event FactionTurnStart FactionType romans_julii
    and I_TurnNumber < 5
    console_command control greek_cities
    campaign_wait 10
    console_command add_money 40000
    console_command control romans_julii
    end_monitor

    ;monitor_event PreBattlePanelOpen
    ;console_command puppify_my_love
    ;end_monitor

    ;monitor_event NavalAutoResolvePanelOpen
    ;console_command puppify_my_love
    ;end_monitor

    ;monitor_event DiplomacyMission
    ;console_command puppify_my_love
    ;end_monitor

    ;monitor_event ScrollOpened
    ;console_command puppify_my_love
    ;end_monitor

    while I_CompareCounter loop = 0
    end_while

    end_script
    If I take out the comments on my new monitor_events, RTW 1.5 CTDs as it loads (presumably when it tries to load this script). But these events are in the docudemon - can anyone tell me what I'm doing wrong?

  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?

    The script is pretty much working. I ripped off some of the code from the EB team - it automatically resolves land and sea battles and exits from diplomacy screens. I still need to:

    1. Figure out a way to automatically dismiss the battle results scroll after a land or sea battle.
    2. Figure out a way to automatically dismiss all the other scrolls that pop up (blah blah senate mission, etc). They don't pause the turn sequence, but they do create lag.

    Here's the code, I'd be very grateful if anyone could help:

    script
    ;
    declare_counter loop
    set_counter loop 0
    ;
    declare_counter clickAutoResolve
    set_counter clickAutoResolve 0
    ;
    declare_counter clickAutoResolveNaval
    set_counter clickAutoResolveNaval 0
    ;
    declare_counter declineDiplomaticOffer
    set_counter declineDiplomaticOffer 0
    ;
    monitor_event FactionTurnStart FactionType romans_julii
    console_command control greek_cities
    console_command add_money 40000
    end_monitor
    ;
    monitor_event FactionTurnStart FactionType greek_cities
    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_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 NavalAutoResolvePanelOpen TrueCondition
    set_counter clickAutoResolveNaval 1
    end_monitor
    ;
    monitor_conditions I_CompareCounter clickAutoResolveNaval = 1
    set_counter clickAutoResolveNaval 0
    select_ui_element prebattle_auto_resolve_button
    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
    ;
    end_script

  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?

    The script is pretty much working. I ripped off some of the code from the EB team - it automatically resolves land and sea battles and exits from diplomacy screens. I still need to:

    1. Figure out a way to automatically dismiss the battle results scroll after a land or sea battle.
    2. Figure out a way to automatically dismiss all the other scrolls that pop up (blah blah senate mission, etc). They don't pause the turn sequence, but they do create lag.

    Here's the code, I'd be very grateful if anyone could help:

    script
    ;
    declare_counter loop
    set_counter loop 0
    ;
    declare_counter clickAutoResolve
    set_counter clickAutoResolve 0
    ;
    declare_counter clickAutoResolveNaval
    set_counter clickAutoResolveNaval 0
    ;
    declare_counter declineDiplomaticOffer
    set_counter declineDiplomaticOffer 0
    ;
    monitor_event FactionTurnStart FactionType romans_julii
    console_command control greek_cities
    console_command add_money 40000
    end_monitor
    ;
    monitor_event FactionTurnStart FactionType greek_cities
    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_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 NavalAutoResolvePanelOpen TrueCondition
    set_counter clickAutoResolveNaval 1
    end_monitor
    ;
    monitor_conditions I_CompareCounter clickAutoResolveNaval = 1
    set_counter clickAutoResolveNaval 0
    select_ui_element prebattle_auto_resolve_button
    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
    ;
    end_script

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

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