Page 1 of 5 12345 LastLast
Results 1 to 20 of 93

Thread: TW Script Editor

  1. #1
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default TW Script Editor

    Current Version: Version 0.6.1 (July 08 2015)
    Required: .Net Framework v4.0 or better

    Download: http://www.twcenter.net/forums/downl...o=file&id=3285

    What does TW Script Editor do?

    TW Script Editor is a program which can be used to both edit and validate scripts for Rome: Total War, Barbarian Invasions, Alexander: Total War, Medieval II Total War and Kingdoms. The program is a text editor that provides syntax highlighting for scripts as well as the ability to validate the currently loaded script.

    As this is still very much not a full release only certain items are checked. All events & conditions are checked, the same as for ATVTW, this includes all monitor_event, monitor_condition, if and while blocks. Other things that are at least partially checked include spawn_army blocks (unit lines), add_event blocks, and valid names for all script and console commands. Exact syntax for other script commands and all console commands have not been completed yet.

    How to use TW Script Editor:

    When you first launch TW Script Editor you will be asked to select a mod setting. These settings are the same as those used by ATVTW and any changes made in one program to the settings will affect the other. When the settings are selected, as long as all required files are present, the files will parsed into the program and will be ready to use for validation of the script. At this point an empty script is on screen to create an entirely new script from. To work on an existing script simply open the script and it will appear in the main window. To validate the script press the validate script button. Any errors or warnings will be displayed in error box below the editing window or a message indicating no errors were found will be displayed. Double click on an error or warning to go to that point in the script.

    The colors used for syntax highlighting are controlled by the SyntaxHighlightingColors.xml file. Change any of the colors either to an html color (i.e. blue, black, red, etc) or a hexadecimal color code and restart the program for the changes to take affect.

    Required Files:
    data/export_descr_character_traits.txt
    data/export_descr_ancillaries.txt
    data/descr_cultures.txt
    data/descr_names.txt
    data/descr_sm_factions.txt
    data/export_descr_buildings.txt
    data/export_descr_units.txt
    data/export_descr_advice.txt
    data/text/export_VnVs.txt
    data/text/export_ancillaries.txt
    data/text/export_advice.txt
    descr_regions.txt in either maps/base/ or maps/campaign/imperial_campaign/ or maps/campaign/barbarian_invasion/
    data/text/barbarian_invasion_regions_and_settlement_names.txt or data/text/imperial_campaign_regions_and_settlement_names.txt

    Required M2TW Files:
    data/descr_missions.txt
    data/descr_religions.txt
    data/text/historic_events.txt

    Optional RTW File:
    data/descr_beliefs.txt
    Change log for version 0.6.1

    View Previous Change Logs

    Spoiler Alert, click show to read: 

    See change log for version 0.6.0 here.
    See change log for version 0.5.9 here.
    See change log for version 0.5.8 here.
    See change log for version 0.5.7 here.
    See change log for version 0.5.6 here.
    See change log for version 0.5.5 here.
    See change log for version 0.5.4 here.

    Credits:

    This program makes use of two items not of my creation. The first is the AvalonEdit text editor (the main window) and the second is the find/replace dialog. The first is released under the GNU LGPL and the second under the Code Project Open License (CPOL). Source and object code is available at the first pair of link, the licenses at the second pair of links.
    Last edited by Squid; July 08, 2015 at 06:12 PM. Reason: Updated for version 0.6.1
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  2. #2

  3. #3
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,546

    Default Re: TW Script Editor

    um
    got an error message saying:
    export_descr_ancillaries.txt
    descr_religions.txt
    descr_missions.txt

    were missing from folder - only they are in the folder.

    on the to do list?

  4. #4
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: TW Script Editor

    Does that folder with ATVTW? My guess is that something is wrong with the files or they aren't actually in the location you think they are. Check what folder the settings are pointed to and what is in there. Also check the folder with ATVTW.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  5. #5
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,546

    Default Re: TW Script Editor

    Seems to be working OK now - looks like the pathname I used for the folder was wrong - was looking in main folder not the data folder

    and the good news - no errors in script

  6. #6
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,049
    Blog Entries
    24

    Default Re: TW Script Editor

    Released at last - well done.




  7. #7
    fightermedic's Avatar Ordinarius
    Join Date
    Feb 2008
    Location
    Bavaria
    Posts
    756

    Default Re: TW Script Editor

    this one looks helpfull! thou shall be commended

  8. #8
    wudang_clown's Avatar Fire Is Inspirational
    Join Date
    Jan 2009
    Location
    Poland
    Posts
    7,357

    Default Re: TW Script Editor

    Brilliant! Thank you very much for this extremely useful tool!

    EDIT: I've noticed few strange error reports.

    1. While validating the script, TW Script Editor recognized as errors only these settlements' names I marked in red, while another three remained unnoticed by the tool:
    Code:
    monitor_event SettlementTurnStart SettlementName Azov
    and I_SettlementUnderSiege Azov
    and PercentageOfPopulationInGarrison < 25
    and not SettlementIsLocal
    	if I_SettlementOwner Azov = portugal
    		create_unit Azov, kypchak heavy bowman, num 1, exp 9, arm 0, wep 0
    		create_unit Azov, kypchak medium bowman, num 2, exp 3, arm 0, wep 0
    		create_unit Azov, kypchak slavs swordsmen, num 2, exp 3, arm 0, wep 0
    2. The tool recognized "console_command add_money" as undefined command.
    Last edited by wudang_clown; April 27, 2011 at 05:11 PM.

    Under the patronage of m_1512

  9. #9
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,049
    Blog Entries
    24

    Default Re: TW Script Editor

    1. - could be if the entry in descr_regions is in small caps?
    2. - never had problems with that myself, spelling or formatting of the line?




  10. #10
    wudang_clown's Avatar Fire Is Inspirational
    Join Date
    Jan 2009
    Location
    Poland
    Posts
    7,357

    Default Re: TW Script Editor

    Quote Originally Posted by Gigantus View Post
    1. - could be if the entry in descr_regions is in small caps?
    The thing is, there is no "Azov" in the game, indeed; that should be Azaq, but the tool for some reason sees only first three Azovs in the script. That's nothing concerning caps, I've checked it.
    Quote Originally Posted by Gigantus View Post
    2. - never had problems with that myself, spelling or formatting of the line?
    I'm not sure about formatting, but after removal of console_command the error isn't reported anymore. SS script also uses "console_command add_money" and the tool reports it as error, too. I'm quite sure "console_command add_money" works as intended, but I have no idea why it is reported as error.

    Under the patronage of m_1512

  11. #11
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,049
    Blog Entries
    24

    Default Re: TW Script Editor

    Probably because you don't really need the 'console_command' part as you mentioned:
    add_money [faction] [amount]
    Last edited by Gigantus; April 28, 2011 at 06:33 AM.




  12. #12

    Default Re: TW Script Editor

    Yeah in Kingdoms you can directly use "add_money".

  13. #13
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: TW Script Editor

    Quote Originally Posted by wudang_clown View Post
    Brilliant! Thank you very much for this extremely useful tool!

    EDIT: I've noticed few strange error reports.

    1. While validating the script, TW Script Editor recognized as errors only these settlements' names I marked in red, while another three remained unnoticed by the tool:
    Code:
    monitor_event SettlementTurnStart SettlementName Azov
    and I_SettlementUnderSiege Azov
    and PercentageOfPopulationInGarrison < 25
    and not SettlementIsLocal
        if I_SettlementOwner Azov = portugal
            create_unit Azov, kypchak heavy bowman, num 1, exp 9, arm 0, wep 0
            create_unit Azov, kypchak medium bowman, num 2, exp 3, arm 0, wep 0
            create_unit Azov, kypchak slavs swordsmen, num 2, exp 3, arm 0, wep 0
    2. The tool recognized


    As mentioned most script commands aren't yet parsed, this includes the create_unit script command.

    "console_command add_money" as undefined command.
    Fixed in an upcoming release the program is mixing up the console command add_money with the script command add_money.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  14. #14
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,049
    Blog Entries
    24

    Default Re: TW Script Editor

    It appears the editor isn't set up to properly recognize the set_faction_banner command.

    http://img848.imageshack.us/img848/3804/setbanner.jpg

    When I tried to send the message with the pic embedded I got this message as PM and as regular post:

    http://img832.imageshack.us/img832/7269/length.jpg




  15. #15
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: TW Script Editor

    I didn't realize that set_faction_banner was a block command as opposed to a single line command.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  16. #16
    AJStoner's Avatar Lord of Entropy
    Join Date
    Dec 2010
    Location
    Currently exiled to Florida
    Posts
    1,746

    Default Re: TW Script Editor

    I have got a massive amount of 1 error types and I don't understand what it means:

    Invalid number of arguments for condition appears pretty much before every use of "IS" of "I_"

    My question: huh?

    *MEMBER OF THE HOUSE OF HADER* *UNDER THE CRUEL & MERCILESS PATRONAGE OF y2day*

  17. #17
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    48,049
    Blog Entries
    24

    Default Re: TW Script Editor

    Give a full monitor as an example, please.




  18. #18
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: TW Script Editor

    Quote Originally Posted by AJStoner View Post
    I have got a massive amount of 1 error types and I don't understand what it means:

    Invalid number of arguments for condition appears pretty much before every use of "IS" of "I_"

    My question: huh?
    Quote Originally Posted by Gigantus View Post
    Give a full monitor as an example, please.

    AJStoner, sooner rather than later as if there's a bug I've missed I'd like to get it fixed in the next release which is imminent.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  19. #19
    AJStoner's Avatar Lord of Entropy
    Join Date
    Dec 2010
    Location
    Currently exiled to Florida
    Posts
    1,746

    Default Re: TW Script Editor

    Alright, as an example:

    Code:
    monitor_event FactionTurnStart FactionType ireland
        and I_SettlementOwner Cork ireland
        and I_SettlementOwner Lifford ireland
        and I_SettlementOwner Downpatrick ireland
        and I_SettlementOwner Athenry ireland
        and I_SettlementOwner Trim ireland
        and I_SettlementOwner Dublin ireland
        and I_SettlementOwner Tipperary ireland
        and I_SettlementOwner Derry ireland
        and I_SettlementOwner Belfast ireland
        and I_SettlementOwner Waterford ireland
        and I_SettlementOwner Tralee ireland
        and I_SettlementOwner Castlebar ireland
        and I_SettlementOwner Ardmore ireland
        and I_SettlementOwner Ballymote ireland
        and I_SettlementOwner Kildare ireland
        and I_SettlementOwner Carrick_On_Shannon ireland
        and I_SettlementOwner Galway ireland
        and I_SettlementOwner Omagh ireland
        and I_SettlementOwner Dungloe ireland
        and I_SettlementOwner Dungannon ireland
    


    Every single line here reports:

    Invalid number of Arguments for condition 'I_SettlementOwner'.


    And the colored line here, same thing: (just noticed there is no space here between 'ynys_mon' and 'factions' on the historic_event line but there is in the campaign script. It shows differently in script editor for a lot of lines like that.)

    ;--- Ynys Mon Event

    monitor_event FactionTurnStart FactionType ireland
    and I_EventCounter pagan_conversion_accepted =1
    and I_SettlementOwner Caernarvon ireland

    historic_event ynys_monfactions { ireland, }
    terminate_monitor
    end_monitor


    ----------------------------------------------------------------

    I get one on this line saying same thing except 'Invalid number of Arguments for condition I_EventCounter'

    Code:
     and I_EventCounter gunpowder_discovered 1
    ----------------------------------------------------------------

    And here on the black line I get: 'Invalid number of Arguments for condition I_CharacterExists'

    Code:
    ;--- Sir William's Chosen Men
    monitor_event FactionTurnStart FactionType scotland
        and FactionBuildingExists >= drill_square
        and I_CharacterExists William Wallace
        and I_EventCounter sir_william_accepted = 0
        and I_EventCounter sir_william_declined = 0
        and Treasury > 35000
     
        historic_event sir_william true factions { scotland, }
     
                ;if AI random chance to accept
                if I_IsFactionAIControlled scotland
     
                    generate_random_counter    br_random_accept 0 2
                    if I_EventCounter br_random_accept < 2
                        set_event_counter sir_william_accepted 1
                    end_if
     
                end_if
     
            terminate_monitor
     
    end_monitor
    


    There are 680 of these all told.
    Last edited by AJStoner; July 25, 2011 at 01:44 PM. Reason: noticed something new

    *MEMBER OF THE HOUSE OF HADER* *UNDER THE CRUEL & MERCILESS PATRONAGE OF y2day*

  20. #20
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: TW Script Editor

    Same type you have for the two conditions, you're missing the logical operator (in all cases the = sign) between the settlement and the owner for the I_SettlementOwner and between the event and the value for I_EventCounter.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

Page 1 of 5 12345 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •