Results 1 to 30 of 98

Thread: Scripting

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Scripting

    Ok here is a script which should be run from the beginning. It should end the script if the player presses the escape key and it is the first turn of a year. This will enable the player to save/load. He then needs to start up an identical script in the show_me folder. I haven't done that yet, and I haven't tested this one either. It may or may not work:

    Code:
    	declare_counter IsFirstTurn
    
    	monitor_event EscPressed TrueCondition	
    		and I_CompareCounter IsFirstTurn = 1	
    			end_script
    		terminate_monitor
    	end_monitor
    
    	console_command date -50
    		set_counter IsFirstTurn 1
    
    	while I_TurnNumber = 0
    	end_while
    
    	console_command date -50
    	console_command season summer
    		set_counter IsFirstTurn 0
    
    	while I_TurnNumber = 1
    	end_while
    
    	console_command date -50
    	console_command season summer
    
    	while I_TurnNumber = 2
    	end_while
    
    	console_command date -50
    	console_command season winter
    
    	while I_TurnNumber = 3
    	end_while
    
    	console_command date -51
    	console_command season summer
    		set_counter IsFirstTurn 1
    
    	while I_TurnNumber = 4
    	end_while
    
    	console_command date -51
    	console_command season summer
    		set_counter IsFirstTurn 0
    
    	while I_TurnNumber = 5
    	end_while
    
    	console_command date -51
    	console_command season summer
    
    	while I_TurnNumber = 6
    	end_while
    
    	console_command date -51
    	console_command season winter
    
    	while I_TurnNumber = 7
    	end_while
    
    	console_command date -52
    	console_command season summer
    		set_counter IsFirstTurn 1
    
    	terminate_script

  2. #2
    Altogether quite not there! Member GodsPetMonkey's Avatar
    Join Date
    Aug 2004
    Location
    Australia
    Posts
    839

    Default Re: Scripting

    I'm confused.

    I don't really see the point of running a script with campaign load, when the only way they are going to be able to save or load is if they end it, then when they do that, make them run a show me script in order to continue.

    Why not just get them to run a show me script from the very begining? You never need to worry about saveing/loading then, you wont need an exit clause, and they can do it at any time they choose. You do have to make them run the script every time they load a game of that campaign, but you have to do that either way.
    Caligula and Hadrian - Unit and Building editors for Rome: Total War.
    Now editing -
    export_descr_unit.txt, export_descr_unit_enums.txt, export_units.txt, descr_model_battle.txt
    export_descr_buildings.txt, export_descr_buildings_enums.txt, export_buildings.txt

  3. #3
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Scripting

    I guess so, I don't know why I did that then...

  4. #4
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Scripting

    Seeing as nobody else has done anything. I though I'd try and develop some of the ideas we had:

    First of all I made a new trigger in export_descr_advice.txt:

    Code:
    ;------------------------------------------
    Trigger 2123_fourseasons
        WhenToTest FactionTurnStart
    
        Condition FactionIsLocal
              and I_TurnNumber = 0
              and FactionType romans_julii
              and not I_MapName data/world/maps/campaign/sons_of_mars/descr_strat.txt
    
        AdviceThread Seasons_Thread  1
    Then I made a new thread above this:

    Code:
    ;------------------------------------------
    AdviceThread Seasons_Thread
        GameArea Campaign
    
        Item Seasons
            Suppressible y 
            Uninhibitable
            Verbosity  1 
            Priority  1 
            Threshold  1 
            MaxRepeats  100 
            RepeatInterval  1 
            Attitude Concerned
            Presentation Default
            Title Settlement_Rebels_Take_Action_Text_01_Title
            Script scripts\show_me\fourturns_script.txt
            Text Settlement_Rebels_Take_Action_Text_01_Text1
    This is just so that whenever you run a new game as the Julii (I guess that condition could be removed) the advisor asks you to run the script, I'll make a personalised text for it eventually.

    This is the script called fourturns_script.txt:

    Code:
    script
    
    	suspend_unscripted_advice true
    	suspend_during_battle on
    
    	console_command date -50
    	console_command season summer
    
    	while I_TurnNumber = 0
    	end_while
    
    	disable_shortcuts options_button true
    	console_command date -50
    	console_command season summer
    
    	while I_TurnNumber = 1
    	end_while
    
    	console_command date -50
    	console_command season summer
    
    	while I_TurnNumber = 2
    	end_while
    
    	console_command date -50
    	console_command season winter
    
    	while I_TurnNumber = 3
    	end_while
    
    	disable_shortcuts options_button false
    	console_command date -51
    	console_command season summer
    
    	while I_TurnNumber = 4
    	end_while
    
    	disable_shortcuts options_button true
    	console_command date -51
    	console_command season summer
    
    	while I_TurnNumber = 5
    	end_while
    
    	console_command date -51
    	console_command season summer
    
    	while I_TurnNumber = 6
    	end_while
    
    	console_command date -51
    	console_command season winter
    
    	while I_TurnNumber = 7
    	end_while
    
    	disable_shortcuts options_button false
    	console_command date -52
    	console_command season summer
    
    	while I_TurnNumber = 8
    	end_while
    
    	disable_shortcuts options_button true
    	console_command date -52
    	console_command season summer
    
    	while I_TurnNumber = 9
    	end_while
    
    	console_command date -52
    	console_command season summer
    
    	while I_TurnNumber = 10
    	end_while
    
    	console_command date -52
    	console_command season winter
    
    	while I_TurnNumber = 11
    	end_while
    
    	disable_shortcuts options_button false
    	console_command date -53
    	console_command season summer
    
    	while I_TurnNumber = 12
    	end_while
    
    	disable_shortcuts options_button true
    	console_command date -53
    	console_command season summer
    
    	while I_TurnNumber = 13
    	end_while
    
    	console_command date -53
    	console_command season summer
    
    	while I_TurnNumber = 14
    	end_while
    
    	console_command date -54
    	console_command season summer
    
    	while I_TurnNumber = 15
    	end_while
    
    
    end_script

    As you can see at the top I used 'suspend_during_battle on. It worked! The script no longer ends when I play a battle. This is great news.

    You'll also see I added 'disable_shortcuts options_button' at some points in the script. I haven't tested this yet, but it should stop the player going to the main menu unless it is the first turn of a year. This will stop the player saving at the wrong time.

    Now all we need is a trigger and advice which askes the player to run the script when you load a game.


    Now for some more interesting stuff I found. I found the following commands whilst looking through files:


    Code:
    	e_select_settlement
    	select_ui_element 		selected_item_button 
    	simulate_mouse_click 	rclick_up
    	reveal_advice
    I know that 'advisor_portrait_button' is the correct term for that button. I might be possible to put it in a startup script like this:

    Code:
    	select_ui_element 		advisor_portrait_button
    	simulate_mouse_click 	rclick_up

    This might not seem usefull at first glance, but. What if the show me button was called 'advisor_show_me_button' or something like that. Then we could have a startup script which goes something like:

    Code:
    Script
    Wait 2              ;Wait two seconds for the advisor portrait to appear.
    Reveal_advice    ;Start the advisor talking (assuming that is what this command does)
    select_ui_element 		advisor_show_me_button
    simulate_mouse_click 	rclick_up                            ;Start the script
    dissmiss_advice  ;Stop the advisor
    end_script         ;Stop the script
    This would mean there would be no need for the player to do anything, the script would run itself. Of course this wouldn't work for loading games but it would still be amazing, I have yet to test it.
    Last edited by Myrddraal; 12-15-2004 at 09:36.

  5. #5
    Wandering Historian Member eadingas's Avatar
    Join Date
    Nov 2004
    Location
    Llanfairpwll- gwyngyll- gogerych- wyrndrobwll- llantysilio- gogogoch
    Posts
    4,714

    Default Re: Scripting

    You say no saving between years - does that disable quicksave?
    I'm still not here

  6. #6
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Scripting

    No, I didn't think of that, but players should know that saving between years screws up the dates system.

  7. #7

    Default Re: Scripting

    The show_me button is named "advisor_show_me_button". I've always have had trouble monitoring wether a button was pressed or not, so it might not work to simulate it.

    Anyway, nice implementation of the scripting stuff.

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