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

    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.

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

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

  4. #4

    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.

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

    Default Re: Scripting

    Thx Enrique, I thought it was, but I hadn't seen it anywhere.

    I can't test it right now (problems with my computer) but if it works it means we have a way of running startup scripts without stopping the player saving.

  6. #6

    Default Re: Scripting

    Would it be possible to now get a list of the required changes to implement 4 turns a year, with any show me how limitations etc, or whatever. I have gathered that the saving problem can be solved, but is the problem with loading messing up the years/turns still around?

    If we can save and load, even if show me how must be used to start the script each time we load, without other side effects, could a simple and complete tutorial be put together. I find this thread hard to follow.

    Crassus
    Horum omnium fortissimi sunt Belgae, propterea quod a cultu atque humanitate provinciae longissime absunt, minimeque ad eos mercatores saepe commeant atque ea quae ad effeminandos animos pertinent important, proximique sunt Germanis qui trans Rhenum incolunt, quibuscum continenter bellum gerunt. - Julius Caesar - de Bello Gallic

  7. #7
    Actual Person Member Paul Peru's Avatar
    Join Date
    Sep 2004
    Location
    Yurp
    Posts
    529

    Thumbs up Re: Scripting

    Well, paint me plaid and refer to me as a filthy cataphract camel!
    The CA has bestowed upon us a list of conditions and commands and a so-called scripting_manual!!!
    etc.
    Sono Pazzi Questi Romani
    Paul Peru: Holier than thy bucket!

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