Results 1 to 20 of 20

Thread: Intermediate Guide to Scripting Discussion

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: Intermediate Guide to Scripting Discussion

    very good point The Mark

    alpaca, note that if you don't include terminate_monitor in the first monitor, then the script will wait for the event to be triggered, but that event could be triggered multiple times...

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Intermediate Guide to Scripting Discussion

    I know, that's why they are terminated once the counter becomes non-zero and they are invoked...
    Or did you mean something else?

  3. #3
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Intermediate Guide to Scripting Discussion

    Adding a thing about condition monitors and counters, the I_CompareCounter can be placed in an if just after the monitor. Much neater than using two monitors,a nd much simpler, too. Prolly that's why I didn't think of it earlier.

    Code:
    monitor_conditions condition
    if I_CompareCounter
    stuff
    end_if
    end_monitor

  4. #4
    Senior Member Senior Member Duke John's Avatar
    Join Date
    May 2003
    Location
    Netherlands
    Posts
    2,917

    Default Re: Intermediate Guide to Scripting Discussion

    I am trying to test the value of a character's trait during a turn and I had hoped that the following would work:

    script

    Code:
    console_command give_trait Barrivendos GoodCommander
    
    monitor_conditions not I_CharacterSelected Barrivendos
    and Trait GoodCommander >= 1
    	console_command give_trait Barrivendos GoodAttacker
    terminate_monitor
    end_monitor
    
    end_script
    But it does not Can anyone see what is wrong?

    Barrivendos does get the GoodCommander trait which should have a value of 1. Then the not I_CharacterSelected Barrivendos should put the focus on the character which then allows testing the value of the GoodCommander trait. Or doesn't it work like that?

    Any help would be greatly appreciated!

  5. #5
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Intermediate Guide to Scripting Discussion

    What you need to get the Trait condition work is an exported character_record, and condition monitors don't export values; you'll need an event monitor, and convenient events to do that are far and few between.

  6. #6
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Intermediate Guide to Scripting Discussion

    I don't think it's possible except through CharacterSelected which involves that the player does something and the character is on the map.
    You might also consider using a show_me

  7. #7

    Default Re: Intermediate Guide to Scripting Discussion

    I have a question regarding scripts.

    I'm trying to get a show_me script to run from a background script, but it doesn't seem to be working. This is similar to the Client Kingdoms mod implemented into the TFT mod. The background script works fine and all other functions within it work as intended. Here is the background script section that is supposed to start the show_me script:

    Code:
    monitor_event SettlementTurnStart SettlementName Rome
    	and SettlementIsLocal
    	and Treasury > 5000
    	advance_advice_thread Recruit_Legion_Thread
    end_monitor
    This is just temporary until I can get it working - then I'll tweak the costs and add a RandomPercent. Here is the advice thread it refers to:

    Code:
    AdviceThread Recruit_Legion_Thread
        GameArea Campaign
        
        Item Recruit_Legion
        		Uninhibitable
        		Verbosity  0 
        		Threshold  1  
        		Attitude Normal
        		Presentation Default
        		Title Recruit_Legion_Title
         	Script scripts\show_me\recruit_roman_legion.txt
    		Text Recruit_Legion_Text1
    And yes, I have set up the text. Finally, here is the whole show_me script:

    Code:
    script
    console_command create_unit Rome "roman hastati" 2
    console_command create_unit Rome "roman princeps" 2
    console_command create_unit Rome "roman velite" 2
    console_command create_unit Rome "roman Triarii" 1
    console_command create_unit Rome "roman light cavalry" 1
    console_command add_money -5000
    console_command add_population Rome -1210
    
    select_ui_element advisor_dismiss_button
    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up
    
    terminate_script
    end_script
    Can anyone see what I'm doing wrong here? I've tried changing it so that the script runs when Rome is selected using I_SettlementSelected SettlementName Rome but no dice...

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